Help, please.

I have a USB credit card reader working great with Suse 9.0 (kernel 2.4). The USB credit card reader is a Magtek insertion card reader (the kind you find at the gas pump). The card reader sends data as HID Input usage reports.

I am trying to move the application to a 2.6 kernel environment. The program compiles and the device is recognized on the 2.6 kernel (dmesg reports the device being detected). However, when I swipe a credit card at the device, the kernel never sees the event (or rather never passes it on to the user space program to decode the credit card).

Basically, my user space program does this:

USB_PORT_FD = open("/dev/usb/hid/hiddev0", O_RDWR|O_NOCTTY);

while (1) {
   timeout.tv_sec = 0;
   timeout.tv_usec = 100000;  /* 100 millisecond timeout */

   FD_ZERO(&readFDS);
   FD_SET(USB_PORT_FD, &readFDS);
   validData = select((USB_PORT_FD+1),&readFDS,NULL,NULL,&timeout);
   if (validData < 1) {
      // no data
      continue;
   } //end if

   read(USB_PORT_FD, hiddev_event, sizeof(struct hiddev_event));

   rInfo.report_type = HID_REPORT_TYPE_INPUT;
   rInfo.report_id = HID_REPORT_ID_FIRST;

   while ((ioctl(USB_PORT_FD, HIDIOCGREPORTINFO, &rInfo)) >= 0) {
      ...
      // code inside here to read usage reports

      // after all data is read, process card data

      rInfo.report_id |= HID_REPORT_ID_NEXT;

   } //end while

} //end while


From the code above, the select statement never indicates data available to read on the file descriptor. If I bypass the select, and just force it to go to the read statement, the read hangs (even when I swipe the credit card while at the read statement).


This code works great in 2.4 kernel.  But, it does not work in 2.6.

Please any suggestions would be of great help.

Ken Cobler


------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ [email protected] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to