Reputation: 145
If i have two keyboards (default keyboard and an RFID reader) in my Linux machine Using python how can I know from which device the input is coming from ?
I can read my input using the
input()
but i need to distinguish between the two devices
Upvotes: 2
Views: 6929
Reputation: 817
I'm assuming the RFID reader works on USB, if that's the case, should be treated like an input device as well as the HID Keybord (I'm assuming HID by your default).
I'm using evdev in python to do something similar for myself. You can find the documentation here: http://python-evdev.readthedocs.io/en/latest/tutorial.html#reading-events
It has lots of simple and useful examples, like identify and read from multiple devices asynchronously. I found it very easy to use.
Upvotes: 2