summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2012-03-21linux: Fix a comment in handle_iso_completionfor109Hans de Goede1-2/+1
Fix the comment at the end of handle_iso_completion, we don't stop on urbs / iso pkts with less data then requested, and this is a good thing since this is a normal condition for iso transfers. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-03-21linux: remove bogus setting of status from handle_iso_completionHans de Goede1-3/+0
Remove a useless check then set of status because: 1. The check is always true; and 2. The new value status gets set to never gets used Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-03-21linux: Translate linux iso pkt status codes to libusb transfer status codesHans de Goede1-1/+35
During testing of my usbredir code I hit a scenario where my libusb app was seeing EXDEV as status in the transfer's iso_packet_desc This happened because we don't translate linux negative errno errors stored in iso pkts status to libusb transfer status codes at all! So this patch adds translation for this. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-03-21linux: Fix handling of urb status codesHans de Goede1-5/+12
During testing of my usbredir code I hit a case where EOVERFLOW was not handled in handle_control_completion. Instead of just fixing this one case I've audited (and fixed where necessary) all handle_foo_completion functions to know about all errors documented in linux/Documentation/usb/error-codes.txt. Note that for handle_iso_completion this patch actually removes the handling of some codes, since these can never occur on an iso urb (they can only occur on the iso packets included in the urb, see the next patch in this series). Also in case an unknown status is encountered on an iso urb, this patch actually sets the urb's status to ERROR, rather then leaving it at completed. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-03-21Don't print errors when cancel_transfer fails with NOT_FOUNDHans de Goede1-2/+5
As stated in the documentation for libusb_cancel_transfer, LIBUSB_ERROR_NOT_FOUND is an expected return value for libusb_cancel_transfer (under certain circumstances) printing an error each time this happens therefor is undesirable. More so because under Linux IOCTL_USBFS_DISCARDURB sets errno to EINVAL when the kernel could not find the urb in the kernels urbs in flight list. Which means that the urb has already completed at the host controller level, but it has not necessarily already been reaped. IOW under Linux libusb_cancel_transfer may yield a result of LIBUSB_ERROR_NOT_FOUND *before* the transfer's callback has been called! So there is no way for an application to avoid calling libusb_cancel_transfer on already completed transfers. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-03-21linux: Fix cancel_transfer return value when cancelling a multi-urb transferHans de Goede1-1/+2
If we fail to cancel the last urb of a multi-urb transfer because it has already completed (errno == EINVAL on DISCARD_URB), then the entire transfer has already completed, so returning NOT_FOUND is consistent with what the documentation for libusb_cancel_transfer says. But if we've successfully cancelled the last urb, and then another urb fails with errno == EINVAL, this means that we've still cancelled the transfer, as it has only *partially* completed. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2012-02-22Add LIBUSB_TRANSFER_ADD_ZERO_PACKET flag to indicate need for ZLPPeter Stuge8-1/+76
Some protocols which use USB require an extra zero length data packet to signal end-of-transfer on bulk endpoints, if the last data packet is exactly wMaxPacketSize bytes long. This flag allows applications to inform libusb about this requirement, so that libusb can handle the issue transparently. At the moment the new flag is only supported on Linux, and submitting a transfer with the flag set returns an error at submit time on other systems. Hopefully implementations will soon follow for other systems. References #6.
2012-02-19libusb.h: Add comma after last value in enums to ease future expansionPeter Stuge1-7/+7
2012-02-19Linux: Rework bulk continuation check to generic kernel version checkPeter Stuge1-17/+16
The old check_flag_bulk_continuation() tested for one specific running kernel version. The new kernel_version_ge() instead allows to test the running kernel version against major, minor and sublevel parameters.
2012-02-19OpenBSD: Correctly catch attempts to do isochronous OUT transfersPeter Stuge1-1/+1
LIBUSB_ENDPOINT_OUT is the value of the direction bit, which is 0 for OUT transfers, so the previous condition could never evaluate to true.
2012-02-19Darwin: Do not reject devices with product id 0x0000Peter Stuge1-2/+1
Fixes #128.
2012-02-13Do not call timerfd functions when timerfd is not being usedPeter Stuge1-5/+6
When libusb was built with timerfd support but used on a system without timerfd support the library would hang indefinitely on completion of the first transfer, since timerfd functions were being called unconditionally and the error returned when timerfd was not being used caused a confused internal state. Many thanks to Ivo Smits for looking into the issue, proposing an initial solution, and helping with testing! Fixes #73.
2012-02-12Windows: Fix MSVC6 IDE warning on line continuation in libusb-1.0.rcMichael Plante1-6/+2
* libusb\libusb-1.0.rc(21): Could not find the file LIBUSB_RC. * only shows up first time after opening workspace. * shows up on either build or clean. * not actually due to rc.exe, but prior to it. * probably an IDE bug. * does not show up when running an exported makefile. Signed-off-by: Michael Plante <michael.plante@gmail.com>
2012-02-12Windows: Add Renesas SuperSpeed support for libusb_get_device_speed()Pete Batard1-0/+1
* tests conducted using a Renesas PCIE USB 3.0 controller and driver and a mass storage USB 3.0 confirm that USB_NODE_CONNECTION_INFORMATION_EX uses (undocumented) value 3 for SuperSpeed
2012-02-10autogen.sh: Try to use libtoolize before trying glibtoolizePeter Stuge1-2/+9
This helps on Mac OS X where an old glibtoolize is included in the system and newer, manually installed, versions provide libtoolize. See also http://marc.info/?m=132490560131894
2012-02-08Rename the lsusb example program to listdevsPeter Stuge9-33/+33
This is intended to reduce confusion with the much more significant lsusb utility which is part of the usbutils package.
2012-02-08core.c: Fix clang warning about useless store to a variableSean McBride1-2/+1
2012-02-08Darwin: Clarify comments on event thread creation and terminationSean McBride1-2/+2
2012-02-08Darwin: Fix incorrect mutex protection of libusb_darwin_acfl globalSean McBride1-3/+1
2012-02-08Darwin: Use retained runloop variable instead of CFRunLoopGetCurrent()Sean McBride1-2/+2
2012-02-08Darwin: Fix libusb_init() and libusb_exit() refcount race conditionSean McBride1-3/+4
Use OSAtomicIncrement32Barrier() and OSAtomicDecrement32Barrier() in darwin_init() and darwin_exit() to be thread safe.
2012-02-08threads_posix.c: Fix prototype warning by including threads_posix.hSean McBride1-1/+1
2012-02-08Windows: Fix crash during enumeration with >= 64 connected devicesDave Camarillo1-1/+1
* indexes were outgrowing the unref_list array before realloc, resulting in out of bound access and crash.
2012-02-08Windows MSVC6: Remove SetupAPI, AdvAPI32 and OLE32 dependenciesPete Batard2-8/+8
* this ensures that libusb dependent applications only need to link with libusb on Windows * (copied from Pete's msvc08 mods to msvc6 by Michael)
2012-02-08Windows: Output an error message on calls to libusb_get_pollfds()Pete Batard1-0/+2
Signed-off-by: Michael Plante <michael.plante@gmail.com>
2012-02-08io.c: Fix comment since pthreads isn't the only threading libusb usesPete Batard1-1/+1
2012-02-08libusb.h: Cast in libusb_get_string_descriptor() to avoid MSVC6 warningMichael Plante1-1/+1
On MSVC6 bitwise OR promotes to int, causing the warning.
2012-02-08Windows: guid_to_string() is only discarded when macro-usbi_dbg usedMichael Plante1-1/+1
* usbi_dbg encloses all references to guid_to_string * MinGW/cygwin warn about an unused function, so the #if squelches this warning * MSVC6 uses a variadic function form of usbi_dbg instead of a macro, so the compiler still "sees" guid_to_string and it therefore needs to always be defined for MSVC6, even if it's only a stub. * So we define it if usbi_dbg is used OR if MSVC6 is used. Signed-off-by: Michael Plante <michael.plante@gmail.com>
2012-02-08Windows: Fix undefined datatype 'LONG_PTR' in MSVC6Pete Batard1-1/+1
* issue reported by Elmi Signed-off-by: Michael Plante <michael.plante@gmail.com>
2012-02-08Windows: Fix for MSVC6 preprocessor not accepting blank parametersPete Batard1-11/+13
* unlike later iterations of Visual Studio, MSVC6 does not accept blank parameters on macro calls [eg. CALL(a, ,b)] * blank params were used with the DLL_DECLARE and DLL_LOAD macros * issue reported by Elmi
2012-02-06Windows: Switch MSVC6 .dsp project files from MBCS to UnicodeMichael Plante3-12/+12
* MBCS (which is different from UTF-8) only makes sense if supporting Windows 95/98, which we don't * (try to match Pete's vcproj changes in MSVC6)
2012-02-06Windows: Add missing MSVC6 lsusb.dsp project fileMichael Plante1-0/+103
Signed-off-by: Michael Plante <michael.plante@gmail.com>
2012-01-30OpenBSD backendMartin Pieuchot5-3/+734
2012-01-13configure.ac: Darwin: Move -lobjc from LIBS to PC_LIBS_PRIVATEXiaofan Chen1-2/+1
Since commit 40327cd134718475f6cec8935b856d4fdff2099c it is neccessary to explicitly include -lobjc not only when linking libusb itself, but also for programs linking statically against libusb. References #63. See also http://marc.info/?m=132505900202378
2012-01-13examples: Link only with ../libusb/libusb-1.0.la and not with -lusb-1.0Xiaofan Chen1-3/+3
Previous _LDFLAGS included both the freshly built libusb in ../libusb and -lusb-1.0, where libtool would usually resolve the latter to an already-installed libusb library in the system. The extra reference to a second libusb library resulted in failure to build examples on Mac OS X in some cases, and is plain wrong. See also the thread at http://marc.info/?m=132637593623667
2012-01-12libusb/Makefile.am: Avoid recursive variables in .rc silent-rulePeter Stuge1-5/+1
Not every make supports recursive variable expansion so some automake versions complain about non-POSIX variable names ever since commit 70bec4a9f8ec28d36c731011fa24d37c74ad3523 which added support for silent-rules in our rule to compile the Windows .rc file. This commit removes the recursive variables and instead uses the simple and generic GEN message and associated variable.
2011-12-13Core: Fix #122 warning: no previous prototype for ‘usbi_log_v’Ludovic Rousseau1-3/+4
Declare the usbi_log_v() function before using it.
2011-12-09Darwin: Set a name for the background thread on Mac OS X 10.6 and laterSean McBride1-0/+6
The call to pthread_setname_np() makes it easy to identify the background thread in the Xcode debugger and in crash reports.
2011-10-17libusb/Makefile.am: Add libusb-1.0.rc dependency on version.hPeter Stuge1-0/+2
2011-10-17libusb/Makefile.am: Make the libusb-1.0.rc rule support silent-rulesPeter Stuge1-1/+5
2011-10-17configure.ac: Enable libtool support for Windows Resource languagePeter Stuge1-0/+1
2011-10-17descriptor.c: Use size_t for minor 64 bit compliance improvementSean McBride1-2/+2
Fixes #121.
2011-10-17Darwin: Fix warnings about mismatched signed/unsigned compareSean McBride1-2/+3
References #121.
2011-10-17Fix unused variable warnings when without timerfd and/or when on DarwinSean McBride2-0/+8
References #121.
2011-10-17Correctly handle LIBUSB_TRANSFER_OVERFLOW in libusb_control_transfer()Ludovic Rousseau1-0/+3
sync.c: In function `libusb_control_transfer': sync.c:122: warning: enumeration value `LIBUSB_TRANSFER_OVERFLOW' not handled in switch Fixes #120.
2011-10-17Windows: do not set altsetting 0 as part of libusb_release_interface()Pete Batard1-1/+0
* pointed out by Travis Robinson and Xiaofan Chen * similar to a change advised by Alan Stern for the Linux kernel: http://marc.info/?m=122790204410765
2011-10-17Windows: fix communication with hubsPete Batard1-4/+2
* issue reported by René Haunstrup in http://marc.info/?m=130503019227814
2011-10-17Windows: add USB 3.0 controller supportPete Batard1-7/+15
* Windows 8, NEC/Renesas, TI, Fresco Logic, Etron, VIA, ASMedia (some of which untested!) * includes workaround for NEC/Renesas USB 3.0 root hubs
2011-10-17Windows: add static keywords and drop duplicated or unneeded codePete Batard1-7/+5
2011-10-17Windows: fix 'windows_error_str' defined but not used when not loggingPete Batard1-0/+2