So, after searching a little bit... have found the following way to capture the input from my USB QR code scanner.
import sys
pipe = open('/dev/input/event3', 'r')
while 1:
for character in pipe.read():
print(character)
It works, but I still have 2 questions regarding the method above.
I'm on a Raspberry device with Debian Wheezy and a GUI, and can confirm Question 2 happening on a GUI... don't know yet the output on a system without GUI
- Any better way of doing it?
- The method above, when I click right the script cancels and outputs all the entries that have been scanned, at once. Why is that?
UPDATE
I think I have miss interpreted the result for the code above, as it finally it outputs ASCII characters, so I ended up doing the following:
sys.stdin = open('/dev/tty')
a = raw_input('Scan: ')