Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libusb: remove the timeouts in hid_write() #190

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Commits on Nov 12, 2014

  1. libusb: remove the timeouts in hid_write()

    The libusb/hid.c:hid_write() has timeouts in its calls to
    libusb_interrupt_transfer and libusb_control_transfer().  This timeout
    can sometimes be tripped (e.g., if the underlying hardware is slow),
    and no sensible error code is returned -- you just get a -1.  Hence,
    the caller can't know that it could just try again because the only
    error that occurred was a timeout (or that the message may have
    actually gotten through).
    
    Additionally, the other hid.c:hid_write() implementations -- mac, and
    windows -- are all blocking and do not timeout.  This makes the
    behavior of the libusb hid_write() different than the others, which
    seems weird.  The linux/hid.c:hid_write() is seemingly blocking
    (because it uses a blocking write(2)), but it can timeout in the
    kernel.  A follow on commit will make the linux hid.c: hid_write()
    behavior be truly blocking, too.
    
    This commit simply sets the libusb timeouts to 0 (i.e., infinite) to
    make the libusb hid_write() behave like the others.
    jsquyres committed Nov 12, 2014
    Configuration menu
    Copy the full SHA
    8102346 View commit details
    Browse the repository at this point in the history
  2. linux: make hid_write() be truly blocking

    If write() fails due to timeout, loop around and try again.  This
    makes the linux/hid_write() exhibit the same blocking behavior as the
    other hid_write() implementations.
    jsquyres committed Nov 12, 2014
    Configuration menu
    Copy the full SHA
    53d85c5 View commit details
    Browse the repository at this point in the history