Python Forum

Full Version: listening to USB
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

I have made some progress into the not-so-easy listening to input from USB busses.
The setup:
RPi 3, python

I have 3 (identical) numerical keypads attached to 3 USB ports.

I have succeeded in reading vendor & product number and the bus numbers of the USB busses (each boot they are different,
but that is not a problem) Of course vendor & product number are 3x the same.

3 people will be typing 1-digit numbers on the keypads, each one and they stop.(actually answering multiple choice questions)
What i have to do is figure out who typed which number.

I imagine that if i can associate the bus number to the typed number and then parse,
i'm on my way.

But how do i get started, what method ...?

Thanks
Paul
you might want to take a look at: http://www.binarytides.com/python-packet...ode-linux/
This was written for Linux, (socket api runs differently on windows), but it may give you some ideas.
also: https://www.laurapickens.net/projects/20...t_sniffer/
and rfc's 791 (https://www.rfc-editor.org/info/rfc791).
OK, thanks, will do !

Paul
Update:
USB stuff is not relaxing !
Starting from the above links, and after about 100 related searches, i finally came across somebody with the same problem.
Even then, you sort of have to reverse-engineer from there.
https://www.domoticz.com/wiki/Assign_fix...o_USB_port
https://unix.stackexchange.com/questions...tatic-name

It has been done, but a lot of uncharted territory for me !
The trick is to assign new names to the 3 USB ports with identical devices. = "rules"
- How do i get the RPi to incorporate my new rules ? (in etc/udev/rules.d/)
- And, most importedly, how do i get python to listen specifically to USb port 1 , 2 and 3 ,
using those new names ?

No white smoke yet, still working...
Paul