| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
| |
Fixes #121.
|
|
|
|
| |
References #121.
|
|
|
|
| |
References #121.
|
|
|
|
|
|
|
|
| |
sync.c: In function `libusb_control_transfer':
sync.c:122: warning: enumeration value `LIBUSB_TRANSFER_OVERFLOW' not
handled in switch
Fixes #120.
|
|
|
|
|
|
| |
* pointed out by Travis Robinson and Xiaofan Chen
* similar to a change advised by Alan Stern for the Linux kernel:
http://marc.info/?m=122790204410765
|
|
|
|
| |
* issue reported by René Haunstrup in http://marc.info/?m=130503019227814
|
|
|
|
|
|
| |
* Windows 8, NEC/Renesas, TI, Fresco Logic, Etron, VIA, ASMedia
(some of which untested!)
* includes workaround for NEC/Renesas USB 3.0 root hubs
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
The transfer size is now always truncated to 32 bits.
|
| |
|
| |
|
|
|
|
|
| |
There's no xusb, we need a glob pattern for matching .exe files, and
fpusb tarballs aren't very common in the libusb source dir.
|
|
|
|
|
|
|
|
|
|
|
| |
The example code and API doc for libusb_handle_events_timeout() could be
interpreted as it being OK to pass a NULL pointer for the tv argument (I
interpreted it like that when I first started coding for libusb).
This patch changes the docs to make it clear that one must always supply
a tv struct to libusb_handle_events_timeout.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
|
|
| |
[pbatard: Remove it on make maintainer-clean instead]
|
|
|
|
|
| |
References #88. The race condition still remains, but this change
makes it less likely to trigger.
|
|
|
|
| |
Fixes #87.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A submitted transfer that has just been failed by the kernel could be
picked up by an event handler to be cleaned up, where freeing of URB
memory would race with the submit function doing it's own cleanup and
freeing as a result of the submit failing.
libusb_submit_transfer() always holds itransfer->lock, so the race can
be avoided by taking that lock also in the cleanup path and checking
that the URB memory has not already been freed before freeing it there.
As http://libusb.org/ticket/81#comment:14 notes there is still another
possible, but unlikely, race condition between libusb_submit_transfer()
and an event handling thread. That will require more work to solve.
[stuge: Add check in cleanup path that URBs have not already been freed]
|
|
|
|
|
|
|
|
|
| |
Until we have i18ned error messages we can at least offer easy
translation from numeric error code to the error code's name.
[hansg: switch() on enum to get a compiler warning if a case is missing]
[hansg: Better return value when called with an unknown error code]
[hansg: Fix DEFAULT_VISIBILITY in definition to compile on all platforms]
|
|
|
|
|
|
|
|
|
|
| |
Since it is currently not planned to change the filename of the libusb
DLL file for Windows systems between libusb-1.0 versions it is important
to have this API available starting with the first release that supports
Windows.
Currently there exists only one capability; LIBUSB_CAN_GET_DEVICE_SPEED,
which will always be supported when libusb_has_capability() is available.
|
| |
|
|
|
|
| |
Fixes #109.
|
|
|
|
| |
References #109.
|
|
|
|
|
| |
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
[stuge: Note that the old racy functions should be avoided by new code]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The sync API had a race where it would check a condition to know if it
needed to call a libusb_handle_events() function. However, the check
was done outside of the lock that is held while the condition is set,
so another thread could completely serve whatever was needed to make
the condition true between it being checked and the event handler being
called. This situation would be detected after a libusb-internal timeout
of 60 seconds, after which the transfer would be completed without
error, but with significant delay.
Original patch at http://marc.info/?l=libusb-devel&m=127252114815709
Changes by Hans de Goede:
- Renamed the "race-proof" functions from libusb_handle_events*_check()
to libusb_handle_events*_completed()
- Drop r = 0 setting in libusb_handle_events_timeout_completed()
(to make both completed checking cases identical flow wise)
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
[stuge: Simplify libusb_handle_events_timeout() change with a goto]
[pbatard: Fix _handle_events_timeout() and _completed() definitions]
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
At least in Linux, wireless USB devices have zero configurations until
they have been authorized. This device state can be set for any USB
device using:
echo 0 > /sys/bus/usb/devices/?-?/authorized
An unauthorized device would previously make usbi_sanitize_device()
return LIBUSB_ERROR_IO, although there really was no I/O error.
Reported-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
|
| |
|
|
|
|
|
|
| |
The code has been tested with various version strings.
[stuge: Remove bogus string length check and optimize for newer kernels]
|
|
|
|
|
|
|
|
|
| |
* use (currently superspeed unaware) USB_NODE_CONNECTION_INFORMATION_EX
Fixes #45.
[stuge: Explicitly convert OS device speeds to libusb device speeds]
[pbatard: Add breaks overlooked when adding explicit conversion]
|
|
|
|
| |
References #45.
|
|
|
|
|
|
| |
References #45.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Reworked version of my earlier patch, largely modelled after (if not
copy and pasted from) Trygve Laugstøl's <trygvis@inamo.no> similar
commit 5a6541e0d80fb1f21e2b960bc2337a612f9d74fb in
git://git.libusb.org/libusb-trygvis.git
http://git.libusb.org/libusb-trygvis.git
http://git.libusb.org/?p=libusb-trygvis.git;a=commitdiff;h=5a6541e0d
This patch does not add any OS specific code. The supporting code in
each backend follows in separate patches. References #45.
Signed-off-By: Hans de Goede <hdegoede@redhat.com>
|
|
|
|
|
|
|
|
| |
The device location is saved, and later used whenever iterating over
devices. Fixes #111 and #112.
[stuge: Formatting fixes and split out libusb_get_device_speed() change]
[stuge: Combine with patch that uses the saved device location]
|
|
|
|
|
|
| |
Remove code duplication.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
|
|
|
|
|
|
| |
On Linux we often need to read (postive) integers from sysfs. This patch
adds a helper function for this. This is a preparation patch for adding
a libusb_get_device_speed() function to libusb.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When an interface is bound to the usbfs driver (iow claimed), the
kernel will unbind it, and then after the reset do a device_attach
on the interface, which will bind the default in kernel driver to
the interface.
So if an app has detached the in kernel driver, and claimed the
interface and then does a libusb_reset_device. Things end up with
the interface no longer being bound to the usbfs driver (so no longer
claimed) and instead it is bound to the in kernel driver (iow the in
kernel driver is re-attached).
We can stop this from happening by releasing all claimed interfaces
before the reset, as the kernel will not do the device attach after
reset, if no driver was bound to the interface before the reset.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
|
|
|
|
|
|
|
| |
claimed_interfaces is a long and thus its size differs on 32
versus 64 bits, this patch uses USB_MAXINTERFACES instead of
sizeof(claimed_interfaces) on interface number range checks
for consistent behavior independent of the arch.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Compiling with gcc-4.6 results in the following warnings:
os/linux_usbfs.c: In function 'op_get_configuration':
os/linux_usbfs.c:1144:6: warning: variable 'r' set but not used ...
os/linux_usbfs.c: In function 'op_handle_events':
os/linux_usbfs.c:2091:40: warning: 'status' may be used uninitialized ...
os/linux_usbfs.c:2044:6: note: 'status' was declared here
dpfp.c: In function 'save_to_file':
dpfp.c:228:9: warning: variable 'ignore' set but not used ...
dpfp_threaded.c: In function 'save_to_file':
dpfp_threaded.c:257:9: warning: variable 'ignore' set but not used ...
This patch fixes these. (The second comes from handle_control_completion()
which gcc seems to inline into op_handle_events().)
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
[stuge: Add fixes for dpfp examples and update source references]
|