Hi
Trying out this mailing list to get some help on a problem I am struggling with
since yesterday.
I have a custom USB device that is using bulk transfer on 2 endpoints, EP1 is
in, EP2 is out.
I have a program written in Qt, and included the libusb code into my project.
Here is what I do (actually, copied this almost completely from the example
code):
libusb_init(&ctx);
libusb_set_debug(ctx,3);
ssize_t cnt = libusb_get_device_list(ctx, &list);
... // here I iterate through the list and get the handle on my device
if ( libusb_kernel_driver_active(handle,0) ){
libusb_detach_kernel_driver(handle,0);
attached = 1;
}else console->appendPlainText("Device free from kernel\n");
err = libusb_claim_interface( handle, 0 );
int nEndpoint = 0x01;
int nTimeout = 500; //in milliseconds
int BytesWritten = 0;
unsigned char OutputPacketBuffer[64];
OutputPacketBuffer[0] = SET_LEDS;
OutputPacketBuffer[1] = 0x02;
libusb_interrupt_transfer( handle, nEndpoint, OutputPacketBuffer,
2, &BytesWritten, nTimeout );
message.sprintf( "wrote %d bytes to endpoint address 0x%X\n",
BytesWritten, nEndpoint );
console->appendPlainText(message);
if( attached == 1 ){
libusb_attach_kernel_driver( handle, 0 );
}
libusb_close( handle );
When I run this in Windows, this is fine. When running it in Linux this is not
fine.
In Windows I use the winusb driver. In linux, I guess libusbx does everything.
The error that I get in Linux is this:
libusb: 0.022922 error [submit_bulk_transfer] submiturb failed error -1 errno=22
Any ideas?
For completeness, I have pasted the application log below.
Best regards
Wim
Here is the application output:
libusb: 0.002960 debug [find_usbfs_path] found usbfs at /dev/bus/usb
libusb: 0.003000 debug [op_init] bulk continuation flag supported
libusb: 0.003019 debug [op_init] zero length packet flag supported
libusb: 0.003099 debug [op_init] found usb devices in sysfs
libusb: 0.003295 debug [usbi_add_pollfd] add fd 11 events 1
libusb: 0.003322 debug [usbi_io_init] using timerfd for timeouts
libusb: 0.003328 debug [usbi_add_pollfd] add fd 13 events 1
libusb: 0.003344 debug [libusb_get_device_list]
libusb: 0.003427 debug [sysfs_scan_device] scan usb1
libusb: 0.003642 debug [sysfs_scan_device] bus=1 dev=1
libusb: 0.003653 debug [enumerate_device] busnum 1 devaddr 1 session_id 257
libusb: 0.003659 debug [enumerate_device] allocating new device for 1/1
(session 257)
libusb: 0.003768 debug [sysfs_scan_device] scan usb2
libusb: 0.003868 debug [sysfs_scan_device] bus=2 dev=1
libusb: 0.003877 debug [enumerate_device] busnum 2 devaddr 1 session_id 513
libusb: 0.003882 debug [enumerate_device] allocating new device for 2/1
(session 513)
libusb: 0.003952 debug [sysfs_scan_device] scan 2-1
libusb: 0.004045 debug [sysfs_scan_device] bus=2 dev=2
libusb: 0.004054 debug [enumerate_device] busnum 2 devaddr 2 session_id 514
libusb: 0.004059 debug [enumerate_device] allocating new device for 2/2
(session 514)
libusb: 0.004128 debug [sysfs_scan_device] scan 2-2
libusb: 0.004220 debug [sysfs_scan_device] bus=2 dev=3
libusb: 0.004228 debug [enumerate_device] busnum 2 devaddr 3 session_id 515
libusb: 0.004233 debug [enumerate_device] allocating new device for 2/3
(session 515)
libusb: 0.004302 debug [sysfs_scan_device] scan 2-2.1
libusb: 0.004398 debug [sysfs_scan_device] bus=2 dev=9
libusb: 0.004407 debug [enumerate_device] busnum 2 devaddr 9 session_id 521
libusb: 0.004412 debug [enumerate_device] allocating new device for 2/9
(session 521)
libusb: 0.004484 debug [sysfs_scan_device] scan 2-2.2
libusb: 0.004671 debug [sysfs_scan_device] bus=2 dev=10
libusb: 0.004681 debug [enumerate_device] busnum 2 devaddr 10 session_id 522
libusb: 0.004687 debug [enumerate_device] allocating new device for 2/10
(session 522)
libusb: 0.005503 debug [libusb_get_device_descriptor]
libusb: 0.011133 debug [libusb_get_device_descriptor]
libusb: 0.011199 debug [libusb_get_device_descriptor]
libusb: 0.018024 debug [libusb_get_device_descriptor]
libusb: 0.018187 debug [libusb_get_device_descriptor]
libusb: 0.019062 debug [libusb_get_device_descriptor]
libusb: 0.019128 debug [libusb_get_device_descriptor]
libusb: 0.019639 debug [libusb_get_device_descriptor]
libusb: 0.019690 debug [libusb_get_device_descriptor]
libusb: 0.020209 debug [libusb_get_device_descriptor]
libusb: 0.020257 debug [libusb_get_device_descriptor]
libusb: 0.020800 debug [libusb_get_device_descriptor]
libusb: 0.021346 debug [libusb_open] open 2.10
libusb: 0.021365 debug [op_open] opening /dev/bus/usb/002/010
libusb: 0.021396 debug [usbi_add_pollfd] add fd 14 events 4
libusb: 0.022033 debug [libusb_kernel_driver_active] interface 0
libusb: 0.022457 debug [libusb_claim_interface] interface 0
libusb: 0.022905 debug [submit_bulk_transfer] need 1 urbs for new transfer with
length 2
libusb: 0.022922 error [submit_bulk_transfer] submiturb failed error -1 errno=22
libusb: 0.022927 debug [submit_bulk_transfer] first URB failed, easy peasy
libusb: 0.023876 debug [libusb_close]
libusb: 0.023896 debug [usbi_remove_pollfd] remove fd 14
libusb: 0.023937 debug [libusb_unref_device] destroy device 1.1
libusb: 0.023944 debug [libusb_unref_device] destroy device 2.1
libusb: 0.023948 debug [libusb_unref_device] destroy device 2.2
libusb: 0.023952 debug [libusb_unref_device] destroy device 2.3
libusb: 0.023956 debug [libusb_unref_device] destroy device 2.9
libusb: 0.023960 debug [libusb_unref_device] destroy device 2.10
libusb: 0.023964 debug [libusb_exit]
libusb: 0.023967 debug [usbi_remove_pollfd] remove fd 11
libusb: 0.023981 debug [usbi_remove_pollfd] remove fd 13
------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
libusbx-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libusbx-devel