This return code indicates that the device returned a data packet
less than the max packet size. In libusb backend terms, this is
a successful transfer.
Remove the use of the ambiguous "interface" where possible without
breaking the API.
'interface' is a preprocessor #define already associated with COM on Windows,
that can cause a conflict as soon as windows.h is included.
There are a few more places where interface is still used, which should
be changed for libusb-2.0
This prepares for a Windows backend without dependency on pthreads-w32.
pthread_* is renamed to usbi_* and PTHREAD_* to USBI_*.
A usbi_mutex_static_t and usbi_mutex_static_lock() and _unlock() are
introduced for statically initialized mutexes, since they may be
implemented using other types when pthreads mutexes aren't used.
Move -pthread from libusb/Makefile.am to host-specific THREAD_CFLAGS in
configure.ac. This will enable optional use of -lpthread for cygwin.
[dsd: minor tweaks, and roll in a change based on patches from Pete
Batard to only build dpfp_threaded example when we're using pthreads]
driver/usb/core/devio.c function usbdev_read translate the follwing files
to CPU endianess:
le16_to_cpus(&temp_desc.bcdUSB);
le16_to_cpus(&temp_desc.idVendor);
le16_to_cpus(&temp_desc.idProduct);
le16_to_cpus(&temp_desc.bcdDevice);
All other data is passed without any change.
libusb/os/linux_usbfs.c calls usbi_parse_descriptor with host_endian=1
for config descriptors. According to the kernel code, they must be
processed with host_endian=0, as they are not translated by the kernel.
Signed-off-by: Martin Koegler <mkoegler@auto.tuwien.ac.at>
Use a new file descriptor from the timerfd system calls to handle
timeouts. On supported systems, this means that there is less hassle
figuring out when the poll() timeout should be, since
libusb_get_next_timeout() will always return 0 and the timeout events will
be triggered as regular activity on the file descriptor set.
Add API function libusb_pollfds_handle_timeouts() to detect whether
you're on a platform with the timing headache, and flesh out the
surrounding documentation.
We cannot dereference tpriv after calling
usbi_handle_transfer_cancellation() because that function may invoke
the user-supplied callback which may free the transfer.