[libhid-discuss] Trouble with IOCTL_USB_REAPURB

Charles Lepple clepple at ghz.cc
Thu Dec 21 15:38:19 CET 2006


On Dec 20, 2006, at 11:58 AM, Storm Scratcher wrote:

> Hi !
>
>  I use libusb 0.1.12 and libhid from svn (0.2.14 i think) on arm7
>  platform running kernel 2.4.24
>  I wrote a program which read data from a metrologic barcode scanner
>  I use hid_interrupt_read() function to get data from scanner :
>
>  m_iHIDErrorCode = hid_interrupt_read( m_pHidHandle, USB_ENDPOINT_IN 
> +1,
>  un_pcData, un_uiDataLength, un_uiTimeout );
>
>  With a timeout of 1000, it hangs during an IOCTL_USB_REAPURB in  
> one of
>  the libusb functions : usb_urb_transfer() ( called by
>  usb_interrupt_read() called by hid_interrupt_read() :) )

This sounds like a bad interaction between your version of libusb and  
the kernel.

Which host controller interface are you using - OHCI or UCHI?

Older versions of libusb (0.1.10, or maybe earlier) did not use the  
URB ioctl()s, but used the proc interface to send and receive  
packets. If you have time, that's what I would look at first.

>  With a timeout of 0, i can read data from scanner without problems  
> but
>  when i close connection, i was unable to read data from device (my
>  program is blocked on hid_interrupt_read() function). I need to  
> reboot
>  the cpu
>
>  I test my program into my computer (i386) on Redhat Fedora Core 5  
> (kernel 2.6.15) and
>  i don't notice any problems to read data from scanner with my program
>  (and the same librairies compiled for i386).
>
>  Can you explain function hid_set_idle(), i do this after open
>  connection with hid_force_open function :

This is a thin wrapper around the HID Set_Idle request. See the HID  
spec (page 62 of version 1.11) for more details:

http://www.usb.org/developers/devclass_docs/HID1_11.pdf

You probably want to set the idle time to something non-zero. The  
actual value will depend on the application.


-- 
Charles Lepple
clepple at ghz.cc





More information about the libhid-discuss mailing list