| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
|
|
|
|
| |
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
|
|
|
|
|
|
|
|
| |
* Fix MSVC error C4334 (32-bit bit shift)
* Load User32.dll functions at runtime instead of linking directly
against library (fixes unresovled symbol errors on DDK build)
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit addresses two issues.
First, commit a886bb02 introduced an issue where transfer callbacks
would not be called if the transfer that completed was the first
in line and the timerfd needed to be armed for another transfer.
Second, failure to set the timerfd should not prevent the transfer
from completing. The behavior has always been such, but it will
leave clients waiting for their transfer callbacks to be called.
This change will let the transfer callback complete and will return
the error through the event handling path.
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
|
|
|
|
| |
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Commit efd02e73 introduced a bug where transfers that timed out
would be handled repeatedly if the cancellation was not successful.
This behavior blocks any event handling from occurring.
This commit adds a new transfer flag to record whether a timeout has
been handled.
Thanks to Jeffrey Nichols for reporting this.
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
|
|
|
|
|
|
|
|
| |
* Add two-stage load support
* Fix leaks in error-handling paths
* Closes #12
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Prior to this commit, the handle_timeout() function would always
set the USBI_TRANSFER_TIMED_OUT flag on the transfer. However, in
some cases the actual cancellation of the transfer does not succeed,
perhaps because the transfer had just completed. This would cause
occasional false reporting of LIBUSB_TRANSFER_TIMED_OUT when the
transfer did not in fact timeout. This commit adds a check for
successful cancellation before setting the transfer flag.
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
| |
Prior to this commit, a call to libusb_cancel_transfer() would set
the reap action of the transfer to CANCELLED regardless of whether
the cancellation was successful or not. This can cause the transfer
status to incorrectly report LIBUSB_TRANSFER_CANCELLED when in some
cases this is not the case. This commit adds a check for a successful
cancellation before setting the reap action as such.
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
On some exotic hardware, e.g. HP ProLiant Moonshot Cartridge servers there
are no usb controllers, so no usb devices at all.
In this case currently libusb_init will fail, because find_usbfs_path
fails. Many apps don't handle this gracefully, and even if they do not crash
the result still is not pretty, e.g.:
unable to initialize libusb: -99
Where one simply would expect empty output.
Since on systems using udev the usbfs path should always be /dev/bus/usb
(as that gets created by udev), simply assume /dev/bus/usb when build with
USE_UDEV and the path cannot be found in the traditional way.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
|
|
| |
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
|
|
|
|
| |
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
|
|
|
|
|
|
|
|
|
| |
This patch adds a new API call to ensure that the same memory
allocator is used to both allocate and free the list of libusb_pollfd
structures. It is an incorrect assumption that the user's free() will
use the same memory allocator that libusb uses internally.
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
|
|
|
|
|
|
|
|
| |
calloc can do n, elemsize multiplication itself
* Closes #74
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
| |
windows.h
Some users have to define NOMINMAX which means that windows.h doesn't define min() or max(). Instead of relying on it it is better to use a locally defined function / macro. Fortunately libusbi.h already defines MIN and MAX so we can just use those.
* Closes #72
* Closes #73
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
|
|
|
|
|
|
| |
* Closes #81
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
|
|
|
|
|
|
|
| |
* Checking of this parameter is already done by the core
* Closes #77
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
|
|
|
|
|
|
|
| |
* Fixes a resource leak during init error handling or final exit
* Closes #76
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
|
|
|
|
|
|
|
|
|
| |
strdup returns NULL in case memory allocation failure occurs.
If Null check is not there, it will crash while dereferencing in "strrchr".
Closes #66
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The MaxPower field of a configuration descriptor is in units of 8 mA
when the device is operating in super-speed mode according to the USB
3.0 specification, section 9.6.3, table 9-12:
Maximum power consumption of the device from the
bus in this specific configuration when the device is
fully operational. Expressed in 2-mA units when the
device is operating in high-speed mode and in 8-mA
units when operating at Gen X speed.
(i.e., 50 = 100 mA when operating at high-speed and
50 = 400 mA when operating at Gen X speed).
Adjust the doxygen comment for the MaxPower member of struct
libusb_config_descriptor accordingly.
Closes #69
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
|
|
|
|
|
|
|
|
| |
It need to check return value of calloc. It may fail & return Null.
Closes #67
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
The flying_transfers lock is taken in libusb_get_next_timeout()
to find the transfer with the next timeout, but the transfer was
being used outside of the lock, resulting in the possibility that
the transfer had been removed from the list and freed at the time
it was used.
Issue reported by Michel Sanches.
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* When removing a transfer from the flying_transfers list, only
rearm the timerfd if the transfer being removed was the first
transfer *and* had a timeout. This is the only case where the
timerfd should be altered by a transfer being removed.
* When searching the flying_transfers list for the next timeout,
searching can cease when the first transfer with an infinite
timeout is encountered.
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
|
|
|
|
|
|
|
|
|
| |
* Use sig_atomic_t as data type for variable do_exit
* Use async-safe function within signal handler
Closes #34
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The member add_iso_packet_size of struct usbi_os_backend is set to 0 in
all backends and thus has no actual use. This has been the case since
commit ad6e2b71 ("Linux: fire multiple URBs at once for split
transfers").
Also, the comment above the member actually states the fact that it is
unused and could potentially be removed, so remove it.
Closes #62
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
| |
The final end-of-line marker is added in usbi_log_v() using the
USBI_LOG_LINE_END define.
Also don't mix hardcoded \n and USBI_LOG_LINE_END in usbi_log_v().
Closes #59
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
|
|
|
|
| |
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
|
|
|
|
| |
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
|
|
|
|
| |
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
|
|
|
|
|
|
|
|
|
|
| |
Without the ability to set thread affinity, there is no need
to maintain a separate thread to service monotonic clock_gettime()
requests. The determinism of QueryPerformanceCounter() will not
change or improve when run from a dedicated thread, so this just
creates additional overhead.
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
|
|
|
|
| |
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The comment about libusb_set_configuration() failing when other programs
or drivers have claimed interfaces is valid whether or not the desired
configuration is _different_ from the current one, so generalize the
statement.
While at it also make it more explicit that in case of kernel drivers,
those must be detached from _all_ interfaces before a configuration can
be set.
Finally, move the item as last as the new details also suggest
a solution for when a lightweight reset is desired but kernel drivers
have claimed other interfaces, like in the fingerprint reader example
mentioned in the same section.
Signed-off-by: Antonio Ospite <ao2@ao2.it>
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
|
|
|
|
|
|
|
|
| |
Use the actual signature of the libusb_get_configuration() function in
the code example in the "caveats" section of the documentation.
Signed-off-by: Antonio Ospite <ao2@ao2.it>
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
|
|
|
|
| |
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
|
|
|
|
|
|
|
|
| |
* Fix setting of timer thread affinity
* Simplify request mechanism by using a message queue, which also
yields a 10% performance improvement
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
|
|
|
|
|
|
| |
Per the USB spec, the wIndex field should be zero or the language ID.
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
|
|
|
|
|
|
|
| |
* The current ancestry lookup for bus number stopped at the first
non-enumerated grandparent device instead of continuing up to
the HCD.
* Issue reported by Daniel Pfeffer
|
|
|
|
|
|
|
|
|
|
|
| |
While cross-building for android, the -c flag was causing errors.
This -c option ends up in Libs.private of libusb-1.0.pc file.
On its usage, it is interpreted as "Compile and assemble, but do not link"
option of gcc. Usage of -c in this way might be unintended.
Hence, removing this option.
Signed-off-by: Venkatesh Shukla <venkatesh.shukla.eee11@iitbhu.ac.in>
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
|
|
|
|
| |
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
|
|
|
|
| |
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
|
|
|
|
| |
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch adds some new flags to keep track of transfer state.
These flags are used to properly handle transfers that are on
the flying_transfers list for devices that are disconnected.
The motivation for this patch is to release the requirement of
holding the flying_transfers_lock for the duration of a call to
libusb_submit_transfer(). Holding this lock is the simplest and
safest way to submit a transfer, but it has performance impacts
as it serializes transfer submission for a given context.
With proper transfer state management, the library can handle a
device disconnect without needing to prevent multiple transfers
from being concurrently submitted.
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
|
|
|
|
| |
* Closes #53
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
For each new device (processed by hotplug code) darwin_ref_cached_device
is called twice - in process_new_device and in darwin_get_cached_device
(which is called from the first function). But when the device is detached
only one darwin_deref_cached_device is done - in darwin_destroy_device.
So there is inbalance between ref and deref which causes darwin_cached_devices
list to monotonically grow and consume more and more resources over time.
This commit fixes the problem by adding darwin_deref_cached_device call
to darwin_devices_detached.
Closes #52
Signed-off-by: Nathan Hjelm <hjelmn@mac.com>
|
|
|
|
| |
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
|
|
|
|
| |
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
|
|
|
|
| |
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
|
|
|
|
| |
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
|
|
|
|
| |
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
|
|
|
|
| |
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
|