Discussion:
[pyusb-users] "Other error' reply to set_configuration
John Coppens
2016-02-22 00:57:03 UTC
Permalink
Hi all.

I wrote a simple program to communicate with a USB peripheral which is supposed
to send A/D samples to the host by bulk transfer.

I have the impression that the enumeration is normal (see lsusb -v output below).
When the program:

def main(args):
dev = usb.core.find(idVendor = VID, idProduct = PID)
if dev is None:
raise ValueError('Device not found')

dump_interfaces(dev)

dev.set_configuration()

return 0

is run, I get:

1
0,0
129
1
Traceback (most recent call last):
File "test_pyusb.py", line 58, in <module>
sys.exit(main(sys.argv))
File "test_pyusb.py", line 52, in main
dev.set_configuration()
File "/usr/lib64/python2.7/site-packages/usb/core.py", line 819, in set_configuration
self._ctx.managed_set_configuration(self, configuration)
File "/usr/lib64/python2.7/site-packages/usb/core.py", line 129, in managed_set_configuration
self.backend.set_configuration(self.handle, cfg.bConfigurationValue)
File "/usr/lib64/python2.7/site-packages/usb/backend/libusb1.py", line 786, in set_configuration
_check(self.lib.libusb_set_configuration(dev_handle.handle, config_value))
File "/usr/lib64/python2.7/site-packages/usb/backend/libusb1.py", line 592, in _check
raise USBError(_strerror(ret), ret, _libusb_errno[ret])
usb.core.USBError: [Errno None] Other error

Note that the output says "Other error", not Unknown error - of which I found
several references.

When tested with a minimalistic C program, also with libusb 1.0.20, the transfer
actually starts, but stops after a couple of 512 data blocks.

Questions:
- In C, I have code that detaches the kernel driver if necessary. Is this necessary
here? I didn't find any reference in the tutorial.

- Any other tests I can do?




The system is Linux, kernel 4.1.6, Slackware 14.1, and libusb 1.0.20.

This is the lsusb -v output for the device:

Bus 001 Device 014: ID 1cbe:0003 Luminary Micro Inc.
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 1.10
bDeviceClass 255 Vendor Specific Class
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
idVendor 0x1cbe Luminary Micro Inc.
idProduct 0x0003
bcdDevice 1.00
iManufacturer 1
iProduct 2
iSerial 3
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 32
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 5
bmAttributes 0xc0
Self Powered
MaxPower 500mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 255 Vendor Specific Class
bInterfaceSubClass 0
bInterfaceProtocol 0
iInterface 4
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x01 EP 1 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
Device Status: 0x0003
Self Powered
Remote Wakeup Enabled
Xiaofan Chen
2016-02-22 01:20:12 UTC
Permalink
Post by John Coppens
When tested with a minimalistic C program, also with libusb 1.0.20, the transfer
actually starts, but stops after a couple of 512 data blocks.
- In C, I have code that detaches the kernel driver if necessary. Is this necessary
here? I didn't find any reference in the tutorial.
Yes, if there is a kernel driver (except usbfs) bind to the device.
Post by John Coppens
- Any other tests I can do?
The system is Linux, kernel 4.1.6, Slackware 14.1, and
libusb 1.0.20.
You can set LIBUSB_DEBUG=4 before running your pyusb program
and then post the verbose libusb debug info.
--
Xiaofan
John Coppens
2016-02-22 17:29:29 UTC
Permalink
On Mon, 22 Feb 2016 09:20:12 +0800
Post by Xiaofan Chen
Post by John Coppens
- In C, I have code that detaches the kernel driver if necessary. Is this necessary
here? I didn't find any reference in the tutorial.
Yes, if there is a kernel driver (except usbfs) bind to the device.
Thanks for the reply, Xiaofan.

I added:

if dev.is_kernel_driver_active(1):
dev.detach_kernel_driver(1)
print("Kernel detached")

but it didn't make much difference (see below)
Post by Xiaofan Chen
You can set LIBUSB_DEBUG=4 before running your pyusb program
and then post the verbose libusb debug info.
Here's the full debug output. Note that there is a 5 second wait before the set_configuration
times out (is this the default value?).

[timestamp] [threadID] facility level [function call] <message>
--------------------------------------------------------------------------------
[ 0.000001] [000003da] libusb: debug [libusb_init] created default context
[ 0.000041] [000003da] libusb: debug [libusb_init] libusb v1.0.20.11004
[ 0.000062] [000003da] libusb: debug [find_usbfs_path] found usbfs at /dev/bus/usb
[ 0.000079] [000003da] libusb: debug [op_init] bulk continuation flag supported
[ 0.000088] [000003da] libusb: debug [op_init] zero length packet flag supported
[ 0.000103] [000003da] libusb: debug [op_init] sysfs can relate devices
[ 0.000112] [000003da] libusb: debug [op_init] sysfs has complete descriptors
[ 0.000354] [0000041b] libusb: debug [linux_udev_event_thread_main] udev event thread entering.
[ 0.000782] [000003da] libusb: debug [linux_get_device_address] getting address for device: usb3 detached: 0
[ 0.000803] [000003da] libusb: debug [linux_get_device_address] scan usb3
[ 0.000856] [000003da] libusb: debug [linux_get_device_address] bus=3 dev=1
[ 0.000869] [000003da] libusb: debug [linux_enumerate_device] busnum 3 devaddr 1 session_id 769
[ 0.000880] [000003da] libusb: debug [linux_enumerate_device] allocating new device for 3/1 (session 769)
[ 0.000988] [000003da] libusb: debug [linux_get_device_address] getting address for device: 3-1 detached: 0
[ 0.001002] [000003da] libusb: debug [linux_get_device_address] scan 3-1
[ 0.001052] [000003da] libusb: debug [linux_get_device_address] bus=3 dev=2
[ 0.001064] [000003da] libusb: debug [linux_enumerate_device] busnum 3 devaddr 2 session_id 770
[ 0.001074] [000003da] libusb: debug [linux_enumerate_device] allocating new device for 3/2 (session 770)
[ 0.001119] [000003da] libusb: debug [linux_get_parent_info] Dev 0x1d29300 (3-1) has parent 0x1d29240 (usb3) port 1
[ 0.001200] [000003da] libusb: debug [linux_get_device_address] getting address for device: usb4 detached: 0
[ 0.001212] [000003da] libusb: debug [linux_get_device_address] scan usb4
[ 0.001261] [000003da] libusb: debug [linux_get_device_address] bus=4 dev=1
[ 0.001274] [000003da] libusb: debug [linux_enumerate_device] busnum 4 devaddr 1 session_id 1025
[ 0.001284] [000003da] libusb: debug [linux_enumerate_device] allocating new device for 4/1 (session 1025)
[ 0.001400] [000003da] libusb: debug [linux_get_device_address] getting address for device: usb1 detached: 0
[ 0.001413] [000003da] libusb: debug [linux_get_device_address] scan usb1
[ 0.001465] [000003da] libusb: debug [linux_get_device_address] bus=1 dev=1
[ 0.001487] [000003da] libusb: debug [linux_enumerate_device] busnum 1 devaddr 1 session_id 257
[ 0.001496] [000003da] libusb: debug [linux_enumerate_device] allocating new device for 1/1 (session 257)
[ 0.001582] [000003da] libusb: debug [linux_get_device_address] getting address for device: 1-2 detached: 0
[ 0.001593] [000003da] libusb: debug [linux_get_device_address] scan 1-2
[ 0.001636] [000003da] libusb: debug [linux_get_device_address] bus=1 dev=3
[ 0.001644] [000003da] libusb: debug [linux_enumerate_device] busnum 1 devaddr 3 session_id 259
[ 0.001652] [000003da] libusb: debug [linux_enumerate_device] allocating new device for 1/3 (session 259)
[ 0.001691] [000003da] libusb: debug [linux_get_parent_info] Dev 0x1d29f10 (1-2) has parent 0x1d29e50 (usb1) port 2
[ 0.001760] [000003da] libusb: debug [linux_get_device_address] getting address for device: 1-3 detached: 0
[ 0.001769] [000003da] libusb: debug [linux_get_device_address] scan 1-3
[ 0.001812] [000003da] libusb: debug [linux_get_device_address] bus=1 dev=4
[ 0.001820] [000003da] libusb: debug [linux_enumerate_device] busnum 1 devaddr 4 session_id 260
[ 0.001828] [000003da] libusb: debug [linux_enumerate_device] allocating new device for 1/4 (session 260)
[ 0.001866] [000003da] libusb: debug [linux_get_parent_info] Dev 0x1d2b060 (1-3) has parent 0x1d29e50 (usb1) port 3
[ 0.001910] [000003da] libusb: debug [linux_get_device_address] getting address for device: 1-3.1 detached: 0
[ 0.001920] [000003da] libusb: debug [linux_get_device_address] scan 1-3.1
[ 0.001962] [000003da] libusb: debug [linux_get_device_address] bus=1 dev=6
[ 0.001970] [000003da] libusb: debug [linux_enumerate_device] busnum 1 devaddr 6 session_id 262
[ 0.001978] [000003da] libusb: debug [linux_enumerate_device] allocating new device for 1/6 (session 262)
[ 0.002016] [000003da] libusb: debug [linux_get_parent_info] Dev 0x1d2b510 (1-3.1) has parent 0x1d2b060 (1-3) port 1
[ 0.002070] [000003da] libusb: debug [linux_get_device_address] getting address for device: 1-3.1.4 detached: 0
[ 0.002079] [000003da] libusb: debug [linux_get_device_address] scan 1-3.1.4
[ 0.002126] [000003da] libusb: debug [linux_get_device_address] bus=1 dev=10
[ 0.002134] [000003da] libusb: debug [linux_enumerate_device] busnum 1 devaddr 10 session_id 266
[ 0.002142] [000003da] libusb: debug [linux_enumerate_device] allocating new device for 1/10 (session 266)
[ 0.002180] [000003da] libusb: debug [linux_get_parent_info] Dev 0x1d2b9c0 (1-3.1.4) has parent 0x1d2b510 (1-3.1) port 4
[ 0.002290] [000003da] libusb: debug [linux_get_device_address] getting address for device: 1-3.4 detached: 0
[ 0.002301] [000003da] libusb: debug [linux_get_device_address] scan 1-3.4
[ 0.002344] [000003da] libusb: debug [linux_get_device_address] bus=1 dev=7
[ 0.002353] [000003da] libusb: debug [linux_enumerate_device] busnum 1 devaddr 7 session_id 263
[ 0.002361] [000003da] libusb: debug [linux_enumerate_device] allocating new device for 1/7 (session 263)
[ 0.002414] [000003da] libusb: debug [linux_get_parent_info] Dev 0x1d2be90 (1-3.4) has parent 0x1d2b060 (1-3) port 4
[ 0.002645] [000003da] libusb: debug [linux_get_device_address] getting address for device: usb5 detached: 0
[ 0.002657] [000003da] libusb: debug [linux_get_device_address] scan usb5
[ 0.002705] [000003da] libusb: debug [linux_get_device_address] bus=5 dev=1
[ 0.002716] [000003da] libusb: debug [linux_enumerate_device] busnum 5 devaddr 1 session_id 1281
[ 0.002726] [000003da] libusb: debug [linux_enumerate_device] allocating new device for 5/1 (session 1281)
[ 0.002841] [000003da] libusb: debug [linux_get_device_address] getting address for device: usb6 detached: 0
[ 0.002853] [000003da] libusb: debug [linux_get_device_address] scan usb6
[ 0.002911] [000003da] libusb: debug [linux_get_device_address] bus=6 dev=1
[ 0.002923] [000003da] libusb: debug [linux_enumerate_device] busnum 6 devaddr 1 session_id 1537
[ 0.002933] [000003da] libusb: debug [linux_enumerate_device] allocating new device for 6/1 (session 1537)
[ 0.003055] [000003da] libusb: debug [linux_get_device_address] getting address for device: usb2 detached: 0
[ 0.003068] [000003da] libusb: debug [linux_get_device_address] scan usb2
[ 0.003116] [000003da] libusb: debug [linux_get_device_address] bus=2 dev=1
[ 0.003129] [000003da] libusb: debug [linux_enumerate_device] busnum 2 devaddr 1 session_id 513
[ 0.003139] [000003da] libusb: debug [linux_enumerate_device] allocating new device for 2/1 (session 513)
[ 0.003241] [000003da] libusb: debug [linux_get_device_address] getting address for device: 2-2 detached: 0
[ 0.003251] [000003da] libusb: debug [linux_get_device_address] scan 2-2
[ 0.003292] [000003da] libusb: debug [linux_get_device_address] bus=2 dev=2
[ 0.003300] [000003da] libusb: debug [linux_enumerate_device] busnum 2 devaddr 2 session_id 514
[ 0.003308] [000003da] libusb: debug [linux_enumerate_device] allocating new device for 2/2 (session 514)
[ 0.003344] [000003da] libusb: debug [linux_get_parent_info] Dev 0x1d2d1b0 (2-2) has parent 0x1d2cce0 (usb2) port 2
[ 0.003428] [000003da] libusb: debug [linux_get_device_address] getting address for device: usb7 detached: 0
[ 0.003441] [000003da] libusb: debug [linux_get_device_address] scan usb7
[ 0.003482] [000003da] libusb: debug [linux_get_device_address] bus=7 dev=1
[ 0.003490] [000003da] libusb: debug [linux_enumerate_device] busnum 7 devaddr 1 session_id 1793
[ 0.003498] [000003da] libusb: debug [linux_enumerate_device] allocating new device for 7/1 (session 1793)
[ 0.003573] [000003da] libusb: debug [usbi_add_pollfd] add fd 6 events 1
[ 0.003585] [000003da] libusb: debug [usbi_io_init] using timerfd for timeouts
[ 0.003593] [000003da] libusb: debug [usbi_add_pollfd] add fd 9 events 1
[ 0.003670] [000003da] libusb: debug [libusb_get_device_list]
[ 0.003684] [000003da] libusb: debug [discovered_devs_append] need to increase capacity
[ 0.003745] [000003da] libusb: debug [libusb_get_device_descriptor]
[ 0.003888] [000003da] libusb: debug [libusb_get_device_descriptor]
[ 0.003993] [000003da] libusb: debug [libusb_get_device_descriptor]
[ 0.004058] [000003da] libusb: debug [libusb_get_device_descriptor]
[ 0.004123] [000003da] libusb: debug [libusb_get_device_descriptor]
[ 0.004187] [000003da] libusb: debug [libusb_get_device_descriptor]
[ 0.004252] [000003da] libusb: debug [libusb_get_device_descriptor]
[ 0.004330] [000003da] libusb: debug [libusb_get_config_descriptor] index 0
1
[ 0.004435] [000003da] libusb: debug [libusb_get_config_descriptor] index 0
0,0
[ 0.004545] [000003da] libusb: debug [libusb_get_config_descriptor] index 0
129
[ 0.004637] [000003da] libusb: debug [libusb_get_config_descriptor] index 0
1
[ 0.004726] [000003da] libusb: debug [libusb_get_config_descriptor] index 0
[ 0.004783] [000003da] libusb: debug [libusb_open] open 1.10
[ 0.004810] [000003da] libusb: debug [usbi_add_pollfd] add fd 10 events 4
[ 0.004829] [000003da] libusb: debug [libusb_kernel_driver_active] interface 1
[ 0.004853] [000003da] libusb: debug [libusb_get_config_descriptor] index 0
[ 0.004911] [000003da] libusb: debug [libusb_set_configuration] configuration 1
[ 5.004752] [000003da] libusb: error [op_set_configuration] failed, error -1 errno 110
Traceback (most recent call last):
File "./test_pyusb.py", line 82, in <module>
sys.exit(main(sys.argv))
File "./test_pyusb.py", line 73, in main
dev.set_configuration()
File "/usr/lib64/python2.7/site-packages/usb/core.py", line 819, in set_configuration
self._ctx.managed_set_configuration(self, configuration)
File "/usr/lib64/python2.7/site-packages/usb/core.py", line 129, in managed_set_configuration
self.backend.set_configuration(self.handle, cfg.bConfigurationValue)
File "/usr/lib64/python2.7/site-packages/usb/backend/libusb1.py", line 786, in set_configuration
_check(self.lib.libusb_set_configuration(dev_handle.handle, config_value))
File "/usr/lib64/python2.7/site-packages/usb/backend/libusb1.py", line 592, in _check
raise USBError(_strerror(ret), ret, _libusb_errno[ret])
usb.core.USBError: [Errno None] Other error
[ 5.007842] [000003da] libusb: debug [libusb_close]
[ 5.007861] [000003da] libusb: debug [usbi_remove_pollfd] remove fd 10
[ 5.007894] [000003da] libusb: debug [libusb_exit]
[ 5.007904] [000003da] libusb: debug [libusb_exit] destroying default context
[ 5.007915] [000003da] libusb: debug [libusb_handle_events_timeout_completed] doing our own event handling
[ 5.007925] [000003da] libusb: debug [handle_events] poll fds modified, reallocating
[ 5.007937] [000003da] libusb: debug [handle_events] poll() 2 fds with timeout in 0ms
[ 5.007947] [000003da] libusb: debug [handle_events] poll() returned 0
[ 5.007957] [000003da] libusb: debug [libusb_unref_device] destroy device 7.1
[ 5.007967] [000003da] libusb: debug [libusb_unref_device] destroy device 2.2
[ 5.007975] [000003da] libusb: debug [libusb_unref_device] destroy device 2.1
[ 5.007984] [000003da] libusb: debug [libusb_unref_device] destroy device 6.1
[ 5.007992] [000003da] libusb: debug [libusb_unref_device] destroy device 5.1
[ 5.008002] [000003da] libusb: debug [libusb_unref_device] destroy device 1.7
[ 5.008011] [000003da] libusb: debug [libusb_unref_device] destroy device 1.10
[ 5.008019] [000003da] libusb: debug [libusb_unref_device] destroy device 1.6
[ 5.008028] [000003da] libusb: debug [libusb_unref_device] destroy device 1.4
[ 5.008037] [000003da] libusb: debug [libusb_unref_device] destroy device 1.3
[ 5.008047] [000003da] libusb: debug [libusb_unref_device] destroy device 1.1
[ 5.008056] [000003da] libusb: debug [libusb_unref_device] destroy device 4.1
[ 5.008065] [000003da] libusb: debug [libusb_unref_device] destroy device 3.2
[ 5.008074] [000003da] libusb: debug [libusb_unref_device] destroy device 3.1
[ 5.008083] [000003da] libusb: debug [usbi_remove_pollfd] remove fd 6
[ 5.008098] [000003da] libusb: debug [usbi_remove_pollfd] remove fd 9
[ 5.008129] [0000041b] libusb: debug [linux_udev_event_thread_main] udev event thread exiting
Xiaofan Chen
2016-02-23 01:35:48 UTC
Permalink
Post by John Coppens
Post by Xiaofan Chen
You can set LIBUSB_DEBUG=4 before running your pyusb program
and then post the verbose libusb debug info.
Here's the full debug output. Note that there is a 5 second wait before the set_configuration
times out (is this the default value?).
[ 0.004829] [000003da] libusb: debug [libusb_kernel_driver_active] interface 1
[ 0.004853] [000003da] libusb: debug [libusb_get_config_descriptor] index 0
[ 0.004911] [000003da] libusb: debug [libusb_set_configuration] configuration 1
[ 5.004752] [000003da] libusb: error [op_set_configuration] failed, error -1 errno 110
Errono is ETIMEDOUT. This is a bit strange. It might be that your
FW is faulty.
Post by John Coppens
When tested with a minimalistic C program, also with libusb 1.0.20,
the transfer actually starts, but stops after a couple of 512
data blocks.
What is your minimalist C program? Does it call libusb_set_configuration()?
If not, please add it to see if that cause problem or not.

In reality libusb_set_configuration() is in generally not needed in libusb
(other than those special device with two or more configurations), the
only exception is for libusb-win32 (may need to call usb_set_configuration)
which pyusb supports.
--
Xiaofan
John Coppens
2016-02-24 16:32:50 UTC
Permalink
On Tue, 23 Feb 2016 09:35:48 +0800
Post by Xiaofan Chen
Post by John Coppens
Post by Xiaofan Chen
You can set LIBUSB_DEBUG=4 before running your pyusb program
and then post the verbose libusb debug info.
Here's the full debug output. Note that there is a 5 second wait before the set_configuration
times out (is this the default value?).
[ 0.004829] [000003da] libusb: debug [libusb_kernel_driver_active] interface 1
[ 0.004853] [000003da] libusb: debug [libusb_get_config_descriptor] index 0
[ 0.004911] [000003da] libusb: debug [libusb_set_configuration] configuration 1
[ 5.004752] [000003da] libusb: error [op_set_configuration] failed, error -1 errno 110
Errono is ETIMEDOUT. This is a bit strange. It might be that your
FW is faulty.
Post by John Coppens
When tested with a minimalistic C program, also with libusb 1.0.20,
the transfer actually starts, but stops after a couple of 512
data blocks.
What is your minimalist C program? Does it call libusb_set_configuration()?
If not, please add it to see if that cause problem or not.
In reality libusb_set_configuration() is in generally not needed in libusb
(other than those special device with two or more configurations), the
only exception is for libusb-win32 (may need to call usb_set_configuration)
which pyusb supports.
Xiafan, after much tinkering with the C program, I was too impatient to get
things working, so I restarted from zero (again from the original usb_dev_bulk
demo, and a host program with pyUSB in the PC. I appreciate your input though,
and it was very helpful in avoiding the same problem this time.

I was able to get these results (all at 'Full' speed):

1 external hub No external hub
Transfer size Throughput (B/s) Throughput (B/s)
512 433120 128000
768 519300 145699
1024 433120 204811
2048 619329 341322
4096 658343 455133
8192 668429 585411

Both seem to flatten out too early. Though the speed at 8192 is enough for
me, any idea why the speed does not go nearer 1.2MB/s? And why the speed
at small transfer sizes is so different without hub?

I attached a graph of the above - I don't know if the list allows
attachments.

Cheers,
John
Xiaofan Chen
2016-02-25 05:31:26 UTC
Permalink
Post by John Coppens
Xiafan, after much tinkering with the C program, I was too impatient to get
things working, so I restarted from zero (again from the original usb_dev_bulk
demo, and a host program with pyUSB in the PC. I appreciate your input though,
and it was very helpful in avoiding the same problem this time.
1 external hub No external hub
Transfer size Throughput (B/s) Throughput (B/s)
512 433120 128000
768 519300 145699
1024 433120 204811
2048 619329 341322
4096 658343 455133
8192 668429 585411
Both seem to flatten out too early. Though the speed at 8192 is enough for
me, any idea why the speed does not go nearer 1.2MB/s? And why the speed
at small transfer sizes is so different without hub?
I am not so sure if pyusb will allow you to reach the full potential.

In order to have better speed, increase the transfer size, use async I/O
and then use an external HUB.

libusb async I/O: http://libusb.sourceforge.net/api-1.0/group__asyncio.html

I think you will have a good idea by reading the answers from Tsuneo here.
+++++++++++++++++++++++
http://www.microchip.com/forums/tm.aspx?m=417509

Example: Tsuneo's explanations on the usage of hub
The performance will be achieved under these conditions.

a) Single device on the bus
Connect the device to the PC USB port directly, as you did.

b) Over single TT (Transaction Translator) hub, without any other
Full-/Low-speed device
You can use a hub between the device and the PC. Rather, it speeds up
the bulk transfer of the device.
Hi-speed devices on the same hub doesn't disturb the Full-/Low-speed device.

c) Over multiple TT hub
In this case, you can use other Full-/Low-speed devices on the hub.
The hub assigns full Full-/Low-speed bandwidth to each device on its
ports.

Most of Hi-Speed hubs on the market (usually, called as USB2.0 hub)
are single-TT.

Multi-TT hubs
Belkin F5U234v1
http://catalog.belkin.com/IWCatProductPage.process?Product_Id=159070
IOGEAR GUH274
http://www.iogear.com/product/GUH274/

Tsuneo
++++++++++++++++++++++
--
Xiaofan
Xiaofan Chen
2016-02-25 05:40:32 UTC
Permalink
Post by Xiaofan Chen
I am not so sure if pyusb will allow you to reach the full potential.
Since this ticker is still open.
https://github.com/walac/pyusb/issues/63
Post by Xiaofan Chen
In order to have better speed, increase the transfer size, use async I/O
and then use an external HUB.
libusb async I/O: http://libusb.sourceforge.net/api-1.0/group__asyncio.html
I think you will have a good idea by reading the answers from Tsuneo here.
+++++++++++++++++++++++
http://www.microchip.com/forums/tm.aspx?m=417509
...
++++++++++++++++++++++
Another advise from another USB expert: Tim Roberts.

++++++++++++++++++
Repeating a speech I give relatively often, remember that USB traffic is
all scheduled in advance. The whole frame is laid out ahead of time,
and the schedule is sent to the hardware. So, the only requests that
will be present in a frame are those that were already pending when the
host controller driver started to create the schedule. After it is
submitted, any new requests will be scheduled into the NEXT frame.

A full-speed frame can transfer about 1200 bytes. If you expect to be
able to transfer that much data, then you must submit 1200 bytes worth
of requests before the frame begins.
++++++++++++++++++
--
Xiaofan
John Coppens
2016-02-25 21:56:25 UTC
Permalink
On Thu, 25 Feb 2016 13:31:26 +0800
Post by Xiaofan Chen
I am not so sure if pyusb will allow you to reach the full potential.
In order to have better speed, increase the transfer size, use async I/O
and then use an external HUB.
Again, very useful. Thanks!

I rewrote the C program to see if it was faster than pyUSB, but
without hub, the speed is _exactly_ the same. I have been testing up
to 8192 bytes transfer size (I am limited with the device's memory).

Tomorrow, I will add a test function to check async transfer.
(It being tomorrow already, I did test using libusb in async mode,
but there was no difference at all. If anything, it was 0.5 - 1%
slower).

I checked, the hub is a single TT version (Genesys Logic Inc). It
does wonders at smaller transfer sizes. At 512, speed goes from
128kB/s to 508kB/s - wow!

Cheers,
John
Xiaofan Chen
2016-02-27 05:41:34 UTC
Permalink
Post by John Coppens
I rewrote the C program to see if it was faster than pyUSB, but
without hub, the speed is _exactly_ the same. I have been testing up
to 8192 bytes transfer size (I am limited with the device's memory).
Tomorrow, I will add a test function to check async transfer.
(It being tomorrow already, I did test using libusb in async mode,
but there was no difference at all. If anything, it was 0.5 - 1%
slower).
I checked, the hub is a single TT version (Genesys Logic Inc). It
does wonders at smaller transfer sizes. At 512, speed goes from
128kB/s to 508kB/s - wow!
As this is in C, you may want to subscribe to libusb mailing list
and get some help there. Maybe your device side is not catching
up or maybe your host program needs some tuning.

libusb mailing list:
https://lists.sourceforge.net/lists/listinfo/libusb-devel
--
Xiaofan
John Coppens
2016-02-24 18:14:07 UTC
Permalink
On Tue, 23 Feb 2016 09:35:48 +0800
Post by Xiaofan Chen
Xiaofan
Sorry - the plot has the wrong labels in the Legend. Of course the
higher throughput was via the external hub.

John
Loading...