On Mon, Oct 18, 2010 at 6:19 PM, Paul Boniol <[email protected]> wrote: > On Sat, Oct 16, 2010 at 6:39 AM, Steven S. Critchfield > <[email protected]> wrote: >> From the looks there, it is on /dev/input/input4, try >> cat /dev/input/input4 >> >> Then do a swipe. >> >> ----- Original Message ----- >>> I finally got back to trying to redirect the input from the mag-strip >>> reader. I change its operating mode to HID-Serial. Things didn't go >>> quite as I thought, but somewhat suspected that it may. >>> >>> This gave the following messages when I connected the reader to Linux: >>> >>> kernel: usb 4-1: new low speed USB device using uhci_hcd and address 2 >>> kernel: usb 4-1: device descriptor read/64, error -71 >>> kernel: usb 4-1: device descriptor read/64, error -71 >>> kernel: hub 4-0:1.0: unable to enumerate USB device on port 1 >>> kernel: usb 4-1: new low speed USB device using uhci_hcd and address 4 >>> kernel: usb 4-1: New USB device found, idVendor=154a, idProduct=0004 >>> kernel: usb 4-1: New USB device strings: Mfr=1, Product=2, >>> SerialNumber=0 >>> kernel: usb 4-1: Product: Magnetic Card Reader >>> kernel: usb 4-1: Manufacturer: ID Innovations Inc. >>> kernel: input: ID Innovations Inc. Magnetic Card Reader as >>> /devices/pci0000:00/0000:00:1a.1/usb4/4-1/4-1:1.0/input/input4 >>> kernel: generic-usb 0003:154A:0004.0003: input,hidraw2: USB HID v1.00 >>> Keyboard [ID Innovations Inc. Magnetic Card Reader] on >>> usb-0000:00:1a.1-1/input0 >>> kernel: generic-usb 0003:154A:0004.0004: hiddev0,hidraw3: USB HID >>> v1.00 Device [ID Innovations Inc. Magnetic Card Reader] on >>> usb-0000:00:1a.1-1/input1 >>> >>> It added the following devices in /dev: >>> >>> /dev/hidraw2 >>> /dev/hidraw3 /dev/bus/usb/004/004 >>> /dev/char/13:68@ /dev/char/180:0@ >>> /dev/char/189:387@ /dev/char/252:2@ >>> /dev/char/252:3@ /dev/input/event4 >>> /dev/input/by-id/ >>> usb-ID_Innovations_Inc._Magnetic_Card_Reader-event-kbd >>> /dev/input/by-path/pci-0000:00:1a.1-usb-0:1:1.0-event-kbd >>> /dev/usb/hiddev0 >>> >>> I was unable to display any data from any serial port in Linux or >>> Windows (except through the Windows configuration program). >>> >>> Any advice on how to read data from it from here? >>> >>> Available modes are: >>> USB-Keyboard (normally types data wherever the cursor is located) >>> HID-Serial (I thought this would be good...) >>> HID-Formatted (????) >>> >>> Paul Boniol >>> >> >> -- >> Steven Critchfield [email protected] >> > > cat /dev/input/input4 > No such file or directory > > cat /dev/bus/usb/004/004 > Displays some interesting characters > > Most of the new /dev entries do not have any response or are links to > the other /dev entries. > > cat /dev/hidraw3 displays the magstripe data! I think we have a winner. > > Is there anything special I need to know about or do differently > reading directly from /dev entries with Perl as opposed to reading a > normal text file? > > Thanks for the help! > Paul Boniol >
I've got it working, though I'm seeing what I'm guessing is more low level information mixed in the data. It seems to follow the pattern: /(\x00|\xC0)\x02\xN/ where N is the number of bytes of data following, up to 5 bytes. (The Card office encodes I believe 25 characters in the stripe that I need to read + 1 CR.) It threw me for a minute because the low ASCII characters aren't displayed on the screen by cat, and the C0 just started after a reboot. Is this format normal/documented for raw /dev files? The input is terminated by a CR, so I have that as my input-line-terminator. Thus I have no need for the pattern/number of bytes. I could see if the CR was not there you would need to know when one input was finished and where another would begin... Paul -- You received this message because you are subscribed to the Google Groups "NLUG" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nlug-talk?hl=en
