Skip to content

Commits

Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Commits on Sep 10, 2020

  1. examples/testlibusb: Print speed of devices

    Print the speed of devices to exercise libusb_get_device_speed().
    
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>
    jwrdegoede committed Sep 10, 2020
    Copy the full SHA
    595e748 View commit details
    Browse the repository at this point in the history
  2. examples/testlibusb: Add support for testing libusb_wrap_sys_device()

    Sometimes it is useful to be able to test libusb_wrap_sys_device(),
    add support for this to the testlibusb example
    
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>
    jwrdegoede committed Sep 10, 2020
    Copy the full SHA
    16ed427 View commit details
    Browse the repository at this point in the history
  3. linux: Fix libusb_get_device_speed() not working on wrapped devices

    We don't have a sysfs_dir for wrapped devices, so we cannot read the speed
    from sysfs.
    
    The Linux kernel has supported a new ioctl to get the speed directly from
    the fd for a while now, use that when we don't have sysfs access.
    
    Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1871818
    Reported-by: Gerd Hoffmann <kraxel@redhat.com>
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>
    jwrdegoede committed Sep 10, 2020
    Copy the full SHA
    bf14780 View commit details
    Browse the repository at this point in the history

Commits on Aug 25, 2020

  1. events_posix: Remove unnecessary and incorrect assertion

    Thomas Chiantia reports that the POSIX events abstraction is failing
    periodically because of incorrect assertion logic. Remove it as there is
    another (correct) check further into the function that will serve check
    the intended condition.
    
    Closes #775
    
    Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
    dickens committed Aug 25, 2020
    Copy the full SHA
    4b64ecc View commit details
    Browse the repository at this point in the history

Commits on Aug 24, 2020

  1. core: Ensure that reported event bits are initialized

    Closes #774
    
    Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
    dickens committed Aug 24, 2020
    Copy the full SHA
    8377269 View commit details
    Browse the repository at this point in the history

Commits on Aug 23, 2020

  1. Exchange README.md and README

    Make README the real file and README.md the symbolic link to fix an
    installation issue with npm packaging tool.
    
    Fixes libusb/libusb#772
    " README file not included with npm packaging tools #772 "
    
    Signed-off-by: Ludovic Rousseau <ludovic.rousseau@free.fr>
    LudovicRousseau committed Aug 23, 2020
    Copy the full SHA
    95a2606 View commit details
    Browse the repository at this point in the history

Commits on Aug 18, 2020

  1. Fix typos detected by codespell and manual inspection

    Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
    dickens committed Aug 18, 2020
    Copy the full SHA
    0abebc5 View commit details
    Browse the repository at this point in the history
  2. Documentation: Specify the constraint of the 'completed' parameter

    Closes #482
    
    Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
    dickens committed Aug 18, 2020
    Copy the full SHA
    5671fc4 View commit details
    Browse the repository at this point in the history
  3. Documentation: Update the Windows binary snapshot README regarding UsbDk

    Closes #443
    
    Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
    dickens committed Aug 18, 2020
    Copy the full SHA
    c6a6882 View commit details
    Browse the repository at this point in the history
  4. Documentation: Add details regarding thread-safety

    Closes #352
    
    Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
    dickens committed Aug 18, 2020
    Copy the full SHA
    e83522e View commit details
    Browse the repository at this point in the history
  5. Documentation: Improve details of libusb_transfer's 'user_data' field

    Closes #351
    
    Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
    dickens committed Aug 18, 2020
    Copy the full SHA
    666647f View commit details
    Browse the repository at this point in the history
  6. Documentation: Add a note regarding the execution context of callbacks

    Make it more clear that callbacks are only called when
    libusb_handle_events() is called and that all callbacks will be called
    on the same thread calling that function.
    
    Closes #349
    
    Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
    dickens committed Aug 18, 2020
    Copy the full SHA
    b484f84 View commit details
    Browse the repository at this point in the history
  7. Documentation: Add details regarding timeouts and partial transfer of…

    … data
    
    Closes #348
    
    Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
    dickens committed Aug 18, 2020
    Copy the full SHA
    6baa323 View commit details
    Browse the repository at this point in the history
  8. Documentation: Add section regarding transfer length limitations

    Closes #204
    
    Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
    dickens committed Aug 18, 2020
    Copy the full SHA
    351ad49 View commit details
    Browse the repository at this point in the history
  9. Windows: Update INSTALL_WIN.txt

    Add info regarding where the 'INSTALL' file comes from.
    
    Remove link for Windows SDKs as this is no longer relevant.
    
    Update to account for Visual Studio 2019.
    
    Closes #235
    
    Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
    dickens committed Aug 18, 2020
    Copy the full SHA
    178e433 View commit details
    Browse the repository at this point in the history
  10. Autotools: Use built-in shell tests and exec autoreconf

    Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
    dickens committed Aug 18, 2020
    Copy the full SHA
    ee089f2 View commit details
    Browse the repository at this point in the history
  11. Windows: Fix I/O completion port thread behavior on error

    The GetQueuedCompletionStatus() returns FALSE when the I/O operation
    itself does not complete successfully. The I/O completion thread should
    therefore not exit on this condition. Adjust the check to verify that an
    OVERLAPPED structure was provided and use an explicit completion key
    value in the exit path to disambiguate receiving a valid NULL OVERLAPPED
    pointer.
    
    Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
    dickens committed Aug 18, 2020
    Copy the full SHA
    37e8b13 View commit details
    Browse the repository at this point in the history

Commits on Aug 17, 2020

  1. Windows: Improve how root hubs are reported

    Microsoft provides very little information about the actual root hub
    characterstics beyond the number of ports. Determining the maximum
    supported speed of the root hub is not directly possible but instead
    requires that a device matching the highest speed of the root hub is
    connected. Additionally, Windows 8 or later is required for _any_
    successful detection of SuperSpeed devices.
    
    One other inconvenience is that there are no descriptors exposed for
    root hubs. This does not fit well with the structure of the library
    because root hubs are considered first-class devices.
    
    This change addresses some of these shortcomings. Each root hub is now
    given a configuration descriptor that is matched to the fastest speed
    detected for the root hub. The information is most accurate on Windows 8
    or later, but the best information possible is constructed on earlier
    versions. The device descriptor is also adjusted accordingly based on
    the detected speed.
    
    This solution is not perfect but is better than the status quo.
    
    Closes #688
    
    Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
    dickens committed Aug 17, 2020
    Copy the full SHA
    d42410b View commit details
    Browse the repository at this point in the history
  2. Windows: Prevent NULL pointer dereference when ancestor is missing

    A buggy virtual USB device driver can cause the device enumeration
    process to fail during the init_device() function when trying to
    determine the bus number of the device. Guard against this by checking
    that the ancestor device was actually found and skipping the bogus
    device when there is no ancestor.
    
    Closes #491
    
    Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
    dickens committed Aug 17, 2020
    Copy the full SHA
    aa6ec9d View commit details
    Browse the repository at this point in the history

Commits on Aug 13, 2020

  1. descriptor: Miscellaneous improvements to the overall source

    Introduce union types that simplify working with descriptors. Previously
    there were simple arrays declared on the stack and these were either
    parsed into the target descriptor structure or were accessed with magic
    offsets into the array. Using the union type allows the descriptors to
    be read with the need to parse it into a separate structure.
    
    Fix a memory leak that would occur in the interface parsing code if the
    usbi_reallocf() function failed. Each interface has a separately
    allocated array of endpoints and potential extra descriptors. These
    cannot be freed when using usbi_reallocf(), so switch to use realloc().
    
    Fix an obscure limitation where extra descriptors would not be appended
    to the configuration is any previous extra descriptors had already been
    found.
    
    Make the error checking and error messages consistent across all the
    parsing functions. This includes printing unknown or unexpected
    descriptor types in hex format, which is often easier to lookup as most
    specifications use hex notation.
    
    Constify the input buffer argument to the parsing functions.
    
    Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
    dickens committed Aug 13, 2020
    Copy the full SHA
    fa3f91e View commit details
    Browse the repository at this point in the history
  2. core: Optimize check for pending events

    Prior to this commit, a check for whether any events are pending
    involved checking four different variables within the context. Optimize
    this by using multiple bits within a single unsigned integer to
    represent all the possible events that could be pending. This reduces
    the check for whether any events are pending to a single load.
    
    Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
    dickens committed Aug 13, 2020
    Copy the full SHA
    7b5e31b View commit details
    Browse the repository at this point in the history
  3. core: Add support for eventfd

    On systems that support it, using an eventfd for simple signalling is
    much more efficient than using a pipe. Add detection of eventfd to the
    configure script and wire it up in the POSIX event abstraction.
    
    Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
    dickens committed Aug 13, 2020
    Copy the full SHA
    b40a26f View commit details
    Browse the repository at this point in the history

Commits on Aug 12, 2020

  1. core: Introduce platform events abstraction

    The way in which system handles or resources are represented differs
    greatly between Unix-like operating systems and Windows. Ever since
    Windows support was added to libusb, Windows been emulating principles
    of Unix-like operating systems such as file descriptors and poll().
    
    This commit introduces an abstraction layer that completely removes the
    need to perform any emulation. Fundamentally there are three things that
    each platform provides to libusb:
    
      1) A signallable event
      2) A timer (not required, but useful)
      3) A means to wait for event sources such as the above to be triggered
    
    The POSIX abstraction for Unix-like operating systems uses file
    descriptors as the "handles" to the underlying system resources. The
    signallable event is implemented using a pipe, the timer as a timerfd
    (where supported) and the poll() system call is used to wait for events.
    
    The Windows abstraction uses native HANDLEs as the "handles" to the
    underlying system resources. The signallable event is implemented using
    a manual-reset event, the timer as a manual-reset waitable timer, and
    the WaitForMultipleObjects() system call is used to wait for events.
    
    Closes #252
    
    Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
    dickens committed Aug 12, 2020
    Copy the full SHA
    d67eb5b View commit details
    Browse the repository at this point in the history

Commits on Aug 11, 2020

  1. Windows: Use I/O completion ports for transfers

    As a first step in removing the Windows poll() emulation, switch the
    transfers to use an I/O completion port. A dedicated per-context thread
    will wait on the I/O completion port and report transfer completions
    using usbi_signal_transfer_completion(). This enables the complete
    removal of the handle_events() function for the Windows backend and
    removes the notion of one "file descriptor" per transfer.
    
    Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
    dickens committed Aug 11, 2020
    Copy the full SHA
    ba6b8bc View commit details
    Browse the repository at this point in the history
  2. core: Introduce list iteration helpers

    The syntax for traversing over lists is somewhat cluttered. It could be
    made much better with the use of the 'typeof' keyword, but unfortunately
    this is not universally supported by all compilers. We can, however,
    improve the situation by introducing some macros for the common cases.
    To that end, this commit introduces a number of 'for_each' macros that
    iterate over a specific linked list.
    
    Current syntax:
    
      list_for_each_entry(itransfer, &ctx->flying_transfers, list, struct usbi_transfer)
    
    New syntax:
    
      for_each_transfer(ctx, itransfer)
    
    Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
    dickens committed Aug 11, 2020
    Copy the full SHA
    9576ad4 View commit details
    Browse the repository at this point in the history

Commits on Aug 10, 2020

  1. OpenBSD: support libusb_get_port_number

    From mpi@openbsd.org
    
    Fixes #314
    Closes #764
    
    Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
    botovq authored and dickens committed Aug 10, 2020
    Copy the full SHA
    96898a2 View commit details
    Browse the repository at this point in the history
  2. OpenBSD: allow opening ugen devices multiple times

    Fix an OpenBSD backend bug where an existing open file descriptor is
    overwritten if a libusb user attempts to open the same ugen(4) device
    multiple times. This was observed with sane-backends and broke scanning.
    
    Fix from stsp@openbsd.org
    
    Closes #763
    
    Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
    botovq authored and dickens committed Aug 10, 2020
    Copy the full SHA
    94519df View commit details
    Browse the repository at this point in the history
  3. API docs: Elaborate on "NOT_SUPPORTED" status for set_configuration()

    Closes #762
    
    Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
    thierer authored and dickens committed Aug 10, 2020
    Copy the full SHA
    7b2578e View commit details
    Browse the repository at this point in the history
  4. libusb: fix a memory leak in sunos_new_string_list func

    In sunos_new_string_list func, if alloc list->string fails,
    we will return NULL without free list, which has alread been
    allocated successfully.
    
    Fixes: 1734873 ('Solaris backend depends on Solaris private symbols')
    
    Closes #756
    
    Signed-off-by: Zhiqiang Liu <lzhq28@mail.ustc.edu.cn>
    Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
    Zhiqiang Liu authored and dickens committed Aug 10, 2020
    Copy the full SHA
    f85dfa6 View commit details
    Browse the repository at this point in the history
  5. stress: test_get_device_list: change printf format for ssize_t

    The type of list_size is ssize_t.
    First idea was to use "%zd" printf format specifier.
    But that is not supported by Visual Studio 2013.
    
    Use "%ld" + cast list_size to long.
    
    Closes #751
    
    Suggested-by: Chris Dickens <christopher.a.dickens@gmail.com>
    Signed-off-by: Uri Lublin <uril@redhat.com>
    Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
    uril authored and dickens committed Aug 10, 2020
    Copy the full SHA
    ab68ed4 View commit details
    Browse the repository at this point in the history
  6. descriptor: Fix alignment for 32-bit words in parse_descriptor

    parse_descriptor was aligning 32-bit words to 2 bytes, instead of 4
    bytes. This didn't cause any issues before, because the only time the
    32-bit word code path is used is from a 3 byte offset (which
    incidentally aligns to 4 bytes). However, a 1 byte offset would
    incorrectly align to 2 bytes.
    
    Closes #734
    
    Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
    saleemrashid authored and dickens committed Aug 10, 2020
    Copy the full SHA
    f492968 View commit details
    Browse the repository at this point in the history

Commits on Jul 16, 2020

  1. winusb: setting a non-default config not supported

    Just because winusb doesn't seem to support setting a different
    configuration, that doesn't mean it's an invalid parameter.
    
    It's generally supported by libusb, just not on this platform.
    
    So return LIBUSB_ERROR_NOT_SUPPORTED instead of
    LIBUSB_ERROR_INVALID_PARAM.
    
    Closes #743
    Closes #752
    
    Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
    thierer authored and dickens committed Jul 16, 2020
    Copy the full SHA
    4261cbe View commit details
    Browse the repository at this point in the history

Commits on Jun 17, 2020

  1. darwin: Fix invalid GetPipePropertiesV3 argument

    GetPipePropertiesV3 seems to require that the bVersion field of the
    properties argument be set before calling it:
    "Version of the structure. Currently kUSBEndpointPropertiesVersion3.
    Need to set this when using this structure"
    
    Not doing so results in an invalid argument error.
    
    Closes #744
    
    Signed-off-by: Ido Yariv <ido@wizery.com>
    Signed-off-by: Nathan Hjelm <hjelmn@google.com>
    codido authored and hjelmn committed Jun 17, 2020
    Copy the full SHA
    ad04734 View commit details
    Browse the repository at this point in the history

Commits on Jun 12, 2020

  1. os/darwin: use IOUSBDevice as darwin_device_class explicitly

    kIOUSBDeviceClassName define from IOUSBLib.h file was changed from
    IOUSBDevice to IOUSBHostDevice in macOS Catalina.
    
    In previous macOS versions, it was always defined as IOUSBDevice:
    ```
     #define kIOUSBDeviceClassName		 "IOUSBDevice"
    ```
    In macOS Catalina it looks as follows:
    ```
     #if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_14
     #define kIOUSBDeviceClassName           "IOUSBDevice"
     #define kIOUSBInterfaceClassName        "IOUSBInterface"
     #else
     #define kIOUSBDeviceClassName           kIOUSBHostDeviceClassName
     #define kIOUSBInterfaceClassName        kIOUSBHostInterfaceClassName
     #endif /* MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_14 */
    ```
    
    By default, macOS Catalina uses IOUSBHostDevice. The problem is that
    using the IOUSBHostDevice class misses some devices.  This has been
    described in 044a7ee commit. To work only with IOUSBDevice,
    darwin_device_class has been explicitly set to IOUSBDevice.
    
    Closes #693
    
    For reference, here's the output of the 'listdevs' example before my changes:
    05ac:027b (bus 128, device 2) path: 5
    2109:0102 (bus 20, device 6) path: 4
    05e3:0751 (bus 20, device 5) path: 1
    1a40:0801 (bus 20, device 3) path: 2
    0bda:8153 (bus 0, device 2) path: 3
    2109:2817 (bus 20, device 1) path: 8
    2109:0817 (bus 0, device 1) path: 4
    
    And here's the output after my changes:
    05ac:027b (bus 128, device 2) path: 5
    2109:0102 (bus 20, device 6) path: 3.2.4
    05e3:0751 (bus 20, device 5) path: 3.2.1
    1a40:0801 (bus 20, device 3) path: 3.2
    0bda:8153 (bus 0, device 2) path: 2.3
    2109:2817 (bus 20, device 1) path: 3
    2109:0817 (bus 0, device 1) path: 2
    
    Closes #712
    
    Signed-off-by: Nathan Hjelm <hjelmn@google.com>
    IgorAnohin authored and hjelmn committed Jun 12, 2020
    Copy the full SHA
    bb37730 View commit details
    Browse the repository at this point in the history
  2. darwin: use GetPipePropertiesV3 on 10.9 and later

    Apple added the GetPipePropertiesV3 in IOUSBFamily version 550. The old
    function appears to be deprecated. When 10.8.x and older are no longer
    supported the GetPipeProperties call should be removed.
    
    Signed-off-by: Nathan Hjelm <hjelmn@google.com>
    hjelmn committed Jun 12, 2020
    Copy the full SHA
    d55b2fd View commit details
    Browse the repository at this point in the history
Older