Discussion:
[libusb] WHAT IS THE CAUSE OF LIBUSB_TRANSFER_ERROR?
442777816
2014-06-11 09:36:32 UTC
Permalink
Hi,everybody

When I did my test this afternoon,I found my code threw a libusb error called LIBUSB_TRANSFER_ERROR,about 1/2 transfers appear this error.I use the non-blocking transfer mode ,bulk endpoint ,the transfer size I set is 324KB every time when transfer data,but if I change it to a smaller number,this error disappear. And nothing can be received if this error occured.
Do you know what cause this error ?What should I do to avoid it ?


Thank you all


Chuang
Tim Roberts
2014-06-11 16:44:06 UTC
Permalink
Post by 442777816
Hi,everybody
When I did my test this afternoon,I found my code threw a libusb error
called LIBUSB_TRANSFER_ERROR,about 1/2 transfers appear this error.I
use the non-blocking transfer mode ,bulk endpoint ,the transfer size I
set is 324KB every time when transfer data,but if I change it to a
smaller number,this error disappear. And nothing can be received if
this error occured.
Do you know what cause this error ?What should I do to avoid it ?
This CAN mean that your device ended the transfer before it got to 324KB
and you didn't say that was OK. Remember that the device can end a
transfer by sending a packet that is less then its maximum packet size.
If it sends a short packet to end the transfer, and you specify
LIBUSB_TRANSFER_SHORT_NOT_OK, then you'll get that error.

What transfer size did you specify, exactly? A bulk request should
always be an exact multiple of the packet size. 324,000 is not an exact
multiple of 512. If you really mean 331,776 (which is 324 x 1024), then
it would be fine.
--
Tim Roberts, ***@probo.com
Providenza & Boekelheide, Inc.
Loading...