| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
| |
* http://msdn.microsoft.com/en-us/library/windows/hardware/ff545011.aspx
states that SetupAPI errors must be be converted before passing it to FormatMessage().
* Use our own implementation of HRESULT_FROM_SETUPAPI to avoid defining a new function call.
* Issue and original fix suggested by Matthias Bolte
* Closes #166
|
|
|
|
| |
* Closes #157
|
|
|
|
| |
* Closes #154
|
|
|
|
|
|
|
| |
* Don't limit support to ARM only (adds MIPS support)
* Also add a workaround for a MIPS NDK linker bug
* Also add a gitignore entry required to run bootstrap.sh on OS X
* Closes #134
|
|
|
|
|
| |
* Also update gitignore
* Closes #162
|
|
|
|
|
|
|
|
|
| |
libusbx/libusb/libusb.h:153: warning: no matching file member found for
libusb_cpu_to_le16()Possible candidates:
static uint16_t libusb_cpu_to_le16(const uint16_t x)
Thanks to Serhat Sevki Dincer for the bug report
http://sourceforge.net/mailarchive/message.php?msg_id=31719691
|
|
|
|
|
| |
* Issue reported by Surmakyynis
* Closes #160
|
|
|
|
|
|
|
| |
libusb_exit sets usbi_default_context to NULL, modify usbi_log_v so that
it still honors the LIBUSB_DEBUG environment variable in this case.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
|
|
|
|
| |
Closes #150
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
|
|
|
|
|
|
|
| |
Before this patch if ie multiple hot-plug events were pending, multiple
handle_events calls would be necessary to handle them all, this patch
changes handle_events so that the poll is re-done to check for more events
if there was activity on any of the special fds.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
|
|
|
| |
* These controllers identify themselves as VUSB3HUB
* Closes #152
|
|
|
|
|
|
|
|
|
| |
Problem detected by the Coverity tool
CID 1042546 (#1 of 1): Argument cannot be negative (NEGATIVE_RETURNS)3.
negative_returns: "initial_pos" is passed to a parameter that cannot be
negative.
fseek(3) can't be called with a negative offset with SEEK_SET
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The default case in windows_transfer_callback() calls windows_error_str(0)
which will convert the error code returned by GetLastError() to a string.
This currently works because windows_transfer_callback() is either called
with io_result set to NO_ERROR or io_result set to GetLastError().
If windows_transfer_callback() will ever be called with io_result set
differently then the default case might report the wrong error message.
Call windows_error_str(io_result) instead to avoid this.
Closes #151
|
|
|
|
|
|
|
|
|
| |
* Add option 'w' to force the use of a Device Request rather than an
Interface Request when querying the WCID OS Extended Properties descriptor.
* This is due to a WinUSB limitation where all Interface Requests have the
wIndex set to the interface number.
* This assumes that the WCID firmware answers both Device and Interface requests
equally.
|
|
|
|
|
|
|
| |
ezusb.c: In function 'ezusb_load_ram':
ezusb.c:719:6: warning: 'ret' may be used uninitialized in this function
[-Wmaybe-uninitialized]
int ret;
|
|
|
|
|
|
|
|
|
|
|
| |
If fdopen(3) fails then ctx->output_file is NULL and should not be used
in cleanup_test_output() called next.
Problem detected by the Coverity tool
CID 1042543 (#1 of 1): Dereference after null check (FORWARD_NULL)9.
var_deref_model: Passing "ctx" to function
"cleanup_test_output(libusbx_testlib_ctx *)", which dereferences null
"ctx->output_file".
|
|
|
|
|
|
|
|
|
| |
Problem detected by the Coverity tool
CID 1042540 (#1 of 1): Unchecked return value (CHECKED_RETURN)1.
check_return: Calling function "libusb_bulk_transfer(struct
libusb_device_handle *, unsigned char, unsigned char *, int, int *,
unsigned int)" without checking return value (as is done elsewhere 4 out
of 5 times).
|
|
|
|
|
|
|
| |
Problem detected by the Coverity tool
CID 1042539 (#1 of 1): Unchecked return value (CHECKED_RETURN)8.
check_return: Calling function "libusb_handle_events(libusb_context *)"
without checking return value (as is done elsewhere 6 out of 7 times).
|
|
|
|
|
|
|
| |
Problem detected by the Coverity tool
CID 1042538 (#1 of 1): Unchecked return value (CHECKED_RETURN)4.
check_return: Calling function "libusb_init(libusb_context **)" without
checking return value (as is done elsewhere 11 out of 12 times).
|
|
|
|
|
|
|
|
|
| |
bConfigurationValue in sysfs can be 3 digits (1byte value) + 1 new line
= 4 bytes
In it's current form a bConfigurationValue of 128 will be detected as
not null terminated due to the trailing newline, simple fix is to just
extend the array size to 5
|
|
|
|
|
|
|
|
| |
Close the image file before exiting the function
Problem detected by the Coverity tool
CID 1042549 (#2 of 3): Resource leak (RESOURCE_LEAK)9. leaked_storage:
Variable "image" going out of scope leaks the storage it points to.
|
|
|
|
|
|
|
|
| |
Close the image file before exiting the function
Problem detected by the Coverity tool
CID 1042550 (#1 of 15): Resource leak (RESOURCE_LEAK)7. leaked_storage:
Variable "image" going out of scope leaks the storage it points to.
|
|
|
|
| |
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
|
|
| |
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
|
|
|
|
|
| |
discovered_devs_append takes a reference to the past in dev, so we must
release our own reference.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
|
|
|
|
|
| |
If usbi_sanitize_device fails we need to continue from the beginning of
the loop, rather then going on with the device we've just free-ed.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
|
|
|
|
|
|
| |
When the tuple contains uclinux rather than just linux (nommu flat
targets) configure will fail with an unknown operating system.
Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
|
|
| |
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
|
|
|
| |
..\libusb\hotplug.c(255): warning C4244: '=' : conversion from
'ssize_t' to 'int', possible loss of data
|
|
|
|
| |
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
|
|
| |
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
|
|
| |
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
|
|
| |
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
|
|
| |
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
|
|
| |
a bug introduced in the last commit.
|
|
|
|
|
| |
The check for NULL != cached_device was unnecessary and caused clang's
static analysis to print out a warning.
|
|
|
|
| |
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
|
|
|
|
|
|
| |
It is now possible to have a read access and submit control transfers
to all USB devices using libusb, please note that controllers and hubs
also appear as devices.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
| |
Note the new netbsd_usb.c is an unmodified copy of openbsd_usb.c with
s/obsd/netbsd done on it. The reason for this split is that the openbsd
developers have been working on various improvements for their userspace
usb support, and adding support for those means breaking netbsd support,
by giving netbsd its own backend we can add support for the openbsd
improvements without breaking netbsd support.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Since the buffer pointer will later be casted to ``struct
libusb_control_setup *'', it should point to memory aligned to at least
2 bytes boundary as that's the strictest requirement of the struct fields.
Also, use a (void *) casting trick to convince the compiler the cast is
safe, to fix warnings such as:
/usr/local/include/libusb-1.0/libusb.h: In function 'libusb_control_transfer_get_setup':
/usr/local/include/libusb-1.0/libusb.h:1435:9: error: cast increases required alignment of target type [-Werror=cast-align]
/usr/local/include/libusb-1.0/libusb.h: In function 'libusb_fill_control_setup':
/usr/local/include/libusb-1.0/libusb.h:1464:39: error: cast increases required alignment of target type [-Werror=cast-align]
/usr/local/include/libusb-1.0/libusb.h: In function 'libusb_fill_control_transfer':
/usr/local/include/libusb-1.0/libusb.h:1509:39: error: cast increases required alignment of target type [-Werror=cast-align]
cc1: all warnings being treated as errors
This actually can lead to failure to build from the sources for certain
projects which use -Werror=cast-align on ARM.
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If a device is open, the device's fd will trigger a POLLERR condition
once it is removed. Sometimes this can occur well before the udev
monitor sends the remove event. This can also be caught early if
the device is not currently open but an attempt to open it is made.
In both situations, this can be caught early and processed so that
the device does not continue to show up in the device list after it
has been disconnected but before the udev monitor processes the event.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When libusb_hotplug_register_callback gets called with the
LIBUSB_HOTPLUG_ENUMERATE flag, there may still be hotplug events pending
in the hotplug pipe, waiting for dispatching from libusb_handle_events.
This means that the user callback can be called twice for arrival of the
same device, once from libusb_hotplug_register_callback, since the device
is already part of the usb_devs list, and once from libusb_handle_events
when it reads the event from the hotplug pipe.
This could be fixed by adding a mechanism to pause hotplug handling, then
drain the hotplug pipe (ie by calling libusb_handle_events from
libusb_hotplug_register_callback), before iterating over the usb_devs list,
and then un-pausing hotplug handling afterwards, doing this however requires
a lot of hairy code, which will be prone to dead-locking.
OTOH it is quite simple for user applications which care about this to detect
this and ignore the 2nd call, so lets simply document this may happen and
be done with it.
Note that this is also the solution which ie libudev has choosen, there is
no way with libudev to get a device-list + listen for device arrival / removal
without running into the same problem.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
|
|
|
|
| |
from hotplug_register_callback
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Calling user callbacks with locks held is a bad idea and should be avoided
whenever possible. Before this patch this could lead ie to the following hang:
1) User calls libusb_hotplug_register_callback with the
LIBUSB_HOTPLUG_ENUMERATE flag
2) libusb_hotplug_register_callback calls the user callback while holding the
hotplug_cbs_lock
3) The callback calls a synchronous libusb function
4) The synchronous libusb function calls libusb_handle_events
5) There is an hotplug event waiting in the hotplug pipe and
libusb_handle_events calls usbi_hotplug_match
6) usbi_hotplug_match tries to take the lock a 2nd time
7) hang / assert / abort (depending on the platform)
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
|
|
|
|
|
|
| |
If we write the remove event to the pipe before doing the list_del,
in theory another thread can process the event and unref the device before
it has been removed from usb_devs.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
|
|
| |
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
|
|
| |
Closes #130
|
|
|
|
| |
* Also fixes and closes #129 again
|
|
|
|
| |
* Closes #129
|