1328 Commits

Author SHA1 Message Date
Nathan Hjelm
fde20bb9b7 configure.ac: bump .so version for next release
Signed-off-by: Nathan Hjelm <hjelmn@lanl.gov>
2018-12-05 10:36:50 -07:00
Nathan Hjelm
15239f6b8a Update ChangeLog
Signed-off-by: Nathan Hjelm <hjelmn@lanl.gov>
2018-12-05 10:36:20 -07:00
Alexander Pyhalov
2830d9e9f0 usbi_dbg() uses backend's clock_gettime(), break recursion in sunos backend
Closes #431

Signed-off-by: Nathan Hjelm <hjelmn@lanl.gov>
2018-12-05 10:14:05 -07:00
Victor Toso
fcf9a53595 examples: Fix format-truncation on debug
As description is used only for debug, we can extend it to be sure to
fit 256 from string variable plus 3 chars from " - " as described in
gcc warning below

 | testlibusb.c: In function ‘print_device.constprop’:
 | testlibusb.c:188:51: warning: ‘ - ’ directive output may be truncated writing 3 bytes into a region of size between 1 and 256 [-Wformat-truncation=]
 |      snprintf(description, sizeof(description), "%s - ", string);
 |                                                    ^~~
 | testlibusb.c:188:5: note: ‘snprintf’ output between 4 and 259 bytes into a destination of size 256
 |      snprintf(description, sizeof(description), "%s - ", string);
 |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Closes #460

Signed-off-by: Victor Toso <victortoso@redhat.com>

Signed-off-by: Nathan Hjelm <hjelmn@lanl.gov>
2018-12-05 10:13:08 -07:00
Alexander Pyhalov
e8e80368b7 Enable timerfd on sunos when available
Closes #432

Signed-off-by: Nathan Hjelm <hjelmn@lanl.gov>
2018-12-05 10:11:24 -07:00
gudenau
18a5f99ad3 Add missing libusb_exit on an error condition
Closes #448

Signed-off-by: Nathan Hjelm <hjelmn@lanl.gov>
2018-12-05 10:09:12 -07:00
Bence Cs
31d59d8ced Hungarian translation
Closes #493

Signed-off-by: Nathan Hjelm <hjelmn@lanl.gov>
2018-12-05 10:05:20 -07:00
saur0n
4441da3f57 Fixed typo in the documentation
Closes #496

Signed-off-by: Nathan Hjelm <hjelmn@lanl.gov>
2018-12-05 10:04:27 -07:00
dmitrykos
f74c7f5398 core: new API libusb_set_log_cb() to redirect global and per context log messages to the provided log handling function
Closes #486

Signed-off-by: Nathan Hjelm <hjelmn@lanl.gov>
2018-12-05 09:58:16 -07:00
Nathan Hjelm
270bef4002 update nano
Signed-off-by: Nathan Hjelm <hjelmn@lanl.gov>
2018-10-22 14:04:04 -06:00
Alexander Schlarb
4896e24aea Add German translation
Most strings were copied from the german `strerror` output on equivallent `errno` values and then adapted as necessary.

Closes #446

Signed-off-by: Nathan Hjelm <hjelmn@lanl.gov>
2018-10-22 14:01:51 -06:00
Baruch Siach
552a4a49af configure.ac: fix detection of clock_gettime library
glibc before 2.17 requires link with librt for clock_gettime(). The
AC_SEARCH_LIBS check in configure.ac should detect this dependency.
Unfortunately commit cb77a25e51 (configure.ac: Remove obsolete AC_ERROR
and make formatting consistent) inadvertently renamed to clock_gettime2,
thus breaking librt detection.

Restore the correct clock_gettime() name.

Closes #439

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Nathan Hjelm <hjelmn@lanl.gov>
2018-10-22 13:56:15 -06:00
Nathan Hjelm
044a7eeb75 os/darwin: remove code that changed the device class used
To support macOS El Capitan I added some code to change from using the
IOUSBDevice class to using IOUSBHostDevice. This looked necessary as
Apple had re-writed IOUSBFamily and IOUSBHostDevice was the new base
class name. The problem is that using the new class misses some
devices in more recent versions of macOS. Apple is still including the
IOClassNameOverride property (as of macOS Mojave) so it is still safe
to search using the IOUSBDevice class. We will need to find a
different class if Apple ever removes the IOClassNameOverride
property from USB devices.

Closes #428

Signed-off-by: Nathan Hjelm <hjelmn@mac.com>
2018-10-17 12:06:31 -06:00
Nathan Hjelm
c14ab5fc4d os/darwin: switch from using ResetDevice to USBDeviceReEnumerate
In newer versions of macOS the ResetDevice function does nothing. For
these systems we have to use USBDeviceReEnumerate. This should also
work for older versions os MacOS X.

Fixes #455

Signed-off-by: Nathan Hjelm <hjelmn@lanl.gov>
2018-07-26 13:42:38 -06:00
Stephen
5912d561a7 Move to brew bundle
improved dependency management with brew bundle
2018-07-09 14:30:55 -06:00
Chris Dickens
0034b2afdc libusb 1.0.22
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
v1.0.22
2018-03-24 17:43:43 -07:00
Chris Dickens
f69255217c examples: testlibusb: Fix DDK build warning
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
2018-03-24 17:42:46 -07:00
Chris Dickens
dc5e33e382 Windows: Add back resource and definition files to VS DLL projects
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
2018-03-20 10:01:48 -07:00
Chris Dickens
b0fcdea99f libusb 1.0.22-rc4
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
v1.0.22-rc4
2018-03-17 00:21:14 -07:00
Chris Dickens
2da989c2a0 Windows: WinUSB: Allow caching config descriptors to fail
Certain buggy devices may not provide all the advertised configuration
descriptors. Prior to this commit, failure to cache any one of the
descriptors would result in all of the descriptors being freed and the
device being inaccessible. Work around this by continuing on if fetching
a configuration descriptor fails. The device may still be usable if the
descriptor for the current configuration was successfully retrieved.

Closes #390

Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
2018-03-17 00:15:20 -07:00
Chris Dickens
0aac390bb2 Windows: Restructure DDK/MSVC project files
For simplicity and to address some build warnings, this commit reworks
the project files to eliminate duplication and consolidate common build
flags and options. Also adds the stress and testlibusb projects to the
DDK build script.

Closes #402

Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
2018-03-12 10:39:26 -07:00
Chris Dickens
d236b63e81 Windows: WinUSB: Guard against erroneous reporting of devices
During enumeration, obtaining the port number via SPDRP_ADDRESS might
return a bogus value for some third-party HCD drivers. If this occurs,
we might end up reporting the device as having the VID/PID from the last
successful enumeration. Guard against this particular situation by
clearing the USB_NODE_CONNECTION_INFORMATION_EX structure before issuing
the DeviceIoControl() call.

References #403

Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
2018-03-12 10:28:40 -07:00
Chris Dickens
76b0677b14 Windows: UsbDk: Fix potential buffer overflow
Closes #397

Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
2018-03-12 10:25:02 -07:00
Chris Dickens
81ce8be59b Windows: WinUSB: Do not assume that driver implements CancelIoEx()
Cancelling an individual OVERLAPPED I/O operation is something that a
driver can optionally implement. It appears that the native WinUSB
driver supports this but libusbK does not. Therefore we will attempt
to use it and fall back to the AbortPipe() call if an error occurs.

Closes #400

Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
2018-03-12 10:24:04 -07:00
Chris Dickens
828ec95424 Windows: Plug HANDLE leak
Restore a CloseHandle() call that was mistakenly removed during a merge
conflict resolution.

Closes #404

Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
2018-03-12 09:54:33 -07:00
Chris Dickens
8681342edc libusb 1.0.22-rc3
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
v1.0.22-rc3
2018-02-24 02:02:34 -08:00
Chris Dickens
8e03a6586c Windows: UsbDk: Implement get_config_descriptor_by_value()
This fixes a NULL pointer dereference when the user selects the UsbDk
backend and subsequently calls libusb_get_config_descriptor_by_value().

Closes #395

Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
2018-02-24 02:02:03 -08:00
zachary
8551e4a7a2 Windows: Fix hid_abort_transfers blocking
Closes #392

Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
2018-02-24 00:03:43 -08:00
Patrick Stewart
32617df714 Windows: Fix race condition between submit and handle events
Check the event object for completion in poll instead of using
HasOverlappedIoCompleted. When we submit a transfer on Windows the fd is
added to the poll list before the read/write begins, so
HasOverlappedIoCompleted can be called before overlapped.Internal is set
to ERROR_IO_PENDING if events are being being handled concurrently, so
the fd will be marked as completed before it has actually started.

[dickens] Instead of replacing HasOverlappedIoCompleted, supplement it
so that it can provide a fast path to avoid WaitForSingleObject() in
the general case

Closes #386, Closes #387

Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
2018-02-23 23:55:52 -08:00
Chris Dickens
cd7aeec8e7 Windows: Always search for "USB" PnP enumerator class
On systems running Windows 7 and earlier that only have a USB 3.0 host
controller, devices may not be listed correctly if the root hub PnP
enumerator is anything other than "USB". This regression was introduced
in the recent enumeration refactoring (commit 71a779d07).

Closes #385

Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
2018-02-01 23:31:18 -08:00
Chris Dickens
8ddd8d994d libusb 1.0.22-rc2 v1.0.22-rc2 2018-01-27 17:29:46 -08:00
Chris Dickens
4687401350 Windows: Regenerate libusb-1.0.def file from latest DLL
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
2018-01-27 17:27:53 -08:00
Chris Dickens
e5a7bb548a Windows: Check composite interfaces before calling functions
Commit c4438b3c introduced a regression by failing to check for the
presence of a function in the backend when called on a composite device.
Fix this by introducing a new helper macro and checking for function
pointers at all necessary locations.

Closes #383

Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
2018-01-27 16:22:10 -08:00
Chris Dickens
84209b4fb5 libusb 1.0.22-rc1
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
v1.0.22-rc1
2018-01-08 23:08:47 -08:00
Sean McBride
fef88bf2b9 darwin: Improve error checking to prevent (very unlikely) null dereference
Defend against the very unlikely possibility of CFNumberCreate() returning null.

Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
2018-01-08 22:11:40 -08:00
Sean McBride
4f9d58564e darwin: Suppress deprecation warning when building against 10.13 SDK
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
2018-01-08 22:11:04 -08:00
Sean McBride
c8069cd8c9 darwin: Test use of kUSBDeviceSpeedSuper against SDK version
Closes #362

Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
2018-01-08 22:10:12 -08:00
Sean McBride
3f6a48d00e darwin: extend enum libusb_speed for 10000MBit/s case
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
2018-01-08 22:08:04 -08:00
Chris Dickens
03f100869e linux_usbfs: Add support for reporting super speed plus devices
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
2018-01-08 22:04:56 -08:00
Chris Dickens
7a91d7cdcc core: Add definition for LIBUSB_SUPER_SPEED_PLUS (10Gb/s)
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
2018-01-08 22:03:49 -08:00
Joshua Blake
55ced7746d Windows: Added isochronous support via libusbk
[dickens] Rebased against latest changes and fixed some styling issues

Closes #246

Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
2018-01-08 21:55:47 -08:00
Chris Dickens
ca0b6c09fa Fix appveyor scripts for Cygwin and MinGW to build as intended
The sub-directory created to store the generated files and build objects
was not being used as intended, because each invocation of the bash
starts in the home directory. Fix this by changing to the intended
directory prior to each command invocation.

Also replace the invocation of autogen.sh with bootstrap.sh, since using
autogen.sh calls ./configure and we weren't using the results of that
work. Instead we call configure directly from the sub-directory while
enabling the examples and test builds (for Cygwin) as autogen.sh would do.

Also fix the invalid value for the --build option provided to the x64
build of MinGW.

Finally, propagate errors from each script command so that failures are
caught and reported.

Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
2018-01-08 21:03:50 -08:00
Chris Dickens
d88c58eb5b Windows: Fix MinGW build warnings/errors
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
2018-01-08 12:31:55 -08:00
Sean McBride
678a43bcf3 core: Fixed clang -Wcomma warning
Fixes:

descriptor.c:1179:13: Possible misuse of comma operator here

Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
2018-01-08 10:33:47 -08:00
Sean McBride
297238cda8 darwin: Changed weirdo fixed-sized typedefs with the usual IOUSBLib.h ones
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
2018-01-08 10:33:40 -08:00
Sean McBride
d2ebbf793c darwin: Untangle clock_* API tests from atomics tests
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
2018-01-08 10:29:45 -08:00
Sean McBride
860657126e darwin: Replaced low-level mach API with pthread API
Found this because clang was warning that the return value was being
converted from unsigned to signed.

The need for a mach API surprised me, and I found this alternative
formulation in a Chromium bug:

https://groups.google.com/forum/#!topic/native-client-reviews/z---hlHbQNc

which describes: "mach_thread_self() needs to be balanced by mach_port_deallocate(),
which is two system calls. pthread_mach_thread_np(pthread_self()) is two libc
function calls and no system calls, because pthread caches the Mach port."

Fixed the conversion warning too, with a cast.

Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
2018-01-08 10:28:16 -08:00
Sean McBride
0f59214f12 darwin: Cleanup and fixes related to Mac OS IOUSBLib interface checks
- revisited fix to issue #48:
  - guard kIOUSBDeviceInterfaceID500 with 10.8 deployment (not 10.9).
    I believe a typo in the bug report caused this to be guarded too
    strictly.
  - added deployment target tests to every interface check. Necessary
    because merely checking for a macro definition tells us nothing
    about what features are available at runtime. It is common to build
    against new SDKs but deploy to older OSes.
- properly guard kIOUSBInterfaceInterfaceID700 against 10.10 deployment
  (not 10.9).  It was added in 10.10.  Probably a copy-pasto.
- changed non-existent kIOUSBDeviceInterfaceID220 to
  kIOUSBDeviceInterfaceID197.  Probably a copy-pasto.
- don't use defines like MAC_OS_X_VERSION_10_9 since they don't exist in
  older SDKs and would fail to compile, use raw numbers instead.
- added tests for newer interfaces: kIOUSBInterfaceInterfaceID800,
  kIOUSBInterfaceInterfaceID650, kIOUSBDeviceInterfaceID650.

Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
2018-01-08 10:26:07 -08:00
Sean McBride
3bffd5ca31 Added some Xcode-related items to .gitignore
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
2018-01-08 10:25:45 -08:00
Sean McBride
6bd5658dd7 darwin: Configure Xcode project to specify tab/space, indent amount
All source files are now tagged as using tabs of 4 spaces, except
darwin_usb.c and darwin_usb.h which use spaces of 2 spaces. This allows
editing files in Xcode without it messing up any particular files.

Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
2018-01-08 10:25:13 -08:00