I'm in the process of porting an application
that communicates with a harware device using a serial port,
over to using USB. The device is pretty simple, it has
two end points, and you send ASCII messages to and fro
using bulk write and read, very similar to a serial port.
I've managed to get it working to some degree using LibUSB-win32,
but have number of problems using LibUSB (0.1.12) under OSX & Linux.
Under OSX (10.3.9), the problem is that small messages get through
successfully, but larger messages have the first packet
missing - ie. I expect to receive a 23 byte message,
but I get 15 bytes, the first 8 having gone missing.
(BTW, libusb.a isn't quite built right - the linker
complains about the contents table being out of date,
and I have to run ranlib on it to make it work.)
Under Linux, (White Box Enterprise Linux release 4), I have
a different problem (this is using the same code as
used for OSX). Neither bulk read, nor bulk write
work, both return error -22 "error submitting URB: Invalid argument".
Now of course, I'm not playing with URB's, that's something in
libusb linux.c. I've looked at the arguments to the bulk read and
write calls, and there doesn't seem anything obviously wrong
I do a couple of usb_control_msg() USB_REQ_GET_STATUS
calls on the two end points, and these calls work OK.
The buffer sizes are nothing special, a few hundred bytes.
Apart from setting configuration 1, and then claiming
the interface, I'm not doing any other setup on the device.
Here's testlibusb -v on the device:
Dev #0: X-Rite - X-Rite DTP94
- Serial Number: 042343
Anybody have any ideas on where to go with these two
problems ? Could they be the same problem, with different
symptoms on the two platforms ?