platform/upstream/libusb.git
11 years agoOS X: Don't assume an interval of 1
Nathan Hjelm [Wed, 3 Apr 2013 10:12:47 +0000 (04:12 -0600)]
OS X: Don't assume an interval of 1

11 years agoWinCE: Fix missing sources from dist tarball
Toby Gray [Wed, 3 Apr 2013 11:02:50 +0000 (12:02 +0100)]
WinCE: Fix missing sources from dist tarball

11 years agolibusbx 1.0.15-rc1
Pete Batard [Tue, 2 Apr 2013 18:52:16 +0000 (19:52 +0100)]
libusbx 1.0.15-rc1

* Also fix missing header in release tarball

11 years agoCore: Add HID and kernel detach capability detection for all backends
Pete Batard [Sun, 17 Mar 2013 22:13:53 +0000 (22:13 +0000)]
Core: Add HID and kernel detach capability detection for all backends

* Also remove Linux special case from xusb sample.
* Note that LIBUSBX_API_VERSION is incremented as a result of
  libusb_has_capability() returning nonzero rather than 1 when
  a capability is supported.
* A LIBUSB_CAP_HAS_HOTPLUG is also added, though it is currently
  not implemented on any platform
* Closes #102

11 years agoWindows: Fix USB descriptor creation code for HID devices
Toby Gray [Fri, 22 Mar 2013 13:50:01 +0000 (13:50 +0000)]
Windows: Fix USB descriptor creation code for HID devices

* Prior to this fix the location for the next endpoint structure was
  obtained by using ed++. This doesn't work as
  sizeof(libusb_endpoint_descriptor) is greater than
  LIBUSB_DT_ENDPOINT_SIZE due to extra members.
* Closes #110

11 years agoSamples: More fxload improvements and cleanup
Pete Batard [Sat, 16 Mar 2013 23:36:47 +0000 (23:36 +0000)]
Samples: More fxload improvements and cleanup

* Type detection when bus,addr is specified
* Improved check for FX3 image header
* Switch back to using -p for bus,addr and use a comma to
  match the output of listdevs

11 years agoTests: Suppress Visual Studio 2012 Code Analysis warnings
Pete Batard [Sat, 16 Mar 2013 16:39:14 +0000 (16:39 +0000)]
Tests: Suppress Visual Studio 2012 Code Analysis warnings

11 years agoSamples: fix compiler warning
Ludovic Rousseau [Fri, 15 Mar 2013 08:35:16 +0000 (09:35 +0100)]
Samples: fix compiler warning

Make fx3_load_ram a static function.

ezusb.c:534: warning: no previous prototype for ‘fx3_load_ram’

11 years agoSamples: fxload improvements and cleanup
Federico Manzan [Sun, 10 Mar 2013 07:56:56 +0000 (07:56 +0000)]
Samples: fxload improvements and cleanup

* fix C++ compilation
* use stdint types
* allow to specify bus:address as a parameter
* allocate a buffer when transferring FX3 image and check for R/W errors

11 years agoOS X: Do not assume HS when submitting isochronous transfer
Vegard Storheil Eriksen [Tue, 12 Mar 2013 15:30:05 +0000 (23:30 +0800)]
OS X: Do not assume HS when submitting isochronous transfer

* Closes #99

11 years agoOS X: Use kCFNumberSInt32Type when reading device location from the IO registry
Nathan Hjelm [Tue, 12 Mar 2013 15:09:07 +0000 (23:09 +0800)]
OS X: Use kCFNumberSInt32Type when reading device location from the IO registry

* Closes #97

11 years agoWindows: Fix multiple warnings
Pete Batard [Tue, 12 Mar 2013 01:26:08 +0000 (01:26 +0000)]
Windows: Fix multiple warnings

* Most of these warnings are false positive from VS2012's "Run Code Analysis"
* Also closes #98: "windows_usb.c:376:30: 'dev_info' may be used uninitialized"

11 years agoSamples: Add FX3 firmware upload support for fxload
Federico Manzan [Sun, 10 Mar 2013 21:00:00 +0000 (21:00 +0000)]
Samples: Add FX3 firmware upload support for fxload

11 years agoLinux: Consume all events on a fd in one go
Hans de Goede [Thu, 7 Mar 2013 11:44:00 +0000 (11:44 +0000)]
Linux: Consume all events on a fd in one go

* This fixes libusb_handle_events_timeout() only handling one event
* Closes #6

11 years agoSamples: Reinstate interface requests when querying WCID devices
Pete Batard [Mon, 4 Mar 2013 21:52:27 +0000 (21:52 +0000)]
Samples: Reinstate interface requests when querying WCID devices

* Reverts commit 939a4782b28c36dfddb68585c4b027a4d5494a5b.
* Closes #96

11 years agoWinCE: Post integration cleanup
Pete Batard [Sun, 3 Mar 2013 00:56:06 +0000 (00:56 +0000)]
WinCE: Post integration cleanup

* Update copyrights and switch to UTF-8 everywhere
* Add SleepEx() to missing.h, and move include to libusbi.h
* Remove ifdef for GetSystemTimeAsFileTime()

11 years agoMisc: Simplify includes and misc. cleanup
Pete Batard [Wed, 27 Feb 2013 22:58:49 +0000 (22:58 +0000)]
Misc: Simplify includes and misc. cleanup

* fxload sample provenance
* No need for <sys/types.h> in samples as already in libusb.h
* Don't bother about sscanf_s in xusb
* Use HAVE_### and rely on config.h where possible
* Formal inclusion of <winsock.h> in libusb.h for WinCE and WDK
* Cleanup of Windows' config.h
* Avoid ENAMETOOLONG and ENOTEMPTY conflict between errno.h and winsock.h for WinCE
* Additional newlines & braces cleanup

11 years agoTests: Fix broken OS-X and Linux builds
Xiaofan Chen [Sun, 24 Feb 2013 05:50:00 +0000 (05:50 +0000)]
Tests: Fix broken OS-X and Linux builds

* _dup2 is Windows only. Use dup2 instead
* Breakage was introduced in 76eecc6ce11d1bedee369859899901037dcd4cc2

11 years agoWinCE: Don't confirm protocol stalls with device in wince_transfer_callback()
Simon Haggett [Thu, 21 Feb 2013 16:59:00 +0000 (16:59 +0000)]
WinCE: Don't confirm protocol stalls with device in wince_transfer_callback()

When wince_transfer_callback() observes a stall (io_result set to
ERROR_NOT_SUPPORTED), it checks with the device (by sending a GET_STATUS
control transfer) that the endpoint is really stalled. This check is not
suitable for protocol stalls as these are always cleared at the start of the
next control transfer. When a protocol stall occurs, wince_transfer_callback()
observes that the corresponding control endpoint does not remain stalled and so
forces io_result to ERROR_SUCCESS. This then prevents applications from
detecting that a control request was not supported by the device.

This patch prevents wince_transfer_callback() from attempting to confirm
protocol stalls with the device, allowing io_result to remain set to
ERROR_NOT_SUPPORTED. A couple of comments and a debug log message within
wince_transfer_callback() are also corrected.

11 years agoTests: Simplify stdout redirection and fix Windows assertion error on cleanup
Pete Batard [Thu, 21 Feb 2013 00:24:18 +0000 (00:24 +0000)]
Tests: Simplify stdout redirection and fix Windows assertion error on cleanup

* cleanup_test_output() produced an assertion error when compiled with MSVC
  due to closing ctx->output_file
* set ctx->output_file to stdout by default

11 years agoWindows: Don't duplicate paths for HID interfaces
Pete Batard [Thu, 21 Feb 2013 00:11:37 +0000 (00:11 +0000)]
Windows: Don't duplicate paths for HID interfaces

* This caused the many_device_lists to fail after 32 iterations
* Closes #69

11 years agoWindows: Fix broken WDK compilation
Pete Batard [Mon, 18 Feb 2013 22:22:01 +0000 (22:22 +0000)]
Windows: Fix broken WDK compilation

790ffc78b008a03c95d10899f53997b504f55c72 moved the inclusion of poll_windows.h
  after the use of struct timeval, which removed the hidden winsock.h include
  where timeval is defined on the WDK.
* Make the winsock.h include explicit

11 years agoWindows: fix compiler warning
Ludovic Rousseau [Mon, 18 Feb 2013 19:29:41 +0000 (20:29 +0100)]
Windows: fix compiler warning

libusb/os/threads_windows.c:139:1: warning: '__inline' is not at beginning of declaration [-Wold-style-declaration]

11 years agoWindows: fix compiler warning
Ludovic Rousseau [Mon, 18 Feb 2013 19:26:46 +0000 (20:26 +0100)]
Windows: fix compiler warning

libusb/os/threads_windows.c: In function 'usbi_cond_timedwait':
libusb/os/threads_windows.c:190:2: warning: nested extern declaration of 'epoch_time' [-Wnested-externs]

11 years agoWindows: fix compiler warning
Ludovic Rousseau [Sat, 16 Feb 2013 16:23:36 +0000 (17:23 +0100)]
Windows: fix compiler warning

sizeof() returns a size_t not an int

libusb/os/windows_usb.c:1411:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
libusb/os/windows_usb.c:1416:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]

11 years agoWindows: fix compiler warnings
Ludovic Rousseau [Sat, 16 Feb 2013 16:07:53 +0000 (17:07 +0100)]
Windows: fix compiler warnings

libusb/os/windows_usb.c:1317:2: warning: initialization discards 'const' qualifier from pointer target type [enabled by default]
libusb/os/windows_usb.c:1317:2: warning: initialization discards 'const' qualifier from pointer target type [enabled by default]
libusb/os/windows_usb.c:1317:2: warning: initialization discards 'const' qualifier from pointer target type [enabled by default]

libusb/os/windows_usb.c:3634:2: warning: initialization discards 'const' qualifier from pointer target type [enabled by default]
libusb/os/windows_usb.c:3634:2: warning: initialization discards 'const' qualifier from pointer target type [enabled by default]
libusb/os/windows_usb.c:3634:2: warning: initialization discards 'const' qualifier from pointer target type [enabled by default]

11 years agoWindows: remove useless extern declaration
Ludovic Rousseau [Sat, 16 Feb 2013 16:04:59 +0000 (17:04 +0100)]
Windows: remove useless extern declaration

libusb/os/windows_usb.c:45:13: warning: redundant redeclaration of 'usbi_fd_notification' [-Wredundant-decls]
libusb/libusbi.h:420:6: note: previous declaration of 'usbi_fd_notification' was here

11 years agoWindows: fix compiler warnings
Ludovic Rousseau [Sat, 16 Feb 2013 16:02:40 +0000 (17:02 +0100)]
Windows: fix compiler warnings

libusb/os/windows_usb.c:368:36: warning: no previous prototype for 'get_interface_details_filter' [-Wmissing-prototypes]
libusb/os/windows_usb.c:691:5: warning: no previous prototype for 'get_sub_api' [-Wmissing-prototypes]
libusb/os/windows_usb.c:1179:6: warning: no previous prototype for 'get_api_type' [-Wmissing-prototypes]

11 years agoWindows: remove unused function
Ludovic Rousseau [Sat, 16 Feb 2013 16:00:32 +0000 (17:00 +0100)]
Windows: remove unused function

libusb/os/poll_windows.c:223:13: warning: 'reset_overlapped' defined but not used [-Wunused-function]

11 years agoWindows: fix compiler warnings
Ludovic Rousseau [Sat, 16 Feb 2013 15:58:17 +0000 (16:58 +0100)]
Windows: fix compiler warnings

libusb/os/poll_windows.c:176:5: warning: no previous prototype for '_fd_to_index_and_lock' [-Wmissing-prototypes]
libusb/os/poll_windows.c:197:13: warning: no previous prototype for 'create_overlapped' [-Wmissing-prototypes]
libusb/os/poll_windows.c:211:6: warning: no previous prototype for 'free_overlapped' [-Wmissing-prototypes]
libusb/os/poll_windows.c:223:6: warning: no previous prototype for 'reset_overlapped' [-Wmissing-prototypes]
libusb/os/poll_windows.c:401:6: warning: no previous prototype for '_free_index' [-Wmissing-prototypes]

11 years agoExamples: Fix compiler warning
Ludovic Rousseau [Wed, 17 Oct 2012 16:01:59 +0000 (18:01 +0200)]
Examples: Fix compiler warning

examples/ezusb.c:251:9: warning: implicit conversion loses integer precision: 'unsigned long' to 'unsigned int' [-Wshorten-64-to-32]
                off = strtoul(buf+3, NULL, 16);
                    ~ ^~~~~~~~~~~~~~~~~~~~~~~~

11 years agoCore: Fix compiler warning
Ludovic Rousseau [Sat, 13 Oct 2012 18:22:49 +0000 (20:22 +0200)]
Core: Fix compiler warning

libusb/io.c:1877:35: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
        timeout_ms = (tv->tv_sec * 1000) + (tv->tv_usec / 1000);
                   ~ ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~

On Mac OS X tv_sec is a __darwin_time_t which is a long, not an int.

11 years agoUse "" instead of <> for internal includes
Sean McBride [Wed, 31 Oct 2012 15:09:31 +0000 (11:09 -0400)]
Use "" instead of <> for internal includes

some libusbx include files were included with angle brackets, changed to
quotes. Needed to work better in Xcode project

11 years agoWindows: Update transferred data on timeout or cancel.
Toby Gray [Wed, 13 Feb 2013 15:21:52 +0000 (15:21 +0000)]
Windows: Update transferred data on timeout or cancel.

* When handling aborted transfer it's possible that some data (but not
  the full buffer) was transferred.
* This change ensures that this partially transferred data is recorded
  and passed up to the caller.

11 years agoLinux: Don't set the USBFS_URB_SHORT_NOT_OK flag on the last urb
Hans de Goede [Mon, 11 Feb 2013 15:21:00 +0000 (15:21 +0000)]
Linux: Don't set the USBFS_URB_SHORT_NOT_OK flag on the last urb

* Closes #142

11 years agoWindows: Improve error reporting in winusbx_claim_interface()
Pete Batard [Sat, 2 Feb 2013 01:02:18 +0000 (01:02 +0000)]
Windows: Improve error reporting in winusbx_claim_interface()

* After the filter detection code is run, the error reported may
  have nothing to do with the original error (or report SUCCESS)
  and is unhelpful
* Also change TODO comments to default VS2012 task style

11 years agoWindows: Fixed bug in interface autoclaim
Benjamin Dobell [Fri, 1 Feb 2013 14:42:06 +0000 (01:42 +1100)]
Windows: Fixed bug in interface autoclaim

* Bug was introduced in f2b19e4a32c1445f4fea06beca61e8c7e7757950
* Closes #78
* Closes #80

11 years agoCore: Fix warning implicit conversion changes signedness
Ludovic Rousseau [Fri, 26 Oct 2012 08:02:16 +0000 (10:02 +0200)]
Core: Fix warning implicit conversion changes signedness

* Closes #70

11 years agoCore: Don't wait for completion if cancel_transfer failed
Zoltán Kovács [Tue, 29 Jan 2013 00:14:29 +0000 (00:14 +0000)]
Core: Don't wait for completion if cancel_transfer failed

* See http://libusbx.1081486.n5.nabble.com/Libusbx-devel-libusb-interrupt-transfer-does-not-return-in-case-of-error-td626.html
* Closes #76

11 years agoWindows: Display error code in default case of windows_transfer_callback
Pete Batard [Mon, 28 Jan 2013 23:51:53 +0000 (23:51 +0000)]
Windows: Display error code in default case of windows_transfer_callback

11 years agoWinCE: Add support for WinCE (Solution files)
Toby Gray [Wed, 16 Jan 2013 02:10:31 +0000 (02:10 +0000)]
WinCE: Add support for WinCE (Solution files)

11 years agoWinCE: Add support for WinCE (sources)
Toby Gray [Wed, 16 Jan 2013 02:07:29 +0000 (02:07 +0000)]
WinCE: Add support for WinCE (sources)

11 years agoWindows: Simplify poll_windows and add provisions for WinCE
Toby Gray [Tue, 15 Jan 2013 22:46:49 +0000 (22:46 +0000)]
Windows: Simplify poll_windows and add provisions for WinCE

* Because poll_windows now requires struct usbi_transfer to be
  defined, it's inclusion in libusbi.h had to be moved down.

11 years agoWindows: Add windows_common.h header
Toby Gray [Tue, 15 Jan 2013 22:36:47 +0000 (22:36 +0000)]
Windows: Add windows_common.h header

* This file contains definition that will be shared between the
  Windows and Windows CE backends

11 years agoCore: Use HAVE_SYS_TYPES_H and HAVE_SIGNAL_H
Pete Batard [Tue, 15 Jan 2013 22:24:32 +0000 (22:24 +0000)]
Core: Use HAVE_SYS_TYPES_H and HAVE_SIGNAL_H

* These files may not be available on all platforms (eg. WinCE)

11 years agoCore: Filter out 8-bit characters in libusb_get_string_descriptor_ascii
Роман Донченко [Fri, 21 Dec 2012 23:08:09 +0000 (03:08 +0400)]
Core: Filter out 8-bit characters in libusb_get_string_descriptor_ascii

* Closes #68

11 years agoWindows: Add VS2012 solution files
Pete Batard [Mon, 7 Jan 2013 22:00:47 +0000 (22:00 +0000)]
Windows: Add VS2012 solution files

* As well as try to clean up MS's MSVC mess...

11 years agoCore: Fix incorrect reference counting of default context when first created.
Toby Gray [Mon, 26 Nov 2012 13:25:05 +0000 (13:25 +0000)]
Core: Fix incorrect reference counting of default context when first created.

* See http://libusbx.1081486.n5.nabble.com/Libusbx-devel-stress-program-crashes-in-libusb-exit-NULL-tp474p477.html

11 years agoTests: Add libusbx stress test
Toby Gray [Wed, 21 Nov 2012 14:00:31 +0000 (14:00 +0000)]
Tests: Add libusbx stress test

See https://github.com/tobygray/libusbx/tree/testing as well
as http://libusbx.1081486.n5.nabble.com/Libusbx-devel-Crashes-tt433.html#a438

11 years agoAutotools: Carry over 2012.10.23 libusb changes
Peter Stuge [Tue, 23 Oct 2012 00:15:23 +0000 (00:15 +0000)]
Autotools: Carry over 2012.10.23 libusb changes

* Use LIBS instead of PC_LIBS_PRIVATE
* Move THREAD_CFLAGS & VISIBILITY_CFLAGS into AM_CFLAGS
* Use AC_SEARCH_LIBS(clock_gettime) for pthreads on Linux

11 years agoCore: Avoid short read failures on broken descriptors
Peter Stuge [Tue, 30 Oct 2012 00:11:41 +0000 (00:11 +0000)]
Core: Avoid short read failures on broken descriptors

* See http://marc.info/?t=135132844600001&r=1&w=2

11 years agoDarwin: kAppleVendorID is not in the 10.5 SDK
Sean McBride [Thu, 8 Nov 2012 19:02:06 +0000 (19:02 +0000)]
Darwin: kAppleVendorID is not in the 10.5 SDK

* Use kIOUSBVendorIDAppleComputer instead

12 years agoDarwin: Clean up tabs
Nathan Hjelm [Wed, 31 Oct 2012 22:54:07 +0000 (22:54 +0000)]
Darwin: Clean up tabs

* Closes #55

12 years agoDarwin: Add support for detecting superspeed devices
Nathan Hjelm [Tue, 2 Oct 2012 14:07:03 +0000 (08:07 -0600)]
Darwin: Add support for detecting superspeed devices

* IOUSBFamily 5.0.0 or newer

12 years agoDarwin: Use Release instead of IODestroyPlugInInterface
Nathan Hjelm [Sat, 29 Sep 2012 04:13:09 +0000 (22:13 -0600)]
Darwin: Use Release instead of IODestroyPlugInInterface

* This avoids stopping IOServices associated with a device
* Closes #54

12 years agoDarwin: Don't retry or unsuspend Apple devices during enum
Nathan Hjelm [Sat, 29 Sep 2012 03:18:36 +0000 (21:18 -0600)]
Darwin: Don't retry or unsuspend Apple devices during enum

12 years agoDarwin: Reduce attempts to retrieve a device descriptor during enumeration
Nathan Hjelm [Sat, 29 Sep 2012 03:18:08 +0000 (21:18 -0600)]
Darwin: Reduce attempts to retrieve a device descriptor during enumeration

12 years agoCore: Use offsetof() instead of null pointer tricks
Sean McBride [Thu, 25 Oct 2012 18:51:50 +0000 (14:51 -0400)]
Core: Use offsetof() instead of null pointer tricks

Closes #53

12 years agoWindows: Fix access for composite HID devices
Pete Batard [Mon, 29 Oct 2012 23:41:23 +0000 (23:41 +0000)]
Windows: Fix access for composite HID devices

* composite_open was only catering for interfaces with WinUSB-like
  drivers and did not properly initialize HID driven ones
* Issue reported by Stefano Di Martino

12 years agoAll: Use "" instead of <> for local includes
Ludovic Rousseau [Fri, 12 Oct 2012 21:28:51 +0000 (23:28 +0200)]
All: Use "" instead of <> for local includes

System header files are used with #include <foo.h>
Xcode can't find local headers using this syntax.

12 years agoWindows: Fix early abort in libusb_close
Pete Batard [Wed, 3 Oct 2012 22:52:16 +0000 (23:52 +0100)]
Windows: Fix early abort in libusb_close

* We're calling winusbx_close with SUB_API_NOTSET, so
  we should attempt to initialize it first.
* Issue reported by Ramon Zambelli and Frank Hibbeln

12 years agolibusbx-1.0.14
Pete Batard [Mon, 24 Sep 2012 23:35:32 +0000 (00:35 +0100)]
libusbx-1.0.14

12 years agolibusbx-1.0.13
Pete Batard [Thu, 20 Sep 2012 20:58:04 +0000 (21:58 +0100)]
libusbx-1.0.13

12 years agoInternal: Add fxload exe and sources to the Windows binary snapshot
Pete Batard [Wed, 19 Sep 2012 21:22:24 +0000 (22:22 +0100)]
Internal: Add fxload exe and sources to the Windows binary snapshot

12 years agoMisc: Update copyrights, TODO and libusb_version.describe
Pete Batard [Tue, 18 Sep 2012 20:35:23 +0000 (21:35 +0100)]
Misc: Update copyrights, TODO and libusb_version.describe

* Changes suggested by Chuck Cook & Xiaofan Chen

12 years agolibusbx 1.0.13-rc2
Pete Batard [Sun, 16 Sep 2012 15:24:24 +0000 (16:24 +0100)]
libusbx 1.0.13-rc2

* Also update NEWS with regards to isoc support for the 0/K Windows drivers

12 years agoDoc: Fix doxygen warnings and issues
Pete Batard [Sun, 16 Sep 2012 15:19:54 +0000 (16:19 +0100)]
Doc: Fix doxygen warnings and issues

* Remove obsolete tags
* Use QUIET = yes to make issues more prominent
* Fix code display for LIBUSBX_API_VERSION and missing parameter
  documentation for libusb_get_port_path()
* Most of the above suggested by Ludovic Rousseau

12 years agoMisc: Fix missing files from dist package
Pete Batard [Sun, 16 Sep 2012 15:11:10 +0000 (16:11 +0100)]
Misc: Fix missing files from dist package

12 years agolibusbx 1.0.13-rc1
Pete Batard [Sat, 15 Sep 2012 23:16:06 +0000 (00:16 +0100)]
libusbx 1.0.13-rc1

12 years agoCore: Introduce LIBUSBX_API_VERSION macro
Pete Batard [Sat, 15 Sep 2012 22:57:21 +0000 (23:57 +0100)]
Core: Introduce LIBUSBX_API_VERSION macro

* This macro can be used to detect if the version of libusbx being
  compiled against has a specific API feature, as well as to detect
  whether compilation occurs against libusb or libusbx.

12 years agoCore: Make libusb_error_name also handle transfer status codes
Hans de Goede [Sat, 15 Sep 2012 10:31:00 +0000 (11:31 +0100)]
Core: Make libusb_error_name also handle transfer status codes

Note that for the code 0 which means success resp. completed we have an
overlap in the codes. This is not a problem since normally one would not
call libusb_error_name on success / normal completion.

12 years agoSamples: Fix compiler warnings in fxload
Ludovic Rousseau [Sat, 15 Sep 2012 08:18:50 +0000 (10:18 +0200)]
Samples: Fix compiler warnings in fxload

ezusb.c: In function  "ezusb_cpucs"
ezusb.c:163: warning: initialization discards qualifiers from pointer target type
ezusb.c: At top level:
ezusb.c:193: warning: no previous prototype for "parse_ihex"
ezusb.c:340: warning: no previous prototype for "parse_bin"
ezusb.c:377: warning: no previous prototype for "parse_iic"
ezusb.c: In function "ram_poke":
ezusb.c:451: warning: enumeration value "_undef" not handled in switch
ezusb.c:491: warning: passing argument 2 of "ezusb_write" discards qualifiers from pointer target type

12 years agoCore: Update libusb.h header in accordance with the latest USB specs
Pete Batard [Wed, 5 Sep 2012 23:47:08 +0000 (00:47 +0100)]
Core: Update libusb.h header in accordance with the latest USB specs

* IMPORTANT: This update fixes a typo in the API where MaxPower was being
  used instead of bMaxPower, with the latter being what is actually in
  the specs.
* As a result, applications that were using MaxPower need to be updated
  for bMaxPower.
* If you must maintain compatibility with libusb or older versions of
  libusbx, you may also want to either use a #define or copy/paste
  struct libusb_config_descriptor from libusb.h under a new name, and
  then use a cast on calls that require it. For more info, see the
  1.0.13 release notes in the NEWS file.
* Also update copyright notice

12 years agoSamples: Display VID:PID of the tested device in xusb
Ludovic Rousseau [Thu, 13 Sep 2012 13:50:43 +0000 (15:50 +0200)]
Samples: Display VID:PID of the tested device in xusb

* Also amend the wording of the "no option" comment.
* Closes #42

12 years agoWindows: Switch to ALLOW_PARTIAL_READS pipe policy enabled by default
Pete Batard [Thu, 13 Sep 2012 23:10:57 +0000 (00:10 +0100)]
Windows: Switch to ALLOW_PARTIAL_READS pipe policy enabled by default

* This avoids an issue when libusbK is used for bulk transfers, which
  is most likely due to a libusbK bug
* See https://sourceforge.net/mailarchive/message.php?msg_id=29736015

12 years agoSamples: Add fxload sample for Cypress EZ-USB chips
Pete Batard [Tue, 11 Sep 2012 00:01:07 +0000 (01:01 +0100)]
Samples: Add fxload sample for Cypress EZ-USB chips

* This program was modified from the original fxload at:
  http://linux-hotplug.sourceforge.net to add libusbx
  as well as non HEX images support.
* Only supports RAM upload for now, with EEPROM and FX3
  support to be added at a later stage.

12 years agoAll: Avoid polluting errors reported on device disconnect
Hans de Goede [Wed, 12 Sep 2012 01:03:47 +0000 (02:03 +0100)]
All: Avoid polluting errors reported on device disconnect

* Makes libusb_cancel_transfer not log an error when the cancel fails
  with LIBUSB_ERROR_NO_DEVICE, so that apps can properly clean things
  up on device disconnect without flooding the console with these errors.
* Also, some devices (Cypress FX) may switch VID:PID on the fly during
  firmware upload => reduce severity of the Windows message when that happens.

12 years agoDoc: Update logging documentation regarding stderr usage
Pete Batard [Mon, 10 Sep 2012 23:17:39 +0000 (00:17 +0100)]
Doc: Update logging documentation regarding stderr usage

12 years agoWindows: Fix handling of composite devices
Pete Batard [Wed, 5 Sep 2012 21:51:19 +0000 (22:51 +0100)]
Windows: Fix handling of composite devices

* Pass missing sub_api parameter to set_composite_interface() and
  composite_submit_control_transfer()
* Remove api_flags attribute, that cannot apply for multiple interfaces
* Also simplifies the internal ENUM_DEBUG mode
* Also move polluting info logging message to debug

12 years agoSamples: xusb improvements
Pete Batard [Mon, 3 Sep 2012 19:43:18 +0000 (20:43 +0100)]
Samples: xusb improvements

* update and fix usage details
* make topology and speed printout optional (option -i)
* remove unneeded option -g

12 years agoWindows: Suppress unwanted error message on filter driver
Pete Batard [Sun, 26 Aug 2012 23:16:00 +0000 (00:16 +0100)]
Windows: Suppress unwanted error message on filter driver

* Interface access error message was unconditional, even if the
  filter driver was found later on.

12 years agoLinux: Return ERROR_NOT_FOUND in detach-kernel-driver if usbfs is already bound
Hans de Goede [Wed, 22 Aug 2012 10:47:00 +0000 (11:47 +0100)]
Linux: Return ERROR_NOT_FOUND in detach-kernel-driver if usbfs is already bound

* Currently applications for devices which only are accessed from userspace
  can use claim / release interface to make sure they don't get in each others
  way.
* The same however does not work for applications which first need to detach
  a "native" / in kernel driver, as this detach will not only detach native
  drivers but also the usbfs driver, thus stealing the device from another
  userspace / libusbx app.
* This patch fixes libusb_detach_kernel_driver to only detach "real" kernel
  drivers and not the special usbfs driver used for userspace access to
  USB devices. If the usbfs driver is found LIBUSB_ERROR_NOT_FOUND will be
  returned to indicate no driver was detached.

12 years agoLinux: Avoid unnecessary splitting of bulk transfers
Hans de Goede [Wed, 22 Aug 2012 10:47:00 +0000 (11:47 +0100)]
Linux: Avoid unnecessary splitting of bulk transfers

* With the latest kernels it is no longer needed to always split large bulk
  transfers into multiple urbs. This patch takes advantage of this by not
  splitting when not necessary. Note that the non-split code path is in essence
  using the old split code path with an urb count which is always 1.
* This leads to more sane handling of large transfers with recent kernels,
  although our splitting code is well tested, not splitting at all still is
  a lot better :)
* When used with a recent kernel, this also fixes the problems, on XHCI attached
  devices, when a large bulk-in transfer ends with a short read in an urb other
  then the last urb.
* For more on this see: http://marc.info/?l=linux-usb&m=133797554910355

12 years agoLinux: Add support for the new get_capabilities ioctl
Hans de Goede [Wed, 22 Aug 2012 10:47:00 +0000 (11:47 +0100)]
Linux: Add support for the new get_capabilities ioctl

* There were a few (new) usbdevfs capabilities which libusbx could not
  discover in any other way then checking the kernel version.
* However, this presents the following problems:
  1) It is just not very pretty
  2) Given the tendency of enterprise distros to backport stuff it is not
     reliable
  3) Some of these features turn out to not work with certain host controllers,
     making depending on them based on the kernel version not a good idea
* Therefore a new USBDEVFS_GET_CAPABILITIES ioctl has been added to the kernel
  to offer a better way to find out a device's capabilities (technically
  the capabilities of the host controller to which the device is attached,
  but that does not matter).

12 years agoCore: Handle >= 1 second transfer timeout in libusb_submit_transfer()
Peter Stuge [Wed, 22 Aug 2012 08:32:10 +0000 (01:32 -0700)]
Core: Handle >= 1 second transfer timeout in libusb_submit_transfer()

* Comparisons between tv_nsec and 1 sec should be >= rather than >,
  as we can end up in situations where tv_nsec is exactly 1000000000,
  which calls such as timerfd_create() do not accept.
* Issue reported by Sebastian K. See:
  https://sourceforge.net/mailarchive/message.php?msg_id=29706972

12 years agoMisc: Update and shorten various libusbx URLs
Pete Batard [Wed, 22 Aug 2012 20:42:21 +0000 (21:42 +0100)]
Misc: Update and shorten various libusbx URLs

12 years agoWindows: Add support for 2nd gen Renesas USB 3.0 controllers
Nicholas Corgan [Mon, 20 Aug 2012 20:32:24 +0000 (13:32 -0700)]
Windows: Add support for 2nd gen Renesas USB 3.0 controllers

* Driver version 3.0.20.0 for uPD720201 & uPD720202 uses RUSB3HUB
* Closes #40

12 years agoWindows: Add libusbk.sys & libusb0.sys driver support
Pete Batard [Sun, 19 Aug 2012 22:40:42 +0000 (23:40 +0100)]
Windows: Add libusbk.sys & libusb0.sys driver support

* Both libusbk and libusb0.sys rely on libusbk.dll being
  installed to provides a WinUSB-like API for driver access.
* In case libusbk.dll is not present, fall back to WinUSB.
* Closes #11
* Closes #12

12 years agoWindows: Fix C4005 warning under VS2012 for inline.
Anthony Clay, ZarthCode LLC [Sun, 19 Aug 2012 19:19:40 +0000 (14:19 -0500)]
Windows: Fix C4005 warning under VS2012 for inline.

* Changed inline macro to not fire when using Visual Studio/C++,
  which attempts to redefine the macro - resulting in a C4005 warning.

12 years agoSamples: Make target mandatory with -b option in xusb
Pete Batard [Sun, 12 Aug 2012 21:57:10 +0000 (22:57 +0100)]
Samples: Make target mandatory with -b option in xusb

12 years agoCore: Improve instrumentation of timerfd_settime failures
Pete Batard [Sun, 12 Aug 2012 21:37:02 +0000 (22:37 +0100)]
Core: Improve instrumentation of timerfd_settime failures

* Report errno as well as itimerspec data
* Also reuse the timeout variable set to &transfer->timeout

12 years agoCore: Fix a Clang warning in io.c
Pete Batard [Tue, 7 Aug 2012 12:36:16 +0000 (13:36 +0100)]
Core: Fix a Clang warning in io.c

* Using sizeof() in the UNUSED() macro didn't silence all
  unused variable warnings.
* Also fix an "unused ctx" warning when ENABLE_DEBUG_LOGGING is on
* Also improve debug output on libusb_open() failure

12 years agoWindows: Add workaround for Intel USB 3.0 root hubs
Matthias Bolte [Sat, 28 Jul 2012 19:24:31 +0000 (21:24 +0200)]
Windows: Add workaround for Intel USB 3.0 root hubs

* Intel USB 3.0 root hubs are similar to the Nec/Renesas USB 3.0 root
  hubs as they aren't listed under "USB" either but under "IUSB3".
* Extend the existing workaround for Nec/Renesas USB 3.0 root hubs to
  handle the Intel ones as well.
* Closes #39

12 years agoCore: Fix unconditional disarming of timerfd
Pete Batard [Tue, 10 Jul 2012 00:59:45 +0000 (01:59 +0100)]
Core: Fix unconditional disarming of timerfd

* Existing code appears disarms the timerfd always, which cancels
  pending timeouts as soon as one packet completes.
* This fix moves the disarming of the timerfd to
  arm_timerfd_for_next_timeout(), where it is now done conditionally.
  It also avoids calling disarm outside of the above call.
* This patch also ensures that all handling of the timerfd is done
  under the flying transfers lock.
* Issue reported by Hans de Goede. For more info, see:
  https://sourceforge.net/mailarchive/message.php?msg_id=29442693

12 years agoCore: NULL list pointers on deletion
Orin Eman [Fri, 3 Aug 2012 13:21:45 +0000 (14:21 +0100)]
Core: NULL list pointers on deletion

* This aims at highlighting unwanted behaviours on list operations,
  and facilitate early detection of potential bugs.
* This also requires a fix in threads_windows.c
* See http://sourceforge.net/mailarchive/message.php?msg_id=29626351

12 years agoMisc: Add a readme for git user
Pete Batard [Wed, 1 Aug 2012 16:43:33 +0000 (17:43 +0100)]
Misc: Add a readme for git user

* Suggested by Yves Arrouye:
  http://sourceforge.net/mailarchive/message.php?msg_id=29577839

12 years agoWindows: Set device number for root hubs to 1
Pete Batard [Wed, 18 Jul 2012 17:25:11 +0000 (18:25 +0100)]
Windows: Set device number for root hubs to 1

* Other platforms (Linux, OS-X) appear to use 1 => follow suit.
* For non root hub devices, we simply increment the USB device address.
* Collisions with device address 0 are not expected, but we add
  an assertion for just in case.

12 years agoWindows: Fix overflow when handling HID or composite devices
Pete Batard [Tue, 17 Jul 2012 16:36:13 +0000 (17:36 +0100)]
Windows: Fix overflow when handling HID or composite devices

* When libusb_get_device_list() is called mutliple times, the HID device
  path was unconditionally duplicated in the list of device's interfaces.
* Because array boundaries were not checked, this caused overflow and crash.
* This patch adds an out of bound check and also ensures that duplication
  of data, for HID and composite, does not occur
* It also renames the private composite_api_flags to api_flags, as well as
  reorganizes the private attributes
* Bug report and part of the fix provided by Toby Gray

12 years agoWindows: usbi_cond_destroy() should free handles created by usbi_cond_intwait().
Simon Haggett [Tue, 10 Jul 2012 15:07:45 +0000 (16:07 +0100)]
Windows: usbi_cond_destroy() should free handles created by usbi_cond_intwait().

* Without this change every call to usbi_cond_destroy() leaks an event handle.

12 years agoAll: Replace malloc+memset with calloc
Davidlohr Bueso [Wed, 11 Jul 2012 12:53:00 +0000 (13:53 +0100)]
All: Replace malloc+memset with calloc