Hans de Goede [Thu, 16 May 2013 15:13:11 +0000 (17:13 +0200)]
linux: Deal with devices being enumerated before their parents are
The linux netlink enumeration code processes devices in readdir order, which
means devices may get enumerated before their parent is, IE on my system
readdir order is (ls -U)
1-1 usb4 2-1.8 6-0:1.0 1-1.4.3 1-1.4.4.1:1.0
2-1 usb5 6-1.4 6-1:1.0 1-1.4.4 1-1.4.4.1:1.1
6-1 usb6 3-0:1.0 2-1.8:1.0 1-0:1.0 1-1.4.4.1:1.2
7-1 usb7 1-1.4.3:1.0 2-1.8:1.1 1-1:1.0
usb1 1-1.4.4.1 1-1.4.4:1.0 2-1.8:1.2 6-1.4:1.0
usb2 1-1.4:1.0 4-0:1.0 7-0:1.0 2-0:1.0
usb3 1-1.4 5-0:1.0 7-1:1.0 2-1:1.0
So 1.4.4.1 will get added (way) before 1.4.4 and indeed:
[ 0.002243] [
00004055] libusbx: debug [linux_get_device_address] scan 1-1.4.4.1
Dev 0x1973bc0 (1-1.4.4.1) has parent (nil)
This patch fixes this by forcing enumeration of the parent from
linux_parent_dev.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Hans de Goede [Thu, 16 May 2013 15:02:08 +0000 (17:02 +0200)]
linux: Move check for a device being added twice to linux_enumerate_device
It is possible for a device to show up between the hotplug code starting to
listen for new devices, and the enumeration of existing devices. This will
cause a device to get enumerated twice.
The next patch in this series adds a different code path which can cause
a device to be enumerated twice, this patch therefor moves the check for
this to linux_enumerate_device, so that this will get caught in all cases.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Hans de Goede [Thu, 16 May 2013 14:56:40 +0000 (16:56 +0200)]
linux: hotplug_enumerate and _disconnect take active_contexts_lock
Take the active_contexts_lock when enumerating over active_contexts.
Note that the active_contexts_lock is taken *before* the hotplug lock, as they
are taken in the same order in the libusb_init path.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Hans de Goede [Thu, 16 May 2013 14:54:02 +0000 (16:54 +0200)]
linux: Replace pthread_mutex with usbi_mutex_static
Boils down to the same thing, but mixing and matching lock types in one
file looks ugly.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Hans de Goede [Thu, 16 May 2013 14:43:24 +0000 (16:43 +0200)]
core: Fixup default_context handling
Now that we set the default context earlier in libusb_init:
-There is no need to do it a second time at the end of libusb_init
-We need to set it to NULL if libusb_init fails later on
-Since it now can be set then reset by libusb_init, libusb_exit needs to
take the lock while testing if the passed in ctx == default_context
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Hans de Goede [Thu, 16 May 2013 14:38:41 +0000 (16:38 +0200)]
core: Fixup cleanup on init error
-mutexes were not being destroyed on backend init failure
-hotplug_cbs_lock mutex was never being destroyed
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Hans de Goede [Thu, 16 May 2013 14:32:33 +0000 (16:32 +0200)]
core: Add ctx to the active context list before backend->init
As soon as backend->init has completed hotplug events may fire, and they
will not get processed on the created context until it has been added
to the active_context list.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Hans de Goede [Thu, 16 May 2013 14:21:23 +0000 (16:21 +0200)]
linux: Take hotplug_lock for scan_devices, hotplug_enumerate and _disconnect
As soon as we've started listening for hp events, hotplug_enumerate and
_disconnect can run, they do test then add / remove operations on the
device list. This can race with scan_devices adding devices, so take
the lock around all 3 to avoid the race.
Also fix the lock not being released in case of linux_start_event_monitor
failure.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Hans de Goede [Thu, 16 May 2013 13:02:12 +0000 (15:02 +0200)]
linux: linux_parent_dev search for . from the right
If hubs are chained to other hubs there will be multiple '.' characters, and
want the last one.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Hans de Goede [Thu, 16 May 2013 11:08:58 +0000 (13:08 +0200)]
configure: Fix --enable-udev help text
We use AC_ARG_ENABLE so the help string should be --enable-udev, so that
the user knows to pass --disable-udev to disable udev
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Nathan Hjelm [Wed, 15 May 2013 13:54:53 +0000 (07:54 -0600)]
linux: fix topology
Find the parent dev by removing the last number after the . or -
(and prepending with usb if only one number is left) and comparing
it against the sysfs_dir or previously scanned devices.
HdG: Drop hardcoded special casing of root-hubs, this is fixed in a better
way in a later commit.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Nathan Hjelm [Wed, 15 May 2013 01:25:55 +0000 (19:25 -0600)]
darwin: fix topology
The parent device should always already be in the context when a
device is processed. Use the parent device's location to find the
parent dev.
Note: we might want to replicate the notion of a locationID in the
core. If done right the parent dev could be determined in the core.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Nathan Hjelm [Sat, 8 Dec 2012 02:55:21 +0000 (19:55 -0700)]
darwin: clean up extraneous includes
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Pete Batard [Wed, 15 May 2013 15:39:47 +0000 (17:39 +0200)]
Add hotplugtest to msvc project files
Pete Batard [Wed, 15 May 2013 15:34:01 +0000 (17:34 +0200)]
Misc fixes
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Peter Stuge [Tue, 8 May 2012 17:22:31 +0000 (19:22 +0200)]
examples: Only check for HAVE_SIGACTION once in Makefile.am
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Hans de Goede [Wed, 15 May 2013 14:19:02 +0000 (16:19 +0200)]
Add INSTALL_WIN.txt eol=crlf to .gitattributes
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Nathan Hjelm [Wed, 15 May 2013 14:11:22 +0000 (16:11 +0200)]
Add some editor meta-comments for proper tab usage
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Sean McBride [Fri, 12 Oct 2012 21:34:25 +0000 (17:34 -0400)]
Core: use C99 flexible array member when possible
Fix clang warning by using C99 flexible array member instead of zero
length array gcc extension
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Nathan Hjelm [Fri, 3 May 2013 14:03:37 +0000 (08:03 -0600)]
darwin: return LIBUSB_ERROR_NOT_FOUND when reading the active config descriptor when the device is not configured.
fixes #172
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
hjelmn@cs.unm.edu [Tue, 23 Apr 2013 22:35:33 +0000 (16:35 -0600)]
darwin: clean up old code
For some time only one type of completion message has been in use in the darwin
backend. The commit cleans up this code. This commit also removes some code
that has never done anything useful. If a pipe has an error it probably means
the device was closed so there is nothing to do.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Nathan Hjelm [Fri, 26 Apr 2013 03:12:45 +0000 (21:12 -0600)]
darwin: fix memory leaks in the darwin backend.
There were two memory leaks in the darwin backend:
- A CFString allocated by IORegistryEntryCreateCFProperty in darwin_get_interface()
was not released.
- The runloop is retained by darwin_open() but was not release by darwin_close().
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Nathan Hjelm [Fri, 26 Apr 2013 03:09:19 +0000 (21:09 -0600)]
core: release the context device list when the context is deleted.
This commit fixes a memory leak in the context list patch. Devices need
to be unref'd when the context is deleted. This can happen if either 1)
the backend init fails, or 2) the context is destroyed by libusb_exit().
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Nathan Hjelm [Wed, 3 Apr 2013 04:12:47 +0000 (22:12 -0600)]
darwin: don't assume an interval of 1 or high/super speed
This patch updates submit_iso_transfer to use the bInterval value of the
endpoint and the speed of the device to determine the last frame of the
transaction.
Fixes: #165
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Nathan Hjelm [Fri, 8 Feb 2013 07:12:13 +0000 (00:12 -0700)]
darwin: add support for the LIBUSB_TRANSFER_ADD_ZERO_PACKET transfer flag.
The zero-length packet is sent by the async event thread if all the following
conditions are met:
1) The packet size is not a multiple of maxPacketSize, and
2) the transfer completed successfully.
References #6.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Nathan Hjelm [Fri, 8 Feb 2013 04:56:30 +0000 (21:56 -0700)]
darwin/libusb_reset: reenumerate device if the device descriptor or any configuration descriptor has changed
Some background: the Linux kernel causes a device to be reenumeration when
reset if the device's descriptors have changed. Darwin does not provide
this feature but instead provides a call to force the reenumeration of
a device. This behavior is required to support the firmware update
protocol used by some devices.
This patch updates darwin_reset to check if either the device or
configuration descriptors have changed. If they have darwin_reset will
ask the OS to reenumerate the device and return LIBUSB_ERROR_NOT_FOUND
or LIBUSB_SUCCESS accordingly.
Fixes #169
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Nathan Hjelm [Sat, 1 Dec 2012 02:17:43 +0000 (19:17 -0700)]
darwin: dpriv->device will never be NULL for a valid device. remove unnecessary code that handled this case
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Nathan Hjelm [Thu, 29 Nov 2012 23:19:11 +0000 (16:19 -0700)]
darwin: allow control messages on devices we can not exclusively open
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Hans de Goede [Wed, 15 May 2013 10:17:42 +0000 (12:17 +0200)]
Bump LIBUSBX_API_VERSION for new hotplug API
And document the minimum version under which hotplug is supported
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Nathan Hjelm [Thu, 29 Nov 2012 23:14:03 +0000 (16:14 -0700)]
Add hotplug support to the Linux backend.
There are two ways to configure hotplug support for Linux: udev, and netlink. It
is strongly recommened that udev support is used on systems that utilize udev.
We reenforce this recommendation by defaulting to --with-udev=yes at configure
time. To enable netlink support run configure with --with-udev=no. If udev
support is enabled all device enumeration is done with udev.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Nathan Hjelm [Thu, 29 Nov 2012 23:13:00 +0000 (16:13 -0700)]
Add hotplug support to the Darwin backend.
Hotplug events are handled by the async event thread. This thread listens for
two events: kIOTerminatedNotification, and kIOFirstMatchNotification. If
either of these events fires the thread will iterate through the appropriate
iterator and will either enumerate or call usbi_disconnect_device depending
on the event.
While adding hotplug support it was discovered that when reading from the IO
registry we need to use kCFNumberSInt32Type for the device location. Using
kCFNumberLongType would cause locations to be sign-extended and not match
what is stored for the session id. This is now fixed.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Nathan Hjelm [Thu, 29 Nov 2012 21:23:26 +0000 (14:23 -0700)]
Add hotplug support.
The internal API is changing as follows:
- Adding two new functions. usbi_connect_device, and usbi_disconnect_device.
Backends must call these functions to add them to the context's device list
at one of two places: initial enumeration (done at init), and on device
attach and removal. These functions need to be called once per context.
- Backends that support hotplug should not provide a get_device_list funtion.
This function is now deprecated and will likely be removed once all backends
support hotplug.
The external API is changing as follows:
- Two new functions have been added to register and deregister callbacks for
hotplug notification: libusb_hotplug_register_callback(),
libusb_hotplug_deregister_callback(). Hotplug callbacks are called by
libusb_handle_events(). Details of the new API can be found in libusb.h.
- A new capability check has been added to check for hotplug support. See
LIBUSB_CAP_HAS_HOTPLUG.
Aa suggested by Xiaofan add new example has been added to show how to use
the new external hotplug API. See examples/hotplugtest.c.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Pete Batard [Wed, 15 May 2013 08:21:16 +0000 (10:21 +0200)]
Fixup .gitignore for examples and tests now living in subdirs
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Nathan Hjelm [Thu, 29 Nov 2012 20:53:41 +0000 (13:53 -0700)]
Core: Cache device descriptors in the core
Discussion: It is necessary to cache the device descriptor in the core to
support reading the descriptors after a device is disconnected. We could
either 1) allow each backend to handle this caching (which would most
certainly duplicate code), or 2) cache the descritors when a device
is added. This patch does the later.
Further discussion: It might be beneficial to cache more than just the
device descriptors in the core. It might also be worthwhile caching the
configuration and BOS descriptors as well.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Nathan Hjelm [Sun, 30 Sep 2012 17:49:01 +0000 (11:49 -0600)]
Core: Keep a list of contexts created by libusb_init()
* This list can be used by backends to determine which contexts
need notification of device removal (and in the future device arrival).
The active_contexts_list is protected from multiple access by the active_contexts_lock.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Hans de Goede [Tue, 23 Apr 2013 08:46:32 +0000 (10:46 +0200)]
libusb.h: Correct errors in doxygen comment for struct libusb_device
The comment refers to the non-existing libusb_device_ref and
libusb_device_unref functions, this should be libusb_ref_device resp.
libusb_unref_device.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Toby Gray [Tue, 16 Apr 2013 14:22:14 +0000 (15:22 +0100)]
WinCE: Include COPYING and license information in binary snapshots.
Pete Batard [Mon, 15 Apr 2013 22:15:10 +0000 (23:15 +0100)]
libusbx-1.0.15
Pete Batard [Sun, 14 Apr 2013 21:38:52 +0000 (22:38 +0100)]
Samples: Fix timeout error on FX3 and logging improvements for fxload
* Add a specific ezusb_fx3_jump() that handles timeout as a non-error
This is required as a successful jump call makes the device disconnect from the bus
* Set default verbosity to 1 and adjust some messages' verbosity level
* Add a new -q option to decrease verbosity
* Add readout of the bootloader version for FX3 devices
* Filter the image types actually supported for FX3
* Fix the "errcode shadows a global variable" warning on some systems
Toby Gray [Thu, 11 Apr 2013 12:40:31 +0000 (13:40 +0100)]
Windows: Correctly clear backend transfer private information
* Without this fix if a transfer is reused then there is a period of
time between it being adding to the flying transfer list and
submitted where the fd value will be the old fd value.
* If this occurs at the same time as all of the following conditions
then the incorrect transfer will be handled as having completed:
* The old fd value in the reused transfer has been recycled for a
currently pending transfer.
* This other pending transfer has a later timeout than the reused
transfer (so therefore comes later in the flying transfer list).
* The other pending transfer completes, therefore signalling the fd.
As the flying transfer list is examined in order when handling events,
the resubmitted transfer with the old fd value will be considered as
completed. This will generally cause a NULL pointer dereference as the
OVERLAPPED structure was already freed.
Also see:
http://libusbx.1081486.n5.nabble.com/Libusbx-devel-PATCH-Fix-NULL-pointer-dereference-in-Windows-and-WinCE-backends-when-reusing-transfers-tt1041.html
Toby Gray [Thu, 4 Apr 2013 12:32:31 +0000 (13:32 +0100)]
WinCE: Add internal build script for WinCE binaries
* Also copy over .pdb for WinCE and WDK generated DLLs
Toby Gray [Thu, 4 Apr 2013 12:33:20 +0000 (13:33 +0100)]
WinCE: Fix x86 build on Visual Studio 2005
Pete Batard [Thu, 4 Apr 2013 18:03:15 +0000 (19:03 +0100)]
libusbx 1.0.15-rc3
Nathan Hjelm [Thu, 4 Apr 2013 20:51:03 +0000 (14:51 -0600)]
OS X: Don't try to work around buggy devices with bInterval = 0 on isochronous...
Ludovic Rousseau [Thu, 4 Apr 2013 16:08:39 +0000 (18:08 +0200)]
Core: fix bug in libusb_has_capability()
The problem was detected by clang on Mac OS X:
warning: use of logical '&&' with constant operand [-Wconstant-logical-operand]
note: use '&' for a bitwise operation
We want to use a bitwise operation and not a logical operation.
Pete Batard [Wed, 3 Apr 2013 18:49:10 +0000 (19:49 +0100)]
libusbx 1.0.15-rc2
Nathan Hjelm [Wed, 3 Apr 2013 10:12:47 +0000 (04:12 -0600)]
OS X: Don't assume an interval of 1
Toby Gray [Wed, 3 Apr 2013 11:02:50 +0000 (12:02 +0100)]
WinCE: Fix missing sources from dist tarball
Pete Batard [Tue, 2 Apr 2013 18:52:16 +0000 (19:52 +0100)]
libusbx 1.0.15-rc1
* Also fix missing header in release tarball
Pete Batard [Sun, 17 Mar 2013 22:13:53 +0000 (22:13 +0000)]
Core: Add HID and kernel detach capability detection for all backends
* Also remove Linux special case from xusb sample.
* Note that LIBUSBX_API_VERSION is incremented as a result of
libusb_has_capability() returning nonzero rather than 1 when
a capability is supported.
* A LIBUSB_CAP_HAS_HOTPLUG is also added, though it is currently
not implemented on any platform
* Closes #102
Toby Gray [Fri, 22 Mar 2013 13:50:01 +0000 (13:50 +0000)]
Windows: Fix USB descriptor creation code for HID devices
* Prior to this fix the location for the next endpoint structure was
obtained by using ed++. This doesn't work as
sizeof(libusb_endpoint_descriptor) is greater than
LIBUSB_DT_ENDPOINT_SIZE due to extra members.
* Closes #110
Pete Batard [Sat, 16 Mar 2013 23:36:47 +0000 (23:36 +0000)]
Samples: More fxload improvements and cleanup
* Type detection when bus,addr is specified
* Improved check for FX3 image header
* Switch back to using -p for bus,addr and use a comma to
match the output of listdevs
Pete Batard [Sat, 16 Mar 2013 16:39:14 +0000 (16:39 +0000)]
Tests: Suppress Visual Studio 2012 Code Analysis warnings
Ludovic Rousseau [Fri, 15 Mar 2013 08:35:16 +0000 (09:35 +0100)]
Samples: fix compiler warning
Make fx3_load_ram a static function.
ezusb.c:534: warning: no previous prototype for ‘fx3_load_ram’
Federico Manzan [Sun, 10 Mar 2013 07:56:56 +0000 (07:56 +0000)]
Samples: fxload improvements and cleanup
* fix C++ compilation
* use stdint types
* allow to specify bus:address as a parameter
* allocate a buffer when transferring FX3 image and check for R/W errors
Vegard Storheil Eriksen [Tue, 12 Mar 2013 15:30:05 +0000 (23:30 +0800)]
OS X: Do not assume HS when submitting isochronous transfer
* Closes #99
Nathan Hjelm [Tue, 12 Mar 2013 15:09:07 +0000 (23:09 +0800)]
OS X: Use kCFNumberSInt32Type when reading device location from the IO registry
* Closes #97
Pete Batard [Tue, 12 Mar 2013 01:26:08 +0000 (01:26 +0000)]
Windows: Fix multiple warnings
* Most of these warnings are false positive from VS2012's "Run Code Analysis"
* Also closes #98: "windows_usb.c:376:30: 'dev_info' may be used uninitialized"
Federico Manzan [Sun, 10 Mar 2013 21:00:00 +0000 (21:00 +0000)]
Samples: Add FX3 firmware upload support for fxload
Hans de Goede [Thu, 7 Mar 2013 11:44:00 +0000 (11:44 +0000)]
Linux: Consume all events on a fd in one go
* This fixes libusb_handle_events_timeout() only handling one event
* Closes #6
Pete Batard [Mon, 4 Mar 2013 21:52:27 +0000 (21:52 +0000)]
Samples: Reinstate interface requests when querying WCID devices
* Reverts commit
939a4782b28c36dfddb68585c4b027a4d5494a5b.
* Closes #96
Pete Batard [Sun, 3 Mar 2013 00:56:06 +0000 (00:56 +0000)]
WinCE: Post integration cleanup
* Update copyrights and switch to UTF-8 everywhere
* Add SleepEx() to missing.h, and move include to libusbi.h
* Remove ifdef for GetSystemTimeAsFileTime()
Pete Batard [Wed, 27 Feb 2013 22:58:49 +0000 (22:58 +0000)]
Misc: Simplify includes and misc. cleanup
* fxload sample provenance
* No need for <sys/types.h> in samples as already in libusb.h
* Don't bother about sscanf_s in xusb
* Use HAVE_### and rely on config.h where possible
* Formal inclusion of <winsock.h> in libusb.h for WinCE and WDK
* Cleanup of Windows' config.h
* Avoid ENAMETOOLONG and ENOTEMPTY conflict between errno.h and winsock.h for WinCE
* Additional newlines & braces cleanup
Xiaofan Chen [Sun, 24 Feb 2013 05:50:00 +0000 (05:50 +0000)]
Tests: Fix broken OS-X and Linux builds
* _dup2 is Windows only. Use dup2 instead
* Breakage was introduced in
76eecc6ce11d1bedee369859899901037dcd4cc2
Simon Haggett [Thu, 21 Feb 2013 16:59:00 +0000 (16:59 +0000)]
WinCE: Don't confirm protocol stalls with device in wince_transfer_callback()
When wince_transfer_callback() observes a stall (io_result set to
ERROR_NOT_SUPPORTED), it checks with the device (by sending a GET_STATUS
control transfer) that the endpoint is really stalled. This check is not
suitable for protocol stalls as these are always cleared at the start of the
next control transfer. When a protocol stall occurs, wince_transfer_callback()
observes that the corresponding control endpoint does not remain stalled and so
forces io_result to ERROR_SUCCESS. This then prevents applications from
detecting that a control request was not supported by the device.
This patch prevents wince_transfer_callback() from attempting to confirm
protocol stalls with the device, allowing io_result to remain set to
ERROR_NOT_SUPPORTED. A couple of comments and a debug log message within
wince_transfer_callback() are also corrected.
Pete Batard [Thu, 21 Feb 2013 00:24:18 +0000 (00:24 +0000)]
Tests: Simplify stdout redirection and fix Windows assertion error on cleanup
* cleanup_test_output() produced an assertion error when compiled with MSVC
due to closing ctx->output_file
* set ctx->output_file to stdout by default
Pete Batard [Thu, 21 Feb 2013 00:11:37 +0000 (00:11 +0000)]
Windows: Don't duplicate paths for HID interfaces
* This caused the many_device_lists to fail after 32 iterations
* Closes #69
Pete Batard [Mon, 18 Feb 2013 22:22:01 +0000 (22:22 +0000)]
Windows: Fix broken WDK compilation
*
790ffc78b008a03c95d10899f53997b504f55c72 moved the inclusion of poll_windows.h
after the use of struct timeval, which removed the hidden winsock.h include
where timeval is defined on the WDK.
* Make the winsock.h include explicit
Ludovic Rousseau [Mon, 18 Feb 2013 19:29:41 +0000 (20:29 +0100)]
Windows: fix compiler warning
libusb/os/threads_windows.c:139:1: warning: '__inline' is not at beginning of declaration [-Wold-style-declaration]
Ludovic Rousseau [Mon, 18 Feb 2013 19:26:46 +0000 (20:26 +0100)]
Windows: fix compiler warning
libusb/os/threads_windows.c: In function 'usbi_cond_timedwait':
libusb/os/threads_windows.c:190:2: warning: nested extern declaration of 'epoch_time' [-Wnested-externs]
Ludovic Rousseau [Sat, 16 Feb 2013 16:23:36 +0000 (17:23 +0100)]
Windows: fix compiler warning
sizeof() returns a size_t not an int
libusb/os/windows_usb.c:1411:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
libusb/os/windows_usb.c:1416:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
Ludovic Rousseau [Sat, 16 Feb 2013 16:07:53 +0000 (17:07 +0100)]
Windows: fix compiler warnings
libusb/os/windows_usb.c:1317:2: warning: initialization discards 'const' qualifier from pointer target type [enabled by default]
libusb/os/windows_usb.c:1317:2: warning: initialization discards 'const' qualifier from pointer target type [enabled by default]
libusb/os/windows_usb.c:1317:2: warning: initialization discards 'const' qualifier from pointer target type [enabled by default]
libusb/os/windows_usb.c:3634:2: warning: initialization discards 'const' qualifier from pointer target type [enabled by default]
libusb/os/windows_usb.c:3634:2: warning: initialization discards 'const' qualifier from pointer target type [enabled by default]
libusb/os/windows_usb.c:3634:2: warning: initialization discards 'const' qualifier from pointer target type [enabled by default]
Ludovic Rousseau [Sat, 16 Feb 2013 16:04:59 +0000 (17:04 +0100)]
Windows: remove useless extern declaration
libusb/os/windows_usb.c:45:13: warning: redundant redeclaration of 'usbi_fd_notification' [-Wredundant-decls]
libusb/libusbi.h:420:6: note: previous declaration of 'usbi_fd_notification' was here
Ludovic Rousseau [Sat, 16 Feb 2013 16:02:40 +0000 (17:02 +0100)]
Windows: fix compiler warnings
libusb/os/windows_usb.c:368:36: warning: no previous prototype for 'get_interface_details_filter' [-Wmissing-prototypes]
libusb/os/windows_usb.c:691:5: warning: no previous prototype for 'get_sub_api' [-Wmissing-prototypes]
libusb/os/windows_usb.c:1179:6: warning: no previous prototype for 'get_api_type' [-Wmissing-prototypes]
Ludovic Rousseau [Sat, 16 Feb 2013 16:00:32 +0000 (17:00 +0100)]
Windows: remove unused function
libusb/os/poll_windows.c:223:13: warning: 'reset_overlapped' defined but not used [-Wunused-function]
Ludovic Rousseau [Sat, 16 Feb 2013 15:58:17 +0000 (16:58 +0100)]
Windows: fix compiler warnings
libusb/os/poll_windows.c:176:5: warning: no previous prototype for '_fd_to_index_and_lock' [-Wmissing-prototypes]
libusb/os/poll_windows.c:197:13: warning: no previous prototype for 'create_overlapped' [-Wmissing-prototypes]
libusb/os/poll_windows.c:211:6: warning: no previous prototype for 'free_overlapped' [-Wmissing-prototypes]
libusb/os/poll_windows.c:223:6: warning: no previous prototype for 'reset_overlapped' [-Wmissing-prototypes]
libusb/os/poll_windows.c:401:6: warning: no previous prototype for '_free_index' [-Wmissing-prototypes]
Ludovic Rousseau [Wed, 17 Oct 2012 16:01:59 +0000 (18:01 +0200)]
Examples: Fix compiler warning
examples/ezusb.c:251:9: warning: implicit conversion loses integer precision: 'unsigned long' to 'unsigned int' [-Wshorten-64-to-32]
off = strtoul(buf+3, NULL, 16);
~ ^~~~~~~~~~~~~~~~~~~~~~~~
Ludovic Rousseau [Sat, 13 Oct 2012 18:22:49 +0000 (20:22 +0200)]
Core: Fix compiler warning
libusb/io.c:1877:35: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
timeout_ms = (tv->tv_sec * 1000) + (tv->tv_usec / 1000);
~ ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
On Mac OS X tv_sec is a __darwin_time_t which is a long, not an int.
Sean McBride [Wed, 31 Oct 2012 15:09:31 +0000 (11:09 -0400)]
Use "" instead of <> for internal includes
some libusbx include files were included with angle brackets, changed to
quotes. Needed to work better in Xcode project
Toby Gray [Wed, 13 Feb 2013 15:21:52 +0000 (15:21 +0000)]
Windows: Update transferred data on timeout or cancel.
* When handling aborted transfer it's possible that some data (but not
the full buffer) was transferred.
* This change ensures that this partially transferred data is recorded
and passed up to the caller.
Hans de Goede [Mon, 11 Feb 2013 15:21:00 +0000 (15:21 +0000)]
Linux: Don't set the USBFS_URB_SHORT_NOT_OK flag on the last urb
* Closes #142
Pete Batard [Sat, 2 Feb 2013 01:02:18 +0000 (01:02 +0000)]
Windows: Improve error reporting in winusbx_claim_interface()
* After the filter detection code is run, the error reported may
have nothing to do with the original error (or report SUCCESS)
and is unhelpful
* Also change TODO comments to default VS2012 task style
Benjamin Dobell [Fri, 1 Feb 2013 14:42:06 +0000 (01:42 +1100)]
Windows: Fixed bug in interface autoclaim
* Bug was introduced in
f2b19e4a32c1445f4fea06beca61e8c7e7757950
* Closes #78
* Closes #80
Ludovic Rousseau [Fri, 26 Oct 2012 08:02:16 +0000 (10:02 +0200)]
Core: Fix warning implicit conversion changes signedness
* Closes #70
Zoltán Kovács [Tue, 29 Jan 2013 00:14:29 +0000 (00:14 +0000)]
Core: Don't wait for completion if cancel_transfer failed
* See http://libusbx.1081486.n5.nabble.com/Libusbx-devel-libusb-interrupt-transfer-does-not-return-in-case-of-error-td626.html
* Closes #76
Pete Batard [Mon, 28 Jan 2013 23:51:53 +0000 (23:51 +0000)]
Windows: Display error code in default case of windows_transfer_callback
Toby Gray [Wed, 16 Jan 2013 02:10:31 +0000 (02:10 +0000)]
WinCE: Add support for WinCE (Solution files)
Toby Gray [Wed, 16 Jan 2013 02:07:29 +0000 (02:07 +0000)]
WinCE: Add support for WinCE (sources)
Toby Gray [Tue, 15 Jan 2013 22:46:49 +0000 (22:46 +0000)]
Windows: Simplify poll_windows and add provisions for WinCE
* Because poll_windows now requires struct usbi_transfer to be
defined, it's inclusion in libusbi.h had to be moved down.
Toby Gray [Tue, 15 Jan 2013 22:36:47 +0000 (22:36 +0000)]
Windows: Add windows_common.h header
* This file contains definition that will be shared between the
Windows and Windows CE backends
Pete Batard [Tue, 15 Jan 2013 22:24:32 +0000 (22:24 +0000)]
Core: Use HAVE_SYS_TYPES_H and HAVE_SIGNAL_H
* These files may not be available on all platforms (eg. WinCE)
Роман Донченко [Fri, 21 Dec 2012 23:08:09 +0000 (03:08 +0400)]
Core: Filter out 8-bit characters in libusb_get_string_descriptor_ascii
* Closes #68
Pete Batard [Mon, 7 Jan 2013 22:00:47 +0000 (22:00 +0000)]
Windows: Add VS2012 solution files
* As well as try to clean up MS's MSVC mess...
Toby Gray [Mon, 26 Nov 2012 13:25:05 +0000 (13:25 +0000)]
Core: Fix incorrect reference counting of default context when first created.
* See http://libusbx.1081486.n5.nabble.com/Libusbx-devel-stress-program-crashes-in-libusb-exit-NULL-tp474p477.html
Toby Gray [Wed, 21 Nov 2012 14:00:31 +0000 (14:00 +0000)]
Tests: Add libusbx stress test
See https://github.com/tobygray/libusbx/tree/testing as well
as http://libusbx.1081486.n5.nabble.com/Libusbx-devel-Crashes-tt433.html#a438
Peter Stuge [Tue, 23 Oct 2012 00:15:23 +0000 (00:15 +0000)]
Autotools: Carry over 2012.10.23 libusb changes
* Use LIBS instead of PC_LIBS_PRIVATE
* Move THREAD_CFLAGS & VISIBILITY_CFLAGS into AM_CFLAGS
* Use AC_SEARCH_LIBS(clock_gettime) for pthreads on Linux
Peter Stuge [Tue, 30 Oct 2012 00:11:41 +0000 (00:11 +0000)]
Core: Avoid short read failures on broken descriptors
* See http://marc.info/?t=
135132844600001&r=1&w=2
Sean McBride [Thu, 8 Nov 2012 19:02:06 +0000 (19:02 +0000)]
Darwin: kAppleVendorID is not in the 10.5 SDK
* Use kIOUSBVendorIDAppleComputer instead
Nathan Hjelm [Wed, 31 Oct 2012 22:54:07 +0000 (22:54 +0000)]
Darwin: Clean up tabs
* Closes #55
Nathan Hjelm [Tue, 2 Oct 2012 14:07:03 +0000 (08:07 -0600)]
Darwin: Add support for detecting superspeed devices
* IOUSBFamily 5.0.0 or newer