777 Commits
Author SHA1 Message Date
Pete Batard 40e10e2448 [internal] bumped internal version pbr346 2011-11-02 13:53:19 +00:00
Pete Batard 46b86093e5 [xusb] fix Clang warning about unused variable 2011-11-02 13:48:51 +00:00
Pete Batard cf3b3dcdb7 [windows] fix Clang warnings about unused assignations 2011-11-02 13:47:35 +00:00
Pete Batard 3a1ff351bf [xusb] fix usleep() not available in Clang 2011-11-02 13:15:27 +00:00
Pete Batard c4ca16e6cc [xusb] address warnings
* uint32_t* being caset to int*
* simplify allocation using calloc
* fix VS2010 Intellisense warnings
2011-11-02 12:30:31 +00:00
Pete Batard 7d33b9cca8 [windows] memory allocation improvements
* add missing warning on alloc failure
* prefer calloc() to malloc()
* add casts to address VS2010 IntelliSense warnings
2011-11-02 12:22:01 +00:00
Pete Batard f63e7bbf6b [xusb] added recipient for WCID device control request
* note that WinUSB prevents proper use of LIBUSB_RECIPIENT_INTERFACE
  for Extended Properties: http://www.lvr.com/forum/index.php?topic=331
2011-11-02 11:25:42 +00:00
Pete Batard 54244d1e39 [xusb] remove unused variable 2011-10-31 01:46:56 +00:00
Pete Batard 52a0e1857c [xusb] fix wrong IF index value for OS Feature Descriptor retrieval 2011-09-23 21:28:21 +01:00
Pete Batard 2d786399ab [internal] bumped internal version pbr345 2011-09-23 14:14:22 +01:00
Pete Batard 63dc2ef327 [darwin] fix "non-POSIX variable name" from automake with X-Code
* introduced by the windres step improvement:
  libusb/Makefile.am:28: pkg_v_rc_$(V: non-POSIX variable name
  libusb/Makefile.am:29: pkg_v_rc_$(AM_DEFAULT_VERBOSITY: non-POSIX variable name
2011-09-23 13:57:39 +01:00
Peter Stuge fad9572c6b [autotools] improves "cleaner windres step"
* reverts 3209815810
2011-09-23 13:18:03 +01:00
Peter Stuge 46c8847c0c [logging] improve "remove warnings when logging is disabled for MinGW/cygwin"
* reverts 5292589344
2011-09-23 13:15:47 +01:00
Nathan Hjelm 6ea372d8e5 [darwin] add topology-analysis code to OS X backend 2011-09-23 13:12:39 +01:00
Dave Camarillo c40394342a [enum] fix bad realloc trigger for the unref_list array
* indexes were outgrowing the array before realloc,
  resulting in out of bound access and crash.
2011-09-23 13:10:22 +01:00
Pete Batard 15f4edbfd0 [xusb] added readout of MS WinUSB Feature Descriptors
* These descriptors are used for automated WinUSB driver
  installation on Windows 8
* http://msdn.microsoft.com/en-us/library/windows/hardware/hh450799.aspx
2011-09-22 18:02:53 +01:00
Pete Batard fdd1b02625 [internal] bumped internal version pbr344 2011-09-19 21:22:12 +01:00
Pete Batard 9651e53db7 [USB 3.0] added native Windows 8 support 2011-09-19 21:19:20 +01:00
Pete Batard 32c45cbdf2 [misc] align with 1.0.9-rc1 2011-09-19 21:17:46 +01:00
Pete Batard 3f0578677e [WDK] fixes case sensitivity test when copying the DLL 2011-09-19 13:10:23 +01:00
Pete Batard 5dc579ab36 [internal] bumped internal version pbr343 2011-09-12 14:28:13 +01:00
Pete Batard 5292589344 [logging] remove warnings when logging is disabled for MinGW/cygwin
* also trailing whitespaces and formatting
2011-09-12 14:27:29 +01:00
Pete Batard 5f950c84fe [MinGW] fix that annoying timercmp warning in io.c
* MinGW was issuing a "suggest parenthesis" warning with timercmp
2011-09-12 12:48:22 +01:00
Pete Batard 3209815810 [autotools] cleaner windres step 2011-09-12 12:46:26 +01:00
Pete Batard 0a752d777d [autotools] force Windows version to Windows 2000 or later 2011-09-12 11:51:11 +01:00
Pete Batard 302aee7d0c [internal] bumped internal version pbr342 2011-09-06 12:30:22 +01:00
Pete Batard 3fbf9a9b69 [samples] return NULL in dpfp_threaded poll_thread_main to avoid Cygwin warning 2011-09-06 12:29:55 +01:00
Vitali Lovich a6479690a3 [contrib] add non-officially supported CMake support 2011-09-06 12:18:58 +01:00
Peter Stuge 4504b66235 add missing LIBUSB_CLASS codes 2011-09-06 12:15:25 +01:00
Pete Batard 50ba04d3ec get_device_speed fixes and addons
* fixed typos and missing breaks
* device_speed in .def
* device_speed in xusb
2011-09-06 12:00:42 +01:00
Nathan Hjelm 48c695606e Darwin: Optimize device iteration further using saved device location 2011-09-06 11:11:13 +01:00
Trygve Laugstøl 037234078b Darwin: Provide libusb_get_device_speed() data 2011-09-06 11:09:35 +01:00
Nathan Hjelm bf12efb464 Darwin: Improve device enumeration performance and save device location
[stuge: Formatting fixes and split out libusb_get_device_speed() change]
2011-09-06 11:09:23 +01:00
Pete Batard 4fe08970e2 Windows: Provide libusb_get_device_speed() data
* use (currently superspeed unaware) USB_NODE_CONNECTION_INFORMATION_EX

[stuge: Explicitly convert OS device speeds to libusb device speeds]
2011-09-06 11:02:40 +01:00
Hans de Goede 605c730422 Linux: Provide libusb_get_device_speed() data from sysfs
Signed-off-by: Hans de Goede <[email protected]>
2011-09-06 10:53:53 +01:00
Hans de Goede c384ec68aa Add new API function libusb_get_device_speed()
Reworked version of my earlier patch, largely modelled after (if not
copy and pasted from) Trygve Laugstøl's <[email protected]> similar
commit 5a6541e0d80fb1f21e2b960bc2337a612f9d74fb in
git://git.libusb.org/libusb-trygvis.git
http://git.libusb.org/libusb-trygvis.git
http://git.libusb.org/?p=libusb-trygvis.git;a=commitdiff;h=5a6541e0d

This patch does not add any OS specific code. The supporting code in
each backend follows in separate patches.

Signed-off-By: Hans de Goede <[email protected]>
2011-09-06 10:53:23 +01:00
Hans de Goede 328d9fd76a Linux: Use __read_sysfs_attr() to get busnum and devaddr
Remove code duplication.

Signed-off-by: Hans de Goede <[email protected]>
2011-09-06 10:43:10 +01:00
Hans de Goede f471c635db Linux: Add __read_sysfs_attr() helper function
On Linux we often need to read (postive) integers from sysfs. This patch
adds a helper function for this. This is a preparation patch for adding
a libusb_get_device_speed() function to libusb.

Signed-off-by: Hans de Goede <[email protected]>
2011-09-06 10:42:58 +01:00
Hans de Goede bec707ec82 Linux: Stop kernel from re-attaching in-kernel driver after reset
When an interface is bound to the usbfs driver (iow claimed), the
kernel will unbind it, and then after the reset do a device_attach
on the interface, which will bind the default in kernel driver to
the interface.

So if an app has detached the in kernel driver, and claimed the
interface and then does a libusb_reset_device. Things end up with
the interface no longer being bound to the usbfs driver (so no longer
claimed) and instead it is bound to the in kernel driver (iow the in
kernel driver is re-attached).

We can stop this from happening by releasing all claimed interfaces
before the reset, as the kernel will not do the device attach after
reset, if no driver was bound to the interface before the reset.

Signed-off-by: Hans de Goede <[email protected]>
2011-09-06 10:41:37 +01:00
Hans de Goede 01d425426b Core: Use USB_MAXINTERFACES rather then sizeof(claimed_interfaces)
claimed_interfaces is a long and thus its size differs on 32
versus 64 bits, this patch uses USB_MAXINTERFACES instead of
sizeof(claimed_interfaces) on interface number range checks
for consistent behavior independent of the arch.

Signed-off-by: Hans de Goede <[email protected]>
2011-09-06 10:41:25 +01:00
Hans de Goede 1545bc6a40 Linux: Fix warnings seen when compiling with gcc-4.6
Compiling with gcc-4.6 results in the following warnings:
os/linux_usbfs.c: In function 'op_get_configuration':
os/linux_usbfs.c:1144:6: warning: variable 'r' set but not used ...
os/linux_usbfs.c: In function 'op_handle_events':
os/linux_usbfs.c:2091:40: warning: 'status' may be used uninitialized ...
os/linux_usbfs.c:2044:6: note: 'status' was declared here
dpfp.c: In function 'save_to_file':
dpfp.c:228:9: warning: variable 'ignore' set but not used ...
dpfp_threaded.c: In function 'save_to_file':
dpfp_threaded.c:257:9: warning: variable 'ignore' set but not used ...

This patch fixes these. (The second comes from handle_control_completion()
which gcc seems to inline into op_handle_events().)

Signed-off-by: Hans de Goede <[email protected]>
[stuge: Add fixes for dpfp examples and update source references]
2011-09-06 10:41:13 +01:00
Sean McBride 1b52e6f1a1 Darwin: Fix #100 warning cast to pointer from integer of different size 2011-09-06 10:35:27 +01:00
Sean McBride 9da384914d configure.ac: Fix #97 clang warning about -fgnu89-inline
Remove the test that sets the flag since GNU89 inline semantics are not
required by libusb.

[stuge: Also remove reference to the test result]
2011-09-06 10:33:31 +01:00
Sean McBride 2934cf3604 Darwin: Fix #63 error when apps use Objective-C garbage collection 2011-09-06 10:31:26 +01:00
Sean McBride 71b380b0b0 Darwin: Fix #28 clang analyzer warning about unbalanced retain/release 2011-09-06 10:30:18 +01:00
Sean McBride 5e36dd39bf io.c: Fix clang analyzer warning about unused variable
References #28.
2011-09-06 10:28:51 +01:00
Ludovic Rousseau 77f501d917 Do not include useless pthread.h
The code does not use threads so no need to #include <pthread.h>
Fixes #74.
2011-09-05 12:49:55 +01:00
Alan Ott ee411c5195 Fix #70 race condition in sysfs_get_device_list()
Change the way libusb chooses between using sysfs and usbfs for information
about the attached devies.  Using the old method, a race condition could
occur if a device was unplugged just before (or during) the call to
libusb_get_device_list(), corrupting the internal sysfs_can_relate_devices
and sysfs_has_descriptors variables and preventing libusb_get_device_list()
from working in future calls.

The old method was based on the assumption that if certain sysfs files
(eg: busnum) could not be opened, that indicated an inadequacy of sysfs
(ie: the running kernel's sysfs version did not contain those files),
when in reality those files couldn't be opened because the device had
been unplugged.

The new method checks the adequacy of sysfs during libusb_init()
(op_init()) and if a sysfs file cannot be opened, it is now assumed that
it is because the device has been unplugged, not because sysfs is
inadequate.

Signed-off-by: Alan Ott <[email protected]>
[stuge: Include closedir() bugfix posted in ticket by Arne Laansoo]
[stuge: Remove dead code in sysfs_scan_device() found by Hans de Goede]
2011-09-05 12:48:01 +01:00
Vitali Lovich e28b097e75 Darwin: Fix #108 crash when a device is unplugged 2011-09-05 12:44:58 +01:00
Vitali Lovich aa282fe9d5 descriptor.c: Fix buffer read overflow caught by valgrind
In parse_interface() an unexpected descriptor would be parsed without
validating the descriptor's length.  It is possible for size to be 0 at
this point, which means that the parsing would read past the end of the
source buffer.  Fix #83 by checking the length of the remaining buffer
before parsing.
2011-09-05 12:44:47 +01:00