Linux - HardwareThis forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I recently purchased a USB magstripe reader as I was curious as to what lives on all of my various cards. The device works as a USB HID (keyboard) and "types" the data that it reads from the card.
Under Windows XP it is picked up as a HID device and works just as expected. Unfortunately, things don't go so well under Linux.
It is picked up as a HID keyboard well enough. I get the following from the kernel messages:
Code:
Dec 5 23:44:38 T-Bird kernel: usb 6-1: new full speed USB device using uhci_hcd and address 3
Dec 5 23:44:38 T-Bird kernel: usb 6-1: configuration #1 chosen from 1 choice
Dec 5 23:44:38 T-Bird kernel: input: HID f725:f834 as /devices/pci0000:00/0000:00:10.1/usb6/6-1/6-1:1.0/input/input10
Dec 5 23:44:38 T-Bird kernel: input: USB HID v1.10 Keyboard [HID f725:f834] on usb-0000:00:10.1-1
But after that, nothing happens. There are status lights on the reader, which flash during power up and turn off when it is ready to read. Under Windows the light goes out as soon as it loads up the drivers, but on Linux the light never stops flashing. It seems like the reader is waiting for some sort of "OK" from the computer before it actually activates.
I am pretty much clueless on low-level USB communication, so I am not sure if there is some way to sniff this exchange from a Windows machine and then somehow replicate whatever the reader is waiting for under Linux.
Or perhaps somebody has already used a USB mag stripe reader under Linux and has some first-hand knowledge? The reader is Chinese, and there isn't a word of English in the manual. The model number is HCE-402U, but searching that in reference to Linux has not helped much.
I was able to get the device work ONCE in Ubuntu. When that happened blinking just suddenly stopped and dmesg said:
[ 3859.653828] /build/buildd/linux-2.6.24/drivers/hid/usbhid/hid-core.c:
ctrl urb status -75 received
I actually want to use the reader with Asus WL-500g router. I came across with an interesting Bifrost-project (birfrost.projects.linpro.no), where they are using USB card reader. Before trying to find an Openwrt distribution with required modules I assume that I should figure out how get the device work in a desktop Linux.
Stripe Snoop is for raw devices, not HID readers like this. Stripe Snoop doesn't even support USB-native devices as far as I know, only serial devices through USB adapters.
I have looked around online and found mention of people trying to write mag stripe drivers for 2.6 based on the existing USB HID modules, but information on the topic in general is pretty scarce.
It is just aggravating that it works perfectly as a keyboard under Windows, there is no reason it shouldn't under Linux too. There is just some missing element that I can't seem to figure out.
This is actually the second piece of Chinese hardware I have purchased that works as a basic device under Windows but fails under Linux. It is interesting to see the subtle differences between the way both operating systems handle hardware that is supposedly standardized.
Well neither of those are USB...so I don't know what you want me to tell you. SS doesn't support native-USB readers or HID-based devices (USB, PS/2, POS, etc). As primary development on SS stopped some time ago, there isn't much chance of that changing in the near future.
I could use SS to parse the ASCII text returned by the reader (I.E. ss -i), but the reader would need to work properly on it's own with the USB HID drivers before I could do that.
I agree with you. I assume that it is only very small thing which this device requires.
When I looked dmesg information:
[ 3821.034151] input,hidraw0: USB HID v1.10 Keyboard [HID f725:f834]
on usb-0000:00:07.2-1
and searched around this, I got idea that in case of recognized keyboards, e.g. [HID f725:f834], was replaced by identification of model and manufacturer.
Good opportunity (for me) to learn more about USB low level operations and debugging
Is there software USB "debugger" for Windows XP (/is it possible)?
Is there Linux usb "debugger"?
And finally how to add required initialization for HID f725:f834?
Not terribly helpful news, but I had the same experience you did, jo2.
I plugged the reader in (first time in a day or so) and it instantly initialized and started working. Same messages as well:
Code:
usb 6-2: new full speed USB device using uhci_hcd and address 2
usb 6-2: config 1 interface 0 altsetting 0 has 2 endpoint descriptors, different from the interface descriptor's value: 1
usb 6-2: configuration #1 chosen from 1 choice
input: HID f725:f834 as /devices/pci0000:00/0000:00:10.1/usb6/6-2/6-2:1.0/input/input12
input: USB HID v1.10 Keyboard [HID f725:f834] on usb-0000:00:10.1-2
drivers/hid/usbhid/hid-core.c: ctrl urb status -75 received
Now the thing that interested me was that new line, about the altsetting. This is the only thing that is different between when it works and when it doesn't, so logically there must be something more to it. I am looking around a bit online trying to figure out a bit more.
For reference, here is the verbose output of lsusb when the reader is detected properly and working:
On an extremely confusing note, I now am unable to make the reader NOT work. After unplugging it and plugging it back in multiple times, it keeps initializing properly. Every time it says the same thing about the altsetting. While you would think this would be a good thing, I know I didn't do anything differently here and this must be a fluke. I want to get a real fix for this, so I am going to try it on a few of my other boxes and hope it stops working so I can figure out what changes.
My current theory is that this device employs a buggy firmware that doesn't always report itself properly to the host operating system. Windows probably ignores whatever obscure data bit is changing, while the Linux kernel notices it and prints the altsetting message. It seems like it is just a matter of forcing it to do it all the time.
Just wondering if anyone ever managed to get this working in Linux? I have similar problems. Works fine in Windows, and once randomly started working in Linux when I was playing around with the dip switches, while the device was plugged in.
Also, can anyone tell me what the dip switches actually do? I'm having trouble reading the chinese manual!
I actually haven't tried the reader in recent kernels, so I don't know if the situation has improved any. Last time I tried it, I was having the same problems.
As for the switches, the only functions I remember off the top of my head is toggling control characters (one setting gives you raw stripe data, other wraps it in "?" I believe), and the other toggles inserting "return" after the data. The other switch option is supposed to enable track 3 reading, but on mine it never seemed to work.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.