summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* misc: revert all references to libusb/libusb.infomergebackhjelmn2013-12-3077-1309/+447
|
* Windows: Add SetupAPI error handlingPete Batard2013-12-302-1/+15
| | | | | | | | * 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
* Linux: Remove trailing whitespaceMoritz Fischer2013-12-282-5/+5
| | | | * Closes #157
* Android: Add support for Linux/Android platformsKuangye Guo2013-12-284-10/+32
| | | | * Closes #154
* Android: Build for all Android architecturesAndrew Fernandes2013-12-283-2/+8
| | | | | | | * 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
* Windows: Add Visual Studio 2013 solution filesJoshua Blake2013-12-1311-1/+1422
| | | | | * Also update gitignore * Closes #162
* core: fix Doxygen warningLudovic Rousseau2013-12-062-2/+2
| | | | | | | | | 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
* Windows: Fix a crash when HID transfers return no dataPete Batard2013-11-272-13/+15
| | | | | * Issue reported by Surmakyynis * Closes #160
* core: Make LIBUSB_DEBUG environment variable also work from libusb_exitHans de Goede2013-11-202-8/+15
| | | | | | | 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>
* hotplug: Fix usb_device memleak with hotunplug events pending on libusb_exitHans de Goede2013-11-202-1/+15
| | | | | | Closes #150 Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* io: Ensure all pending events are consumed in one libusb_handle_events callHans de Goede2013-11-202-1/+12
| | | | | | | | | 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>
* Windows: Add support for VIA VL805 USB 3.0 Host ControllersOmri Iluz2013-10-082-2/+2
| | | | | * These controllers identify themselves as VUSB3HUB * Closes #152
* examples: check value returned by ftell()Ludovic Rousseau2013-10-062-2/+6
| | | | | | | | | 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
* Windows: Avoid potential mismatch in transfer error reportingMatthias Bolte2013-10-012-2/+2
| | | | | | | | | | | | | | 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
* examples: add an option to force a device request for WCID descriptorsPete Batard2013-09-292-2/+12
| | | | | | | | | * 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.
* examples: fix warningLudovic Rousseau2013-09-282-2/+2
| | | | | | | ezusb.c: In function 'ezusb_load_ram': ezusb.c:719:6: warning: 'ret' may be used uninitialized in this function [-Wmaybe-uninitialized] int ret;
* tests: set output_file to a valid valueLudovic Rousseau2013-09-282-1/+2
| | | | | | | | | | | 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".
* examples: check value returned by libusb_bulk_transfer()Ludovic Rousseau2013-09-282-2/+8
| | | | | | | | | 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).
* examples: check the value returned by libusb_handle_events()Ludovic Rousseau2013-09-282-2/+4
| | | | | | | 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).
* examples: check the value returned by libusb_init()Ludovic Rousseau2013-09-282-2/+7
| | | | | | | 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).
* linux: take newline into account for sysfs_get_active_configKarsten Koenig2013-09-282-2/+2
| | | | | | | | | 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
* examples: Fix a memory leakLudovic Rousseau2013-09-202-8/+20
| | | | | | | | 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.
* examples: Fix a memory leakLudovic Rousseau2013-09-202-15/+30
| | | | | | | | 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.
* Fix darwin compilation broken by the usbi_get_device_by_session_id changesHans de Goede2013-09-152-2/+2
| | | | Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* Make usbi_get_device_by_session_id return a ref to the found deviceHans de Goede2013-09-069-28/+26
| | | | Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* openbsd: Fix a memleakHans de Goede2013-09-062-2/+5
| | | | | | | 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>
* openbsd: Fix usbi_sanitize_device error handlingHans de Goede2013-09-062-2/+4
| | | | | | | 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>
* configure.ac: uclinux is also linuxGustavo Zacarias2013-09-061-1/+1
| | | | | | | | 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>
* Release 1.0.17v1.0.17Hans de Goede2013-09-063-3/+3
| | | | Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* Windows: Address an VS2012/x64 warning in hotplug.cXiaofan Chen2013-09-022-2/+2
| | | | | ..\libusb\hotplug.c(255): warning C4244: '=' : conversion from 'ssize_t' to 'int', possible loss of data
* Nathan is a maintainer now, so add him to the READMEHans de Goede2013-08-302-2/+3
| | | | Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* Remove unused THANKS fileHans de Goede2013-08-302-8/+1
| | | | Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* Makefile.am: Add Xcode dir to EXTRA_DISTHans de Goede2013-08-302-2/+2
| | | | Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* Android: Add android build files to source tarballToby Gray2013-08-302-2/+3
| | | | Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* Release 1.0.17-rc1v1.0.17-rc1Hans de Goede2013-08-284-8/+32
| | | | Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* darwin: return libusb error codes instead of kernel error codes and fixNathan Hjelm2013-08-262-4/+6
| | | | a bug introduced in the last commit.
* darwin: clean up some code. remove a clang warningNathan Hjelm2013-08-262-12/+8
| | | | | The check for NULL != cached_device was unnecessary and caused clang's static analysis to print out a warning.
* Android: Add further documentation to Android README fileToby Gray2013-08-212-1/+91
| | | | Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* OpenBSD: Add basic support for non ugen(4) devices using usb(4)Martin Pieuchot2013-08-212-123/+212
| | | | | | | | 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>
* openbsd: Split openbsd backend into separate openbsd and netbsd backendsHans de Goede2013-08-216-9/+760
| | | | | | | | | | | 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>
* Clarify alignment requirements for the control transfer bufferPaul Fertser2013-08-213-5/+7
| | | | | | | | | | | | | | | | | | | | | | | 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>
* linux: Handle device disconnection early when possibleChris Dickens2013-08-215-6/+25
| | | | | | | | | | | | | 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>
* hotplug: Document LIBUSB_HOTPLUG_ENUMERATE gotchasHans de Goede2013-08-212-1/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* hotplug: Document that callbacks cannot unregister themselves when called ↵Hans de Goede2013-08-212-2/+6
| | | | | | from hotplug_register_callback Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* hotplug: Don't call the user callback while holding various locksHans de Goede2013-08-212-8/+18
| | | | | | | | | | | | | | | | | | 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>
* hotplug: Remove device from usb_devs before signalling its removalHans de Goede2013-08-202-5/+5
| | | | | | | | 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>
* libusb: Fix usb_devs_lock mutex use after free in libusb_init error pathHans de Goede2013-08-202-5/+5
| | | | Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* linux/netlink: correct usage of fcntlNathan Hjelm2013-08-141-2/+9
| | | | Closes #130
* Windows: Fix a cast warning when compiling for x64 in VSPete Batard2013-08-133-4/+4
| | | | * Also fixes and closes #129 again
* Windows: Fix VS2010 project filesPete Batard2013-08-122-2/+2
| | | | * Closes #129