summaryrefslogtreecommitdiff
path: root/libusb/os/darwin_usb.h
Commit message (Collapse)AuthorAgeFilesLines
* darwin: fix reset deviceNathan Hjelm2019-04-041-2/+6
| | | | | | | | | | | | | | | | | | 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>
* Fixed many compiler warnings about sign and size mismatchSean McBride2019-01-301-1/+1
| | | | | | | | | | - 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>
* darwin: Cleanup and fixes related to Mac OS IOUSBLib interface checksSean McBride2018-01-081-13/+48
| | | | | | | | | | | | | | | | | | | | | - 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>
* darwin: updates to support el capitanNathan Hjelm2015-11-211-2/+8
| | | | | | | | | | | | | | | | 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>
* darwin: Transition to use new transfer completion APIChris Dickens2015-01-261-5/+1
| | | | Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
* Do not use IOUSBDeviceInterface550 or kIOUSBInterfaceInterfaceID550 on OSX ↵Nathan Hjelm2015-01-071-2/+2
| | | | | | | | | | versions older than 10.9. Closes #48 Signed-off-by: Nathan Hjelm <hjelmn@me.com>
* darwin: code cleanupNathan Hjelm2014-05-061-1/+1
| | | | | | Clean up some code in the darwin backend. Signed-off-by: Nathan Hjelm <hjelmn@me.com>
* Misc: Revert all references to libusb/libusb.infohjelmn@cs.unm.edu2014-01-081-1/+1
|
* darwin: avoid enumerating devices more than onceNathan Hjelm2013-06-061-39/+26
| | | | | | | | | | | | | | | | | | | | 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.
* darwin: clean up old codehjelmn@cs.unm.edu2013-05-151-3/+6
| | | | | | | | | 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>
* Add hotplug support to the Darwin backend.Nathan Hjelm2013-05-151-3/+0
| | | | | | | | | | | | | | | 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>
* Darwin: Add support for detecting superspeed devicesNathan Hjelm2012-10-311-1/+7
| | | | * IOUSBFamily 5.0.0 or newer
* Misc: Ensure all sources are UTF-8Pete Batard2012-05-231-1/+1
| | | | * Also remove extra lines at the end of samples
* Darwin: Sync type of num_iso_packets fieldsLudovic Rousseau2012-05-081-1/+1
| | | | | | | | | * 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
* Misc: Rebrand to libusbxPete Batard2012-04-031-2/+2
| | | | | * Mentions of 'libusb' in doxygen are changed to 'libusbx' * Also update copyright notices and remove unneeded EOF LFs
* Fix #64 use of reserved identifiers throughout libusbNathan Hjelm2011-09-221-1/+1
|
* Darwin: Schedule isochronous transfers further in the futureThomas Röfer2011-06-131-0/+1
| | | | | | | 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.
* Darwin: Fix #65 memory leak in submit_iso_transfer()Thomas Röfer2011-06-131-0/+1
| | | | | | | | 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.
* Darwin: Cache device configuration valueNathan Hjelm2010-08-021-1/+2
| | | | | | 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.
* Darwin: Define IO_OBJECT_NULL if not already definedNathan Hjelm2010-05-131-0/+5
| | | | Needed on Mac OSX 10.3
* Darwin: allow devices to be opened multiple timesNathan Hjelm2009-11-211-0/+1
| | | | | | | Allows libusb applications to access multiple interfaces of the same device in the same application. Also fixes a set alt interface bug.
* Darwin backendNathan Hjelm2009-02-161-0/+160