|
From: David L. <dav...@le...> - 2019-07-24 21:01:38
|
Hello,
We have an application that use libusb to communicate with a sensor. On windows and linux x86/x64 it works fine, however, when using a raspberry pi 3, I have a weird issue.
The sensor streams data to the host, so I just have to loop "libusb_bulk_transfer" to fetch data. I call the function this way
int lLen = 0;
libusb_bulk_transfer( mHandle, aEndPoint | LIBUSB_ENDPOINT_IN, aData, aDataSize, &lLen, 1000 );
std::cout << "Length: 0x" << std::hex << lLen << std::endl;
The issue appears if aDatasize is greather than 0x4000. I dont receive correct data all the time.
In my case, if I loop libusb_bulk_transfer with aDataSize = 0x4000, everything fine and I receive:
Length: 0x1c8
Length: 0x50
Length: 0x1c8
Length: 0x50
Length: 0x1c8
Length: 0x50
Which is correct data. However, if I loop with aDataSize = 0x4001, the received data are
Length: 0x1c8
Length: 0x10
Length: 0x1c8
Length: 0x10
Length: 0x1c8
Length: 0x10
Length: 0x1c8
Length: 0x10
We can see that we still have the 0x1c8, and I checked that the data inside is correct. But the other paquets (0x10) are incorrect.
Is there any reason that a size > 0x4000 is problematic?
Note:
aData is a buffer of size 19000. I can read it and modify it without any issue.
The two loops are run one after the other. If I put another loop after the failing one, the behaviour is correct in this last loop.
Hardware: raspberry pi 3
OS: raspbian 4.19.57-v7+ #1244 SMP Thu Jul 4 18:45:25 BST 2019 armv7l GNU/Linux
Libusb v1.0.21-1
Thanks in advance,
David
|