How to read out an USB Rfid Reader imitating an HID keyboard using Linux and Python3
I'm using an Rfid Reader (a small usb stick) which imitates an HID keyboard on Debian Linux (Squeeze).
less -f /dev/input/event2 gives me a bunch of gibberish on the screen the moment an rfid tag is scanned. By using an evdev Python library ( http://bit.ly/kZkO2b ) I could actually decode the string correctly.
But I think I'm barking up the wrong tree. This seems much too complicated. If the rfid reader works lik开发者_如何学编程e an HID keyboard I should be able to access it by using basic functions like sys.stdin, right? So how is this done properly?
Since the user hasn't replied here since May 2011, but did find a solution to his problem as stated in his comment, I am hereby taking the liberty of posting said solution and getting this question out of the "Unanswered" queue.
The problem was solved after the user realized he was logged into the embedded device through SSH. He proceeded by simply reading /dev/tty0
using io.open
from the Python 3 standard library.
精彩评论