I have a barcode scanner that, like most, injects the scanned string and a lf as text from a keyboard. Rather than scan data into an application, I'd like to simply log the time of the scan and barcode data scanned to a file.
I'm so new to this I feel like an idiot but assume I can loop and and use evdev.py to distinguish between the "real" keyboard and the scanner (scanner is on /dev/input/event7). My question is how to detect the scan, write the characters to a file and, if possible, stop the barcode "keystrokes" from getting to X.
So far:
PHP Code:
import evdev
scanner_location = '/dev/input/event7' # get the correct one from HAL or so
scanner_device = evdev.Device(scanner_location)
while 1:
scanner_device.poll()
In my ignorance, I do not know what to test in the loop and what do next ... please help