c++linuxmagnetic-cards

linux background card swipe reader


I currently have a USB card swipe attached to an embedded linux machine and from what I can tell and from what I have researched it acts as a keyboard, and inputs all the data as if I were typing. Now I have a perl script that takes all this data and saves it to a file. The only problem is, it only knows to take the data when the perl script is running in the foreground otherwise, where does the "keyboard" input to.

My question is how can I make this card swipe run the script every time it reads input? Or could I somehow capture the data with an app running in the background. I.E. in a c++ program, running in the background, will cin read ANY input to the machine?

I have never messed around with a card swipe reader so Im not 100% sure on how they work.

Any suggestions on this would be appreciated!


Solution

  • I have an idea, but it is very general.

    Can you constantly be monitoring for data in another program, buffer it, and then pipe the results into your perl script when the buffer reaches a certain size or goes for a certain period of time without activity? If you pipe it in, you shouldn't have to modify your perl script, since it will still be on STDIN.

    So, it would be like this:

    Monitoring Program -> Collects Data -> Pipes it into your Perl program

    I hope this idea is helpful.

    -Brian J. Stinar-