| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
| |
|
|
|
|
|
| |
Fix a crash which occurs if the user does the following sequence on a
device: open, close, get_configuration_descriptor.
|
|
|
|
|
| |
Protection needed: http://www.libusb.org/ticket/4
Losing data: fixed in previous commit
|
|
|
|
|
| |
We would previously lose any data that was present on a cancelled URB.
Work harder to make sure this doesn't happen.
|
|
|
|
|
|
|
|
|
| |
As pointed out by Dennis Muhlestein, libusb_get_max_packet_size()
doesn't really do what the documentation might suggest because it
does not consider the number of transaction opportunities per
microframe.
Add a new function to do what is useful for isochronous I/O.
|
|
|
|
|
| |
Note that there are is a kernel bug preventing this from working
properly at the moment, even after this fix.
|
|
|
|
| |
...because the OS does this for us.
|
|
|
|
|
| |
g++ -pedantic doesn't like this
Reported by Eberhard Mattes
|
| |
|
|
|
|
|
|
|
| |
Multi-byte fields in the configuration descriptors that come back from
usbfs are always in bus endian format.
Thanks to Joe Jezak for help investigating and fixing this.
|
| |
|
|
|
|
|
| |
This was a confusion between configuration numbers and zero-based
configuration indexes.
|
|
|
|
|
|
| |
This was due to an API inconsistency which can be safely worked around.
Hopefully we'll remember to fix the API next time we come to break
things.
|
|
|
|
|
|
|
|
|
|
|
|
| |
libusb_control_transfer and libusb_bulk_transfer are designed to be
synchronous such that control is not returned until the transfer
definitively succeeds or fails. That assumption is violated if a signal
interrupts these functions because there is no way for the application
to continue waiting for the transfer without resubmitting it. This
patch changes these synchronous APIs so they do not abort in the case of
a signal interruption.
Signed-off-by: David Moore <dcm@acm.org>
|
|
|
|
|
| |
The -fvisibility and -Wno-pointer-sign options are not available on
old GCC versions.
|
|
|
|
| |
Pointed out by Martin Koegler.
|
| |
|
| |
|
|
|
|
| |
Probably missed a couple of outstanding issues
|
| |
|
|
|
|
| |
My fault. Reported by ihryamzik@gmail.com
|
| |
|
|
|
|
|
| |
Implementation suggested by David Moore. Needed for proper universal
code support on Darwin.
|
|
|
|
|
|
| |
This will differ on Linux and Darwin, at least.
[dsd: minor style tweaks]
|
|
|
|
| |
Pointed out by Nathan Hjelm.
|
|
|
|
| |
[dsd: tweak configure.ac change]
|
|
|
|
|
|
|
|
| |
Add some text describing the libusb_transfer_cb_fn function type
with the semantics I have gathered from reading other parts of
the API docs, referring to the proper section for more details.
[dsd: tweaked the description slightly]
|
|
|
|
|
|
|
|
| |
If the compiler is known to be running in C99 mode,
use "flexible array members" ("foo[]").
If the compiler is running in any other mode, continue
using the non-standard but widely common "foo[0]" syntax.
|
| |
|
|
|
|
|
|
| |
When we receive data on the internal control pipe, we need to correctly
decrement the number of ready file descriptors before passing on the
remaining work to the OS implementation.
|
|
|
|
|
|
|
|
|
|
| |
This ensures that tpriv->urbs and tpriv->iso_urbs are always set to NULL
whenever a transfer is not submitted. In this way, submit_*_transfer()
and cancel_*_transfer() can error check to ensure that the transfer is
in the correct state to be either submitted or canceled, preventing
potential memory leaks or double frees.
Signed-off-by: David Moore <dcm@acm.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This fixes a race condition in cancel_bulk_transfer(). In the old
version, awaiting_reap and awaiting_discard are incremented in
cancel_bulk_transfer() and decremented in handle_bulk_completion().
However, since these events may take place in two different threads,
these variables may reach zero before all URBs have been canceled,
triggered spurious callbacks and duplicate frees.
This changes the logic to use a single variable "num_retired" to replace
both awaiting_reap and awaiting_discard. num_retired is incremented
only in handle_bulk_completion() and thus there is no race. The handler
will know that all URBs have been canceled when num_retired becomes
equal to num_urbs.
This change also simplifies a great deal of the logic in both functions
and is a net reduction in the amount of code.
Note that some variables such as "reap_action" probably need to still be
protected by a mutex, and this patch does not address that issue.
Signed-off-by: David Moore <dcm@acm.org>
|
|
|
|
| |
It's here!
|
|
|
|
| |
Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.ent>
|
|
|
|
|
| |
Shannon Chuang pointed out that we only read 1 byte into an
uninitialized integer, and then return the whole thing.
|
|
|
|
| |
Pointed out by Shannon Chuang.
|
|
|
|
|
|
| |
Documentation brushed up, and I realised that another function is
needed for tight event handling loops -- they must be able to check
if an open/close operation is trying to interrupt it.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Ludovic Rousseau found that crashes often occur if you close a device
while another thread is doing event handling.
Fix this by adding an internal control pipe, which the close routines
use to interrupt the event handler and obtain the event handling lock,
ensuring that no other thread is handling events while the device is
closed. After the close completes, it signals all the event handlers
to start up again using the usual mechanism.
Also modified libusb_open() to do a similar thing, so that event
handlers are interrupted in order to realise that a new poll fd has
appeared.
|
|
|
|
|
|
| |
Add support for re-attaching a driver to a device under Linux.
[dsd: fixed handling of return value, and added LIBUSB_ERROR_BUSY case]
|
|
|
|
| |
Handle more URB error status codes, thanks to Lou and Alan Stern.
|
|
|
|
|
|
|
| |
Contrary to libusb 0.1, libusb 1.0 does not support out-of-tree building
for the documentation part. This patch fixes that by using a
doxygen.cfg.in file, which contains @top_srcdir@ to refer to the
location of the libusb source code.
|
|
|
|
| |
Suggested by Lou.
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
This fixes a problem pointed out by Lou, where resubmitting a transfer
that previously timed out never timed out again, as if the timeout had
been set to 0.
|
|
|
|
| |
Pointed out by Lou
|