Python Forum

Full Version: Thoughts on interfacing with a QR code reader that outputs keystrokes?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have a hardware QR code reader that seems to act as a regular HID device (keyboard), and when it detects a QR code it outputs a long string. For example if I have a text editor open when I scan a QR code it will output to the text editor something like:

BCD0011SCTBPOTBEB1Red CrossBE72000000001616EUR1CHARUrgency fundSample EPC QR Code

I'd like to monitor it with Python from Windows to collect the data from the QR code. I'm wondering if anyone has any tips?

I was considering using the PyHook module and logging every keystroke and watching for the termination character ("\n"). But maybe there's some other clever way that I haven't considered yet?

Thanks for any tips.
Can you just have the program loop over input() to read each line as it is "typed"?