Hi all,

I wanted a way (on Linux) to access magstripe (credit card) readers and 
similar devices which pretend to be a keyboard (including usb number 
(10-key) pads and supposedly also barcode readers) without suffering 
the ills of "must be attached to terminal" and "oops, dvorak keymap 
garbles the credit card" info.

I determined that libhid is just the thing.  It now has sort of a perl 
binding.

http://scratchcomputing.com/svn/Linux-USBKeyboard/trunk/examples/numpad.pl

It's basically just a constructor (create()), destructor, and the 
_char() method at this point.

Where I'm stuck is on whether to attempt doing any more of the 
implementation in C or just to wrap _char() with some looping in Perl.  
The cpu usage of the above app is *very* low (not at all what you would 
expect from while(1), but it appears that libhid blocks a bit.)

I thought about having _char() return undef, but I'm a bit rusty on how 
to do that and that just means having to always check defined() vs the 
maybe-more-convenient "zero length string" we get with this setup.

Any advice?

Anybody have such a device (or second usb keyboard) and want to try it?  
Is libhid on windows?  I'll be heading to bed now with visions of a wx 
calculator running in the background and connected to the numpad 
despite the lack of keyboard focus :-D.

I'm thinking a filehandle-like usage would be really cool, but I'm 
having a hard time finding a reason to write any more C code (because I 
could just pipe-open a child for reading.)

Thanks,
Eric
-- 
"Ignorance more frequently begets confidence than does knowledge."
-- Charles Darwin
---------------------------------------------------
    http://scratchcomputing.com
---------------------------------------------------

Reply via email to