Hi Charles,<br><br>Thanks for answers.<br><br>Host controller is a SL811HS.<br><br>I tried with libusb-0.1.8 and i get this : "could not claim interface 0: Device or resource busy"<br><br>usb_set_debug: Setting debugging level to 9 (on)
<br> NOTICE: hid_init(): libhid 0.2.14.0.0 is being initialized.<br> TRACE: hid_init(): initialising USB subsystem...<br>usb_os_init: Found USB VFS at /proc/bus/usb<br> TRACE: hid_init(): scanning for USB busses...<br>usb_os_find_busses: Skipping non bus directory devices
<br>usb_os_find_busses: Skipping non bus directory drivers<br>usb_os_find_busses: Found 001<br> TRACE: hid_init(): scanning for USB devices...<br>usb_os_find_devices: Found 001 on 001<br>Config descriptor too short (expected 257, got 15)
<br>usb_os_find_devices: Found 002 on 001<br>Config descriptor too short (expected 257, got 15)<br>usb_os_find_devices: Found 003 on 001<br>Config descriptor too short (expected 257, got 24)<br> NOTICE: hid_init(): successfully initialised HID library.
<br> TRACE: hid_new_HIDInterface(): creating a new HIDInterface instance...<br> TRACE: hid_force_open(): forcefully opening a device interface according to matching criteria...<br> TRACE: hid_get_usb_handle(): acquiring handle for a USB device...
<br> TRACE: hid_find_usb_device(): enumerating USB busses...<br> TRACE: hid_find_usb_device(): enumerating USB devices on bus 001...<br> TRACE: hid_find_usb_device(): inspecting USB device 001/001[0]...<br>Check that you have permissions to write to 001/001 and, if you don't, that you set up hotplug (
<a href="http://linux-hotplug.sourceforge.net/">http://linux-hotplug.sourceforge.net/</a>) correctly.<br>USB error: could not claim interface 0: Device or resource busy<br> TRACE: hid_compare_usb_device(): comparing match specifications to USB device...
<br> TRACE: hid_compare_usb_device(): inspecting vendor ID...<br> TRACE: hid_compare_usb_device(): no match on vendor ID.<br> TRACE: hid_compare_usb_device(): inspecting product ID...<br> TRACE: hid_compare_usb_device(): no match on product ID.
<br> TRACE: hid_compare_usb_device(): no custom matching function supplied.<br> NOTICE: hid_find_usb_device(): vendor 0x0000 of USB device 001/001[0] does not match 0x0c2e.<br> TRACE: hid_find_usb_device(): inspecting USB device 001/002[0]...
<br>Check that you have permissions to write to 001/002 and, if you don't, that you set up hotplug (<a href="http://linux-hotplug.sourceforge.net/">http://linux-hotplug.sourceforge.net/</a>) correctly.<br>USB error: could not claim interface 0: Device or resource busy
<br> TRACE: hid_compare_usb_device(): comparing match specifications to USB device...<br> TRACE: hid_compare_usb_device(): inspecting vendor ID...<br> TRACE: hid_compare_usb_device(): no match on vendor ID.<br> TRACE: hid_compare_usb_device(): inspecting product ID...
<br> TRACE: hid_compare_usb_device(): match on product ID: 0x0234.<br> TRACE: hid_compare_usb_device(): no custom matching function supplied.<br> NOTICE: hid_find_usb_device(): vendor 0x050d of USB device 001/002[0] does not match 0x0c2e.
<br> TRACE: hid_find_usb_device(): inspecting USB device 001/003[0]...<br>Check that you have permissions to write to 001/003 and, if you don't, that you set up hotplug (<a href="http://linux-hotplug.sourceforge.net/">
http://linux-hotplug.sourceforge.net/</a>) correctly.<br>USB error: could not claim interface 0: Device or resource busy<br> TRACE: hid_compare_usb_device(): comparing match specifications to USB device...<br> TRACE: hid_compare_usb_device(): inspecting vendor ID...
<br> TRACE: hid_compare_usb_device(): match on vendor ID: 0x0c2e.<br> TRACE: hid_compare_usb_device(): inspecting product ID...<br> TRACE: hid_compare_usb_device(): match on product ID: 0x0200.<br> TRACE: hid_compare_usb_device(): no custom matching function supplied.
<br> NOTICE: hid_find_usb_device(): found a matching USB device 001/003[0].<br> TRACE: hid_force_open(): claiming USB device 001/003[0].<br>Check that you have permissions to write to 001/003 and, if you don't, that you set up hotplug (
<a href="http://linux-hotplug.sourceforge.net/">http://linux-hotplug.sourceforge.net/</a>) correctly.<br>USB error: could not claim interface 0: Device or resource busy<br> TRACE: hid_os_force_claim(): failed to claim USB device 001/003[0], trying 2 more time(s)...
<br> TRACE: hid_os_force_claim(): detaching kernel driver from USB device 001/003[0]...<br> TRACE: hid_os_force_claim(): trying again to claim USB device 001/003[0]...<br> NOTICE: hid_force_open(): successfully claimed USB device 001/003[0].
<br> TRACE: hid_init_parser(): initialising the HID parser for USB Device 001/003[0]...<br> TRACE: hid_init_parser(): allocating space for HIDData structure...<br> TRACE: hid_init_parser(): successfully allocated memory for HIDData strcture.
<br> TRACE: hid_init_parser(): allocating space for HIDParser structure...<br> TRACE: hid_init_parser(): successfully allocated memory for HIDParser strcture.<br> NOTICE: hid_init_parser(): successfully initialised the HID parser for USB Device 001/003[0].
<br> TRACE: hid_prepare_hid_descriptor(): initialising the HID descriptor for USB device 001/003[0]...<br> TRACE: hid_prepare_hid_descriptor(): retrieving HID descriptor for USB device 001/003[0]...<br> NOTICE: hid_prepare_hid_descriptor(): successfully initialised HID descriptor for USB device 001/003[0] (63 bytes).
<br> TRACE: hid_prepare_report_descriptor(): initialising the report descriptor for USB device 001/003[0]...<br> TRACE: hid_prepare_report_descriptor(): retrieving report descriptor for USB device 001/003[0]...<br> NOTICE: hid_prepare_report_descriptor(): successfully initialised report descriptor for USB device 001/003[0].
<br> TRACE: hid_prepare_parser(): setting up the HID parser for USB device 001/003[0]...<br> TRACE: hid_reset_parser(): resetting the HID parser for USB device 001/003[0]...<br> TRACE: hid_prepare_parser(): dumping the raw report descriptor
<br> TRACE: hid_prepare_parser(): 0x000: 0x05 0x01 0x09 0x06 0xa1 0x01 0x05 0x07 <br> TRACE: hid_prepare_parser(): 0x008: 0x19 0xe0 0x29 0xe7 0x15 0x00 0x25 0x01 <br> TRACE: hid_prepare_parser(): 0x010: 0x75 0x01 0x95 0x08 0x81 0x02 0x95 0x01
<br> TRACE: hid_prepare_parser(): 0x018: 0x75 0x08 0x81 0x01 0x95 0x05 0x75 0x01 <br> TRACE: hid_prepare_parser(): 0x020: 0x05 0x08 0x19 0x01 0x29 0x05 0x91 0x02 <br> TRACE: hid_prepare_parser(): 0x028: 0x95 0x01 0x75 0x03 0x91 0x01 0x95 0x06
<br> TRACE: hid_prepare_parser(): 0x030: 0x75 0x08 0x15 0x00 0x25 0x65 0x05 0x07 <br> TRACE: hid_prepare_parser(): 0x038: 0x19 0x00 0x29 0x65 0x81 0x00 0xc0 <br> TRACE: hid_prepare_parser(): parsing the HID tree of USB device 001/003[0]...
<br> NOTICE: hid_prepare_parser(): successfully set up the HID parser for USB device 001/003[0].<br> NOTICE: hid_force_open(): successfully opened USB device 001/003[0].<br>device identification of HIDInterface 001/003[0]:
<br> dev_handle: 0x00028f98<br> device: 0x0002c450<br> location: 001/003<br> manufacturer: Metrologic<br> product: Metrologic Scanner<br> TRACE: hid_reset_parser(): resetting the HID parser for USB device 001/003[0]...
<br> TRACE: hid_dump_tree(): iterating the parse tree for USB device 001/003[0]...<br>parse tree of HIDInterface 001/003[0]:<br> path: 0x00010006.0x00000000; type: 0x80<br> path: 0x00010006.0x00000000; type: 0x80<br> path:
0x00010006.0x00000000; type: 0x80<br> path: 0x00010006.0x00000000; type: 0x80<br> path: 0x00010006.0x00000000; type: 0x80<br> path: 0x00010006.0x00000000; type: 0x80<br> path: 0x00010006.0x00000000; type: 0x80<br> path:
0x00010006.0x00000000; type: 0x80<br> path: 0x00010006.0x00000000; type: 0x80<br> path: 0x00010006.0x00000000; type: 0x90<br> path: 0x00010006.0x00000000; type: 0x90<br> path: 0x00010006.0x00000000; type: 0x90<br> path:
0x00010006.0x00000000; type: 0x90<br> path: 0x00010006.0x00000000; type: 0x90<br> path: 0x00010006.0x00000000; type: 0x90<br> path: 0x00010006.0x00000000; type: 0x80<br> path: 0x00010006.0x00000000; type: 0x80<br> path:
0x00010006.0x00000000; type: 0x80<br> path: 0x00010006.0x00000000; type: 0x80<br> path: 0x00010006.0x00000000; type: 0x80<br> path: 0x00010006.0x00000000; type: 0x80<br> TRACE: hid_reset_parser(): resetting the HID parser for USB device 001/003[0]...
<br>Begin Run() ...<br>USB_ENDPOINT_IN = 128<br> TRACE: hid_interrupt_read(): retrieving interrupt report from device 001/003[0] ...<br>WARNING: hid_interrupt_read(): failed to get interrupt read from device 001/003[0]: could not claim interface 0: Device or resource busy
<br>End Run() ...<br><br><br><br><div><span class="gmail_quote">2006/12/21, Charles Lepple <<a href="mailto:clepple@ghz.cc">clepple@ghz.cc</a>>:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On Dec 20, 2006, at 11:58 AM, Storm Scratcher wrote:<br><br>> Hi !<br>><br>> I use libusb 0.1.12 and libhid from svn (0.2.14 i think) on arm7<br>> platform running kernel 2.4.24<br>> I wrote a program which read data from a metrologic barcode scanner
<br>> I use hid_interrupt_read() function to get data from scanner :<br>><br>> m_iHIDErrorCode = hid_interrupt_read( m_pHidHandle, USB_ENDPOINT_IN<br>> +1,<br>> un_pcData, un_uiDataLength, un_uiTimeout );
<br>><br>> With a timeout of 1000, it hangs during an IOCTL_USB_REAPURB in<br>> one of<br>> the libusb functions : usb_urb_transfer() ( called by<br>> usb_interrupt_read() called by hid_interrupt_read() :) )
<br><br>This sounds like a bad interaction between your version of libusb and<br>the kernel.<br><br>Which host controller interface are you using - OHCI or UCHI?<br><br>Older versions of libusb (0.1.10, or maybe earlier) did not use the
<br>URB ioctl()s, but used the proc interface to send and receive<br>packets. If you have time, that's what I would look at first.<br><br>> With a timeout of 0, i can read data from scanner without problems<br>> but
<br>> when i close connection, i was unable to read data from device (my<br>> program is blocked on hid_interrupt_read() function). I need to<br>> reboot<br>> the cpu<br>><br>> I test my program into my computer (i386) on Redhat Fedora Core 5
<br>> (kernel 2.6.15) and<br>> i don't notice any problems to read data from scanner with my program<br>> (and the same librairies compiled for i386).<br>><br>> Can you explain function hid_set_idle(), i do this after open
<br>> connection with hid_force_open function :<br><br>This is a thin wrapper around the HID Set_Idle request. See the HID<br>spec (page 62 of version 1.11) for more details:<br><br><a href="http://www.usb.org/developers/devclass_docs/HID1_11.pdf">
http://www.usb.org/developers/devclass_docs/HID1_11.pdf</a><br><br>You probably want to set the idle time to something non-zero. The<br>actual value will depend on the application.<br><br><br>--<br>Charles Lepple<br><a href="mailto:clepple@ghz.cc">
clepple@ghz.cc</a><br><br><br></blockquote></div><br>