platform/upstream/libusb.git
13 years agoWindows: Touch up FileDescription and ProductName resource strings
Peter Stuge [Sun, 27 Feb 2011 08:37:54 +0000 (09:37 +0100)]
Windows: Touch up FileDescription and ProductName resource strings

13 years agoWindows: Remove emulated direct device access via HID API
Peter Stuge [Sun, 27 Feb 2011 06:20:40 +0000 (07:20 +0100)]
Windows: Remove emulated direct device access via HID API

Either use a library such as HIDAPI to communicate with HID class
devices, or replace the kernel driver for the device with one that
offers support for the complete libusb API.

13 years agoRevert libusb_strerror() until we have i18n and l10n
Peter Stuge [Sun, 27 Feb 2011 05:59:15 +0000 (06:59 +0100)]
Revert libusb_strerror() until we have i18n and l10n

13 years agodpfp_threaded: return instead of pthread_exit() to avoid Cygwin warning
Pete Batard [Wed, 19 Jan 2011 14:00:12 +0000 (14:00 +0000)]
dpfp_threaded: return instead of pthread_exit() to avoid Cygwin warning

13 years agoWindows: Rename various variables named "index" to avoid shadow warnings
Pete Batard [Wed, 19 Jan 2011 13:52:08 +0000 (13:52 +0000)]
Windows: Rename various variables named "index" to avoid shadow warnings

13 years agoWindows: Fix logic in enumeration of driver name and port number
Pete Batard [Tue, 5 Oct 2010 11:50:53 +0000 (12:50 +0100)]
Windows: Fix logic in enumeration of driver name and port number

13 years agoWindows: Allow claiming any interface in composite device using WinUSB
Pete Batard [Tue, 5 Oct 2010 11:50:13 +0000 (12:50 +0100)]
Windows: Allow claiming any interface in composite device using WinUSB

Issue reported by Benjamin Dobell, see #48. The call to
WinUsb_QueryInterfaceSettings() is removed since it doesn't work
on any other interface but the first (a WinUSB limitation).

This allows the use of WinUSB.sys in lieu of the usbccgp.sys
"USB Generic Parent" default driver for composite devices.

13 years agoWindows: Allow arbitrary bConfigurationValue in config descriptors
Pete Batard [Tue, 5 Oct 2010 11:47:15 +0000 (12:47 +0100)]
Windows: Allow arbitrary bConfigurationValue in config descriptors

Unlike bInterfaceNumber, bConfigurationValue does not have to be
either sequential or contiguous. The bConfigurationValue is now
included in debug output. Fixes #48 reported by Benjamin Dobell.

13 years agoDarwin: Schedule isochronous transfers further in the future
Thomas Röfer [Fri, 19 Nov 2010 21:03:11 +0000 (22:03 +0100)]
Darwin: Schedule isochronous transfers further in the future

This is required to make OpenKinect transfer data at 30 fps. This
change was originally made by Theo Watson, and Thomas improved on it.
The commit came via OpenKinect into libusb thanks to Kyle Machulis and
Hector Martin. Fixes #66.

13 years agoDarwin: Fix #65 memory leak in submit_iso_transfer()
Thomas Röfer [Fri, 19 Nov 2010 21:03:11 +0000 (22:03 +0100)]
Darwin: Fix #65 memory leak in submit_iso_transfer()

This was also independently fixed by Hoi-Ho Chan, but Thomas caught
an additional problem with his fix.

This commit came via OpenKinect into libusb thanks to Kyle Machulis
and Hector Martin.

13 years agoconfigure.ac: Refactor Windows backend settings into one occurence
Peter Stuge [Sat, 26 Feb 2011 03:21:05 +0000 (04:21 +0100)]
configure.ac: Refactor Windows backend settings into one occurence

The Windows backend is used both with MinGW and Cygwin, and since most
settings are identical they can be set in one place.

13 years agoconfigure.ac: Rename AM_LDFLAGS to LTLDFLAGS and actually use them
Peter Stuge [Mon, 15 Nov 2010 18:58:51 +0000 (19:58 +0100)]
configure.ac: Rename AM_LDFLAGS to LTLDFLAGS and actually use them

The new variable name tries to clarify that libtool is being used.
Linker flags must thus always be specified with -Wl.

Factor out the libtool flag -no-undefined from host specific cases.
The flag is required to build a Windows DLL, but is correct also for
the other supported systems.

Also, start actually using LTLDFLAGS in libusb/Makefile.am, so that
libtool will see the options set by configure.

13 years agoconfigure.ac: Clean up PC_LIBS_PRIVATE and AM_LDFLAGS
Peter Stuge [Sun, 21 Nov 2010 22:38:46 +0000 (23:38 +0100)]
configure.ac: Clean up PC_LIBS_PRIVATE and AM_LDFLAGS

Move linker options for when linking the library itself from
PC_LIBS_PRIVATE into AM_LDFLAGS. PC_LIBS_PRIVATE should only
contain flags needed to link applications statically against libusb.
Fixes #72.

13 years agoconfigure.ac: Call AC_CONFIG_FILES() for each output file
Peter Stuge [Fri, 25 Feb 2011 01:33:29 +0000 (02:33 +0100)]
configure.ac: Call AC_CONFIG_FILES() for each output file

This avoids a problem with Windows line endings.

13 years agoconfigure.ac: Whitespace changes and trivial reordering
Peter Stuge [Sun, 21 Nov 2010 22:37:27 +0000 (23:37 +0100)]
configure.ac: Whitespace changes and trivial reordering

13 years agoconfigure.ac: Quote AC_COMPILE_IFELSE() input
Peter Stuge [Sun, 21 Nov 2010 22:10:35 +0000 (23:10 +0100)]
configure.ac: Quote AC_COMPILE_IFELSE() input

13 years agoconfigure.ac: Define booleans to 1 when set, instead of an empty string
Peter Stuge [Sun, 21 Nov 2010 22:09:02 +0000 (23:09 +0100)]
configure.ac: Define booleans to 1 when set, instead of an empty string

This makes the generated config.h look a lot nicer.

13 years agoconfigure.ac: Clean up redundancy and fix LIBS on Linux
Peter Stuge [Sat, 30 Oct 2010 20:28:59 +0000 (22:28 +0200)]
configure.ac: Clean up redundancy and fix LIBS on Linux

LIBS, AM_LDFLAGS, OS_ conditionals and THREADS_POSIX had a bit of
redundancy throughout the file, and on Linux LIBS ended up missing
the -pthread flag.

13 years agoconfigure.ac: Touch up Darwin and Cygwin OS messages
Peter Stuge [Sat, 26 Feb 2011 03:08:38 +0000 (04:08 +0100)]
configure.ac: Touch up Darwin and Cygwin OS messages

13 years agoconfigure.ac: Do not use -pthread on Darwin
Peter Stuge [Sat, 30 Oct 2010 20:13:05 +0000 (22:13 +0200)]
configure.ac: Do not use -pthread on Darwin

It's not needed because Darwin has POSIX Threads in libc. Fixes #96.

13 years agoconfigure.ac: Check for poll.h, and for nfds_t on Darwin
Peter Stuge [Sat, 30 Oct 2010 20:07:37 +0000 (22:07 +0200)]
configure.ac: Check for poll.h, and for nfds_t on Darwin

On Linux, assume nfds_t is always available.

On Darwin, fall back to unsigned int when poll() exists but there
is no nfds_t, such as on Mac OS X before 10.4.

On Windows (both MinGW and Cygwin), always use unsigned int instead
of nfds_t, and don't check for poll.h because we use our own poll()
implementation.

13 years agoDarwin: Add support for control requests on endpoints other than 0
Nathan Hjelm [Wed, 6 Oct 2010 02:08:08 +0000 (20:08 -0600)]
Darwin: Add support for control requests on endpoints other than 0

Signed-off-by: Nathan Hjelm <hjelmn@me.com>
13 years agoDarwin: Add more error checking for libusb_open()
Nathan Hjelm [Wed, 6 Oct 2010 05:11:50 +0000 (23:11 -0600)]
Darwin: Add more error checking for libusb_open()

Now also check the CreateDeviceAsyncEventSource() return code for errors.

Signed-off-by: Nathan Hjelm <hjelmn@me.com>
13 years agoCore: libusb_get_next_timeout() must consider all flying transfers
Peter Stuge [Wed, 3 Nov 2010 20:46:53 +0000 (21:46 +0100)]
Core: libusb_get_next_timeout() must consider all flying transfers

If transfer->flags indicated that a transfer had a timeout, but no
timeout was actually set, then libusb_get_next_timeout() would look
no further for a timeout, ignoring any transfers later in the list
which had a timeout set.

Since libusb has an internal 60 second timeout this bug could not
cause complete lockup, but it could cause a 60 second timeout even
when a transfer was submitted with a shorter timeout.

13 years agoLinux: Correctly catch read() errors for sysfs config descriptors
Ludovic Rousseau [Mon, 15 Nov 2010 13:55:51 +0000 (14:55 +0100)]
Linux: Correctly catch read() errors for sysfs config descriptors

read(2) returns ssize_t (signed) and not size_t (unsigned) or int.

Silence "warning: comparison of unsigned expression < 0 is always false"
and fix #75.

13 years agoLinux: Refactor cancellation into one function for all transfer types
Peter Stuge [Sun, 23 Jan 2011 03:01:25 +0000 (04:01 +0100)]
Linux: Refactor cancellation into one function for all transfer types

13 years agoLinux: Refactor discarding of URBs into a function and return all errors
Peter Stuge [Sun, 17 Oct 2010 06:19:56 +0000 (08:19 +0200)]
Linux: Refactor discarding of URBs into a function and return all errors

The Linux backend did not always return errors according to the
libusb_cancel_transfer() documentation.

13 years agoLinux: Set private number of URBs also for control transfers
Peter Stuge [Sun, 23 Jan 2011 03:01:01 +0000 (04:01 +0100)]
Linux: Set private number of URBs also for control transfers

13 years agoLinux: cancel URBs in reverse order
Alan Stern [Sun, 17 Oct 2010 04:57:06 +0000 (06:57 +0200)]
Linux: cancel URBs in reverse order

In a multi-URB transfer, URBs should be cancelled in reverse order of
submission. This prevents races that might otherwise occur (after URB N
is cancelled, data may be transferred for URB N+1 before it too can be
cancelled). Fixes #8.

13 years agoLinux: report correct value for urb->actual_length
Alan Stern [Sun, 17 Oct 2010 02:17:32 +0000 (04:17 +0200)]
Linux: report correct value for urb->actual_length

Transferred bytes are returned correctly by the kernel for every URB,
even when an error occurs.  Hence they should always be included in
the transfer statistics.  The same is true for isochronous packet
length and status.

[stuge: set itransfer->transferred so data is stored at correct offset]

13 years agoLinux: improve reporting of URB error status codes
Alan Stern [Fri, 22 Oct 2010 09:13:34 +0000 (11:13 +0200)]
Linux: improve reporting of URB error status codes

Fix the way overflow errors are handled (they can occur in any
transaction, not just the last one in a transfer) and add tests
for other commonly-occuring error statuses.

13 years agoLinux: improve detection of BULK_CONTINUATION kernel support
Alan Stern [Tue, 5 Oct 2010 15:08:40 +0000 (11:08 -0400)]
Linux: improve detection of BULK_CONTINUATION kernel support

Clarify the comments describing the BULK_CONTINATION flag, and improve
the subroutine that checks whether the flag is supported by making it
"future-proof", i.e., by working properly with kernel version numbers
higher than 2.6.

13 years agoREADME: Update webpage URL and add Peter's email address
Peter Stuge [Mon, 22 Nov 2010 04:14:00 +0000 (05:14 +0100)]
README: Update webpage URL and add Peter's email address

13 years agolibusb is not just for Linux!
Peter Stuge [Wed, 4 Aug 2010 05:30:22 +0000 (07:30 +0200)]
libusb is not just for Linux!

13 years agoRemove USBI_OS_HANDLES_TIMEOUT and fix int/isoc timeouts on Darwin
Nathan Hjelm [Wed, 6 Oct 2010 01:48:39 +0000 (19:48 -0600)]
Remove USBI_OS_HANDLES_TIMEOUT and fix int/isoc timeouts on Darwin

Backends set USBI_TRANSFER_OS_HANDLES_TIMEOUT for transfers instead.
Darwin only handles timeouts for bulk and control transfers, so the
backend now sets that flag accordingly, making libusb core handle
timeouts for interrupt and isochronous transfers. Fixes #31.

Signed-off-by: Nathan Hjelm <hjelmn@me.com>
[stuge: rework libusb_get_next_timeout() and enum usbi_transfer_flags]
[stuge: fix typo; set USBI_TRANSFER_TIMED_OUT flag correctly]

13 years agoSilence "warning: suggest braces around empty body in an 'if' statement"
Peter Stuge [Sun, 14 Nov 2010 02:14:00 +0000 (03:14 +0100)]
Silence "warning: suggest braces around empty body in an 'if' statement"

13 years agoDisallow libusb_get_string_descriptor_ascii() with index 0
Konrad Rzepecki [Sat, 13 Nov 2010 13:09:22 +0000 (14:09 +0100)]
Disallow libusb_get_string_descriptor_ascii() with index 0

String descriptor 0 is the list of supported language IDs in the device,
which can't have an ASCII representation. Calling the function with
index 0 is thus not really useful. Fixes #43.

13 years agoUse const for the usbi_parse_descriptor() format string
Ludovic Rousseau [Fri, 19 Mar 2010 14:35:14 +0000 (15:35 +0100)]
Use const for the usbi_parse_descriptor() format string

Constant strings should be "const char *" instead of "char *". Silence
"discards qualifiers from pointer target type" warnings. Fixes #61.

13 years agoLinux: Fix usbfs/sysfs config descriptor handling on big-endian
Hector Martin [Wed, 25 Aug 2010 01:21:57 +0000 (03:21 +0200)]
Linux: Fix usbfs/sysfs config descriptor handling on big-endian

usbfs endian-swaps, sysfs doesn't, not the other way around. Fixes #51;
descriptor endian parsing is backwards using sysfs on big-endian hosts.
usbfs is untested.

Signed-off-by: Hector Martin <hector@marcansoft.com>
[stuge: checked against Documentation/usb/proc_usb_info.txt]

13 years agoexamples: #include <libusb.h> without directory name
Ludovic Rousseau [Tue, 17 Aug 2010 18:53:04 +0000 (20:53 +0200)]
examples: #include <libusb.h> without directory name

The libusb-1.0 directory name belongs in the compile command, e.g.
via pkg-config --cflags. Fixes #58.

14 years agoAdd missing argument to libusb_wait_for_event() documentation, fix #55
Ludovic Rousseau [Thu, 24 Jun 2010 08:14:24 +0000 (10:14 +0200)]
Add missing argument to libusb_wait_for_event() documentation, fix #55

In the libusb_wait_for_event() sample code in the section "Letting other
threads do the work for you" the call to libusb_wait_for_event() was not
updated by commit 1df713d622ab4f0b03aad72d903ac7beb8fb3b90, which added
the libusb_context *ctx parameter to the function, so the sample code
was broken until now.

14 years agoexamples: Silence warnings about return value of fwrite()
Peter Stuge [Sat, 16 Oct 2010 12:22:30 +0000 (14:22 +0200)]
examples: Silence warnings about return value of fwrite()

14 years agoLinux: Don't free() URBs prematurely on hardware error; fix #54
Peter Stuge [Sat, 16 Oct 2010 09:47:14 +0000 (11:47 +0200)]
Linux: Don't free() URBs prematurely on hardware error; fix #54

When an URB in a multi-URB transfer had an error, handle_bulk_completion()
would free all URBs and segfault once the next one completed, instead of
cancelling the remaining URBs and cleaning up as usual.

This is basically the patch from the ticket, plus some restructuring
for increased readability of the function.

Many thanks to Brian Shirley and National Instruments for finding and
fixing this!

14 years agoWindows: add support for filter drivers
Pete Batard [Tue, 5 Oct 2010 11:43:41 +0000 (12:43 +0100)]
Windows: add support for filter drivers

* precedence is driver > upper filter > lower filter, and defined
  in struct driver_lookup lookup from set_device_paths()

14 years agoWindows: fix errcode shadow warning, and string and DLL_DECLARE fixes
Pete Batard [Tue, 5 Oct 2010 11:36:49 +0000 (12:36 +0100)]
Windows: fix errcode shadow warning, and string and DLL_DECLARE fixes

* use FormatMessageA, and overall improvement of windows_error_str()
* use safe_strlen() always
* better typing/init default
* more explicit debug message for devices with no driver

14 years agoWindows: use IOCTLs for HID input, output and feature reports
Pete Batard [Tue, 5 Oct 2010 11:29:32 +0000 (12:29 +0100)]
Windows: use IOCTLs for HID input, output and feature reports

* fixes feature reports not providing actual read size
  (reported by Axel Rohde http://marc.info/?m=127033070021994)
* removes the USE_HIDD_FOR_REPORTS macro
* IOCTL usage inspired from HIDAPI by Alan Ott

14 years agoFix libtool version setting
Daniel Drake [Mon, 4 Oct 2010 19:03:58 +0000 (20:03 +0100)]
Fix libtool version setting

This was being set too early to take effect.

14 years agoPopulate the pkg-config Libs.private field
Mike Frysinger [Mon, 4 Oct 2010 19:01:07 +0000 (20:01 +0100)]
Populate the pkg-config Libs.private field

14 years agoLinux: fix build failure when CLOCK_MONOTONIC does not exist
Mike Frysinger [Fri, 20 Aug 2010 04:09:46 +0000 (00:09 -0400)]
Linux: fix build failure when CLOCK_MONOTONIC does not exist

This is not available on all platforms.

14 years agoUpdate libtool version info
Daniel Drake [Mon, 4 Oct 2010 17:45:18 +0000 (18:45 +0100)]
Update libtool version info

With input from various people on the mailing list, update the libtool
versioning info and start to update this on every release.

The next libusb release will not need a change here. All following ones
will.

14 years agoUpdated documentation for unsupported Darwin/Windows calls
Pete Batard [Thu, 5 Aug 2010 15:40:09 +0000 (16:40 +0100)]
Updated documentation for unsupported Darwin/Windows calls

14 years agoWindows: Make libusb_pollfd() return error
Pete Batard [Sun, 19 Sep 2010 13:24:25 +0000 (14:24 +0100)]
Windows: Make libusb_pollfd() return error

Windows does not have numerical file descriptors but does have the
concept of event sources. Exposing these event sources will require
some careful thought and design, to be completed later.

14 years agoMinGW: Use --add-stdcall-alias linker option
Daniel Drake [Sun, 19 Sep 2010 13:21:01 +0000 (14:21 +0100)]
MinGW: Use --add-stdcall-alias linker option

Naming of symbols inside the library is inconsistent on Windows:
http://wyw.dcweb.cn/stdcall.htm

Use this linker option to add aliases which add compatibility with
the "MSVC DLL" platform when a DEF file is used. It also better matches
the appearance of the Windows API itself.

14 years agoIntroduced calling convention (for Windows)
Pete Batard [Fri, 13 Aug 2010 10:59:49 +0000 (11:59 +0100)]
Introduced calling convention (for Windows)

Under Windows, a variety of compilers and configurations are available,
meaning that the manner of parameter passing (e.g. registers vs stack)
can vary.

Match the Windows API calling convention and document this appropriately.
This calling convention will be used regardless of the configuration of
the user's development platform.

The only user-level complication is that all functions used as libusb
callbacks must use the same calling convention as libusb. The
LIBUSB_CALL macro is provided to make this easy.

Signed-off-by: Michael Plante <michael.plante@gmail.com>
Signed-off-by: Pete Batard <pbatard@gmail.com>
[dsd: slight change of strategy, add documentation]

14 years agoWindows: fix string copy in sanitize_path
Pete Batard [Sat, 7 Aug 2010 03:56:04 +0000 (21:56 -0600)]
Windows: fix string copy in sanitize_path

The NULL byte was not being copied.

14 years agoWindows: DuplicateHandle failure is not a warning
Pete Batard [Thu, 29 Jul 2010 23:30:31 +0000 (00:30 +0100)]
Windows: DuplicateHandle failure is not a warning

This is because WinUSB handles are not duplicable, and generate a
lot of these warnings.

14 years agoremoved trailing whitespaces
Pete Batard [Thu, 29 Jul 2010 23:23:05 +0000 (00:23 +0100)]
removed trailing whitespaces

14 years agoWindows: Mark interfaces as unused when releasing
Pete Batard [Thu, 5 Aug 2010 00:18:32 +0000 (18:18 -0600)]
Windows: Mark interfaces as unused when releasing

Without this important cleanup, the autoclaim code could attempt to
reuse an unclaimed interface as if it were already claimed.

14 years agoWindows: fix device path string duplication
Pete Batard [Thu, 5 Aug 2010 00:15:59 +0000 (18:15 -0600)]
Windows: fix device path string duplication

14 years agoDarwin: Cache device configuration value
Nathan Hjelm [Tue, 3 Aug 2010 03:27:38 +0000 (21:27 -0600)]
Darwin: Cache device configuration value

Cache device configuration value to bring the Darwin backend more in
line with the libusb spec. To handle buggy devices GetConfiguration is
not called unless the device has more than one configuration.

14 years agoFix inconsistencies between prototypes and definitions
Xiaofan Chen [Fri, 30 Jul 2010 14:56:43 +0000 (15:56 +0100)]
Fix inconsistencies between prototypes and definitions

This removes some warnings on cygwin regarding a name clash against
the standard library "index" function.

14 years agoDarwin: handle kIOReturnUnderrun
Hoi-Ho Chan [Wed, 28 Jul 2010 03:04:17 +0000 (21:04 -0600)]
Darwin: handle kIOReturnUnderrun

This return code indicates that the device returned a data packet
less than the max packet size. In libusb backend terms, this is
a successful transfer.

14 years agoAdd Windows support
Pete Batard [Sat, 10 Jul 2010 23:51:13 +0000 (17:51 -0600)]
Add Windows support

Via Cygwin/MinGW, libusb now has windows support.
Thanks to contributors: Michael Plante, Orin Eman, Peter Stuge,
Stephan Meyer, Xiaofan Chen.

14 years agoDarwin: write iso transfer details into correct packets
Hoi-Ho Chan [Sat, 24 Jul 2010 19:48:00 +0000 (13:48 -0600)]
Darwin: write iso transfer details into correct packets

14 years agoDarwin: fix interface object leak
Nathan Hjelm [Sat, 24 Jul 2010 19:42:57 +0000 (13:42 -0600)]
Darwin: fix interface object leak

14 years agoDarwin: clean up some debug messages
Nathan Hjelm [Sat, 24 Jul 2010 19:41:03 +0000 (13:41 -0600)]
Darwin: clean up some debug messages

14 years agoDarwin: Don't open devices during scan unless we have to unsuspend
Nathan Hjelm [Sat, 24 Jul 2010 19:39:16 +0000 (13:39 -0600)]
Darwin: Don't open devices during scan unless we have to unsuspend

14 years agoLinux: Handle early complete of multi-URB transfer
Peter Stuge [Fri, 25 Jun 2010 06:08:13 +0000 (08:08 +0200)]
Linux: Handle early complete of multi-URB transfer

14 years agoOnly compile dpfp examples when sigaction is available
Daniel Drake [Wed, 21 Jul 2010 23:49:21 +0000 (17:49 -0600)]
Only compile dpfp examples when sigaction is available

It's not available on MinGW.

14 years agoconfigure.ac: fix bashisms
Aurelien Jarno [Tue, 25 May 2010 07:32:19 +0000 (09:32 +0200)]
configure.ac: fix bashisms

14 years agoOnly include sys/time.h on appropriate platforms
Daniel Drake [Fri, 25 Jun 2010 17:01:58 +0000 (12:01 -0500)]
Only include sys/time.h on appropriate platforms

This header doesn't exist on windows.
For libusb, determine at configure-time if the header is available.
For libusb.h, use gcc predefined macros to only include the header
on platforms that need it.

14 years agoLinux: Fix log message commit
Daniel Drake [Tue, 22 Jun 2010 23:45:38 +0000 (18:45 -0500)]
Linux: Fix log message commit

Forgot to test this.

14 years agoOnly initialize the default context when it is requested
Ludovic Rousseau [Mon, 21 Jun 2010 08:19:29 +0000 (10:19 +0200)]
Only initialize the default context when it is requested

14 years agoLinux: fix log message that was being unconditionally sent to stderr (#44)
Daniel Drake [Tue, 22 Jun 2010 23:20:23 +0000 (18:20 -0500)]
Linux: fix log message that was being unconditionally sent to stderr (#44)

This message was put in place to aid libusb-compat-0.1 users, who
may run into the change that libusb-0.1 allowed you to usb_open() a
device that you don't have write access to, but libusb-1.0 does not.

As explained on the ticket this change is dangerous so it should go through
the usual logging mechanism. I also added a similar regular log message
to libusb-compat-0.1.

14 years agoFix 2 documentation typos
Ludovic Rousseau [Thu, 10 Jun 2010 16:41:27 +0000 (18:41 +0200)]
Fix 2 documentation typos

14 years agoadd AM_MAINTAINER_MODE
Ludovic Rousseau [Wed, 21 Apr 2010 14:49:33 +0000 (16:49 +0200)]
add AM_MAINTAINER_MODE

14 years agoFactorize event handler interruption code
Pete Batard [Thu, 10 Jun 2010 22:00:25 +0000 (17:00 -0500)]
Factorize event handler interruption code

This will be additionally used by the windows backend which modifies
the fd set frequently.

14 years agoAbstract low-level event handler operations
Pete Batard [Sat, 5 Jun 2010 17:14:19 +0000 (12:14 -0500)]
Abstract low-level event handler operations

The Windows backend uses something other than UNIX file descriptors
for event handling. Abstract out the operations to allow for this.

14 years agofixes the possibility of using a broken timercmp on Windows
Pete Batard [Tue, 1 Jun 2010 10:38:14 +0000 (11:38 +0100)]
fixes the possibility of using a broken timercmp on Windows

Microsoft's implementation of timercmp does not work for >= or <=.

14 years agoSwitched to standard int pointer type for windows 64-bit compat
Pete Batard [Mon, 1 Feb 2010 19:26:13 +0000 (19:26 +0000)]
Switched to standard int pointer type for windows 64-bit compat

On 64-bit Windows a pointer is 64 bit, but long is still 32 bit for
backwards compatibility.
uintptr_t nicely hides this difference and also works on Linux.

[dsd: add appropriate include]

14 years agoadded doxygen, dpfp, msvc, and xusb stuff to gitignore
Michael Plante [Tue, 9 Mar 2010 22:39:46 +0000 (16:39 -0600)]
added doxygen, dpfp, msvc, and xusb stuff to gitignore

14 years agoAdd reference counting to default context
Daniel Drake [Tue, 1 Jun 2010 00:56:34 +0000 (19:56 -0500)]
Add reference counting to default context

Michael Plante pointed out that if 2 users call libusb_init(NULL) within
a process, we end up creating 2 default contexts, one of which is lost.

Add reference counting so that the default context is reused and
destroyed only after the last user.

14 years agoFix libusb_init() error handling
Daniel Drake [Thu, 27 May 2010 23:24:49 +0000 (19:24 -0400)]
Fix libusb_init() error handling

9996ccaed7 introduced a problem in that mutexes could be destroyed
in the error handling codepath before they had been created.
Pointed out by Michael Plante.

14 years agoModify log functions to compile with MSVC6
Michael Plante [Mon, 24 May 2010 14:57:10 +0000 (11:57 -0300)]
Modify log functions to compile with MSVC6

MSVC6 does not support variadics.

14 years agoAdd type parameter to the list_for_each_entry() and _safe() macros
Pete Batard [Mon, 15 Feb 2010 01:46:05 +0000 (19:46 -0600)]
Add type parameter to the list_for_each_entry() and _safe() macros

typeof() is a GCC extension, not supported by target compilers such
as MSVC.

14 years agoFix a usbi_pollfd leak in error path
Daniel Drake [Wed, 19 May 2010 20:37:29 +0000 (17:37 -0300)]
Fix a usbi_pollfd leak in error path

I accidently missed this when applying Pete Batard's earlier patch.
Pointed out by Michael Plante.

14 years agoRename all interface parameters to usb_interface or interface_number
Pete Batard [Mon, 15 Feb 2010 01:47:30 +0000 (19:47 -0600)]
Rename all interface parameters to usb_interface or interface_number

Remove the use of the ambiguous "interface" where possible without
breaking the API.
'interface' is a preprocessor #define already associated with COM on Windows,
that can cause a conflict as soon as windows.h is included.

There are a few more places where interface is still used, which should
be changed for libusb-2.0

14 years agoStricter types and casts
Pete Batard [Mon, 17 May 2010 22:30:27 +0000 (19:30 -0300)]
Stricter types and casts

14 years agoFixes to error handling and exit codepaths
Pete Batard [Mon, 17 May 2010 22:16:54 +0000 (19:16 -0300)]
Fixes to error handling and exit codepaths

Various locks and things were being leaked/left open when handling
errors and during deinitialization.

[dsd: small tweaks]

14 years agoDarwin: Define IO_OBJECT_NULL if not already defined
Nathan Hjelm [Thu, 13 May 2010 22:38:05 +0000 (19:38 -0300)]
Darwin: Define IO_OBJECT_NULL if not already defined

Needed on Mac OSX 10.3

14 years agolibusb_cpu_to_le16: macro->static inline function
Hans Ulrich Niedermann [Fri, 29 Jan 2010 11:08:52 +0000 (12:08 +0100)]
libusb_cpu_to_le16: macro->static inline function

The libusb_cpu_to_le16 macro was a ({ ... }) expression, which
generates the following compiler warning every time it is used,
(and that is several times for every #include <libusb.h>):

libusb.h:880: warning: ISO C forbids braced-groups within expressions

With this patch, #include <libusb.h> stops generating compiler
warnings on gcc 4.4.

As libusb.h heavily relies on the use of static inline functions
those can be relied on to work properly, and there should not be
any significant difference in the code the compiler generates.

14 years agoAdd libusb_strerror() to get short error message in English from enum
Francesco [Tue, 9 Mar 2010 22:35:35 +0000 (16:35 -0600)]
Add libusb_strerror() to get short error message in English from enum

[dsd: small tweaks]

14 years agoFix libusb_device::lock memory leak
Michael Plante [Fri, 26 Feb 2010 01:39:22 +0000 (19:39 -0600)]
Fix libusb_device::lock memory leak

14 years agoWhitespace cleanup
Pete Batard [Thu, 13 May 2010 00:46:31 +0000 (21:46 -0300)]
Whitespace cleanup

14 years agoAdd internal abstraction for POSIX Threads
Peter Stuge [Mon, 10 May 2010 23:51:43 +0000 (00:51 +0100)]
Add internal abstraction for POSIX Threads

This prepares for a Windows backend without dependency on pthreads-w32.

pthread_* is renamed to usbi_* and PTHREAD_* to USBI_*.

A usbi_mutex_static_t and usbi_mutex_static_lock() and _unlock() are
introduced for statically initialized mutexes, since they may be
implemented using other types when pthreads mutexes aren't used.

Move -pthread from libusb/Makefile.am to host-specific THREAD_CFLAGS in
configure.ac. This will enable optional use of -lpthread for cygwin.

[dsd: minor tweaks, and roll in a change based on patches from Pete
Batard to only build dpfp_threaded example when we're using pthreads]

14 years agov1.0.8 release
Daniel Drake [Tue, 4 May 2010 22:01:59 +0000 (19:01 -0300)]
v1.0.8 release

14 years agoLinux: don't set SHORT_NOT_OK on bulk out URBs (#20
Daniel Drake [Thu, 22 Apr 2010 21:12:51 +0000 (18:12 -0300)]
Linux: don't set SHORT_NOT_OK on bulk out URBs (#20

Setting this flag is illegal, and the behaviour we're looking for
is already in place for host-to-device transfers without this flag.

14 years agoLinux: Handle failure to read active configuration during enumeration
Daniel Drake [Tue, 20 Apr 2010 23:14:09 +0000 (20:14 -0300)]
Linux: Handle failure to read active configuration during enumeration

14 years agoDarwin: don't reuse cached descriptors during enumeration
Nathan Hjelm [Tue, 20 Apr 2010 22:43:06 +0000 (19:43 -0300)]
Darwin: don't reuse cached descriptors during enumeration

Descriptor reuse was causing scans to return invalid information when
the device at a location has changed.

14 years agov1.0.7 release
Daniel Drake [Mon, 19 Apr 2010 22:36:55 +0000 (19:36 -0300)]
v1.0.7 release