The setup: a minimalistic Linux (OpenWRT on ASUS router), a USB keyboard (assume I know the device name like /dev/hiddev0)
A goal: write a python (or shell, in this case I can use it like a proxy for python) script that will listen to this device and perform some actions based on the user input
As a beginning - quite enough to echo user-entered characters to text file of given name.
PyUSB looks really confusing. I'm ok with PySerial, though I'm not sure if it suits the task - when trying to open the device it says "serial.serialutil.SerialException: Could not configure port: (22, 'Invalid argument')"
UPD: well, OK, the trivial answer was "cat /dev/input/event1"
But the output is really cryptic - any hint on interpreting it (as character int codes)?
UPD UPD: hexdump /dev/input/event1 is much better! it gives 6 9-tuples for each key press (I suppose, 3 for key down, 3 for key up) It would probably be not so difficult to decrypt it
But more civil way is still highly appreciated
http://svn.navi.cx/misc/trunk/python/evdev/evdev.py looks interesting...