LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 12-05-2008, 10:48 PM   #1
MS3FGX
LQ Guru
 
Registered: Jan 2004
Location: NJ, USA
Distribution: Slackware, Debian
Posts: 5,852

Rep: Reputation: 361Reputation: 361Reputation: 361Reputation: 361
USB Magstripe reader not working


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.
 
Old 12-05-2008, 10:58 PM   #2
lazlow
Senior Member
 
Registered: Jan 2006
Posts: 4,363

Rep: Reputation: 172Reputation: 172
You might have a look here: http://stripesnoop.sourceforge.net/
 
Old 12-06-2008, 12:53 PM   #3
jo2
LQ Newbie
 
Registered: Dec 2008
Location: Finland
Distribution: Ubuntu, OpenWrt
Posts: 5

Rep: Reputation: 0
I got the same device about a week ago.

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.

All the help is appreciated!
 
Old 12-06-2008, 02:14 PM   #4
MS3FGX
LQ Guru
 
Registered: Jan 2004
Location: NJ, USA
Distribution: Slackware, Debian
Posts: 5,852

Original Poster
Rep: Reputation: 361Reputation: 361Reputation: 361Reputation: 361
Quote:
Originally Posted by lazlow View Post
You might have a look here: http://stripesnoop.sourceforge.net/
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.
 
Old 12-06-2008, 04:51 PM   #5
lazlow
Senior Member
 
Registered: Jan 2006
Posts: 4,363

Rep: Reputation: 172Reputation: 172
Quote:
Support game port based and Keyboard based magstripe Readers.
Which would indicate to me that it is for more than serial devices.
 
Old 12-06-2008, 05:00 PM   #6
MS3FGX
LQ Guru
 
Registered: Jan 2004
Location: NJ, USA
Distribution: Slackware, Debian
Posts: 5,852

Original Poster
Rep: Reputation: 361Reputation: 361Reputation: 361Reputation: 361
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.

Last edited by MS3FGX; 12-06-2008 at 05:10 PM.
 
Old 12-06-2008, 05:10 PM   #7
jo2
LQ Newbie
 
Registered: Dec 2008
Location: Finland
Distribution: Ubuntu, OpenWrt
Posts: 5

Rep: Reputation: 0
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?
 
Old 12-06-2008, 05:14 PM   #8
lazlow
Senior Member
 
Registered: Jan 2006
Posts: 4,363

Rep: Reputation: 172Reputation: 172
Essentially Linux does not care if is USB or not (as long as it is a HID). http://www.linux-usb.org/USB-guide/x194.html
 
Old 12-06-2008, 09:12 PM   #9
MS3FGX
LQ Guru
 
Registered: Jan 2004
Location: NJ, USA
Distribution: Slackware, Debian
Posts: 5,852

Original Poster
Rep: Reputation: 361Reputation: 361Reputation: 361Reputation: 361
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:

Code:
Bus 006 Device 002: ID f725:f834  
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0         8
  idVendor           0xf725 
  idProduct          0xf834 
  bcdDevice            0.01
  iManufacturer           0 
  iProduct                0 
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           41
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0xa0
      (Bus Powered)
      Remote Wakeup
    MaxPower              100mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      1 Boot Interface Subclass
      bInterfaceProtocol      1 Keyboard
      iInterface              0 
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.10
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      63
         Report Descriptors: 
           ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0008  1x 8 bytes
        bInterval              10
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.

Last edited by MS3FGX; 12-06-2008 at 09:17 PM.
 
Old 11-18-2009, 03:28 PM   #10
billyjoseph
LQ Newbie
 
Registered: Nov 2009
Posts: 1

Rep: Reputation: 0
Hey,

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!
 
Old 11-18-2009, 06:48 PM   #11
MS3FGX
LQ Guru
 
Registered: Jan 2004
Location: NJ, USA
Distribution: Slackware, Debian
Posts: 5,852

Original Poster
Rep: Reputation: 361Reputation: 361Reputation: 361Reputation: 361
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Internal card reader not working, continually spawning new USB devices MS3FGX Linux - Hardware 2 12-07-2007 06:37 AM
IBM SurePOS 4840-544 Magstripe Not working as Keyboard Wedge tmorrow Linux - Hardware 0 06-20-2007 02:03 PM
sd/mmc card reader not working wisdomvk Linux - Laptop and Netbook 2 03-15-2007 12:51 AM
SD Card reader not working pburn Ubuntu 3 11-07-2006 04:26 PM
USB jumpdrive/ USB hud-card reader issues o0gnubee0o Linux - Hardware 4 07-03-2005 06:12 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 08:27 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration