| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit fixes the backend of reset device to restore the state
of the device if possible. This fixes a bug introduced in
c14ab5fc4d22749aab9e3534d56012718a0b0f67. The previous commit
was necessary due to changes in the system USB stack that
essentially turned the ResetDevice function into a no-op. This
required libusb to move to USBDevuceReEnumerate to effectively
reset the device. The problem is that both the device handle and
libusb devices became invalid. This commit fixes the bug by
waiting for the re-enumeration to complete then 1) checking
whether the descriptors changed, 2) restoring the active
configuration, and 3) restoring claimed interfaces.
Closes #523
Signed-off-by: Nathan Hjelm <hjelmn@me.com>
|
|
|
|
|
|
|
|
|
|
| |
- added various casts
- added some asserts where the casts made assumptions
- enabled additional warnings in Xcode project (especially -Wshorten-64-to-32)
Closes #509
Signed-off-by: Nathan Hjelm <hjelmn@me.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- revisited fix to issue #48:
- guard kIOUSBDeviceInterfaceID500 with 10.8 deployment (not 10.9).
I believe a typo in the bug report caused this to be guarded too
strictly.
- added deployment target tests to every interface check. Necessary
because merely checking for a macro definition tells us nothing
about what features are available at runtime. It is common to build
against new SDKs but deploy to older OSes.
- properly guard kIOUSBInterfaceInterfaceID700 against 10.10 deployment
(not 10.9). It was added in 10.10. Probably a copy-pasto.
- changed non-existent kIOUSBDeviceInterfaceID220 to
kIOUSBDeviceInterfaceID197. Probably a copy-pasto.
- don't use defines like MAC_OS_X_VERSION_10_9 since they don't exist in
older SDKs and would fail to compile, use raw numbers instead.
- added tests for newer interfaces: kIOUSBInterfaceInterfaceID800,
kIOUSBInterfaceInterfaceID650, kIOUSBDeviceInterfaceID650.
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
With the new USB stack Apple changed the underlying device class from
IOUSBDevice to IOUSBHostDevice. Additionally, they removed the PortNum
property from the IO registry entry. This commit add code to detect the
currently running xnu version. If the version is at least 15 (10.11.0)
the new device class is used to find usb devices and the port number
is read from the IOService parent of the USB device instead of the
PortNum property.
Closes #127
May have some effect on either #123 or #96.
Signed-off-by: Nathan Hjelm <hjelmn@me.com>
|
|
|
|
| |
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
|
|
|
|
|
|
|
|
|
|
| |
versions
older than 10.9.
Closes #48
Signed-off-by: Nathan Hjelm <hjelmn@me.com>
|
|
|
|
|
|
| |
Clean up some code in the darwin backend.
Signed-off-by: Nathan Hjelm <hjelmn@me.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch attempts to avoid enumerating devices multiple times by
keeping a cache of device information (IOUSBDeviceInterface pointers,
device descriptors, etc) between calls to libusb_init(). This should
avoid two potential problems:
1) Devices that respond slowly to DeviceRequest. These devices can
take multiple seconds to respond and they usually respond with
a failure (on older versions of OSX at least). By keeping track
of these devices the penalty for enumerating them will be paid
only once.
2) Repeated enumeration of the same device may cause
IOCreatePlugInInterfaceForService() to fail. The root cause of
this problem is not well understood but might be a leak in
IOUSBFamily.
To clean up the cached device information an atexit() function is
used.
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
| |
* IOUSBFamily 5.0.0 or newer
|
|
|
|
| |
* Also remove extra lines at the end of samples
|
|
|
|
|
|
|
|
|
| |
* num_iso_packets was a "size_t" in "struct darwin_transfer_priv" and an
"int" in "struct libusb_transfer". The field is now an int in the two
structures
* Fixes warning
os/darwin_usb.c: In function ‘submit_iso_transfer’:
os/darwin_usb.c:1334: warning: comparison between signed and unsigned
|
|
|
|
|
| |
* Mentions of 'libusb' in doxygen are changed to 'libusbx'
* Also update copyright notices and remove unneeded EOF LFs
|
| |
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
Needed on Mac OSX 10.3
|
|
|
|
|
|
|
| |
Allows libusb applications to access multiple interfaces of the same
device in the same application.
Also fixes a set alt interface bug.
|
|
|