I'm trying to write a POS-style application for a Sheevaplug that does the following:
- Captures input from a card reader (as I understand, most mag card readers emulate keyboard input, so basically I'm looking to capture that)
- Doesn't require X
- Runs in the background (daemon)
I've seen examples of code that will wait for STDIN, but that won't work because this is a background process with no login, not even a monitor actually.
I also found this snippet elsewhere on this site:
from struct import unpack
port = open("/dev/input/event1","rb")
while 1:
a,b,c,d = unpack("4B",port.read(4))
print a,b,c,d
Which, while being the closest thing to what I need so far, only generates a series of numbers, all of which are different with no way that I know of to translate them into useful values.
Clearly, I'm missing something here, but I don't know what it is. Can someone please how to get the rest of the way?