summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Hjelm <hjelmn@google.com>2020-06-11 23:31:36 -0600
committerNathan Hjelm <hjelmn@google.com>2020-06-11 23:31:36 -0600
commitd55b2fdafb31f1c85a611f9c5438d47a54535a59 (patch)
treefabe7835103f43bcb32ca7733f148a8ab116d1dc
parenta5962ba96863aad871d2e4d5d7ddae018f12e42c (diff)
downloadlibusb-d55b2fdafb31f1c85a611f9c5438d47a54535a59.tar.gz
darwin: use GetPipePropertiesV3 on 10.9 and later
Apple added the GetPipePropertiesV3 in IOUSBFamily version 550. The old function appears to be deprecated. When 10.8.x and older are no longer supported the GetPipeProperties call should be removed. Signed-off-by: Nathan Hjelm <hjelmn@google.com>
-rw-r--r--libusb/os/darwin_usb.c16
-rw-r--r--libusb/version_nano.h2
2 files changed, 15 insertions, 3 deletions
diff --git a/libusb/os/darwin_usb.c b/libusb/os/darwin_usb.c
index e6e4943..a1474ba 100644
--- a/libusb/os/darwin_usb.c
+++ b/libusb/os/darwin_usb.c
@@ -1770,11 +1770,16 @@ static int submit_bulk_transfer(struct usbi_transfer *itransfer) {
IOReturn ret;
uint8_t transferType;
- /* None of the values below are used in libusbx for bulk transfers */
- uint8_t direction, number, interval, pipeRef;
+ uint8_t pipeRef;
uint16_t maxPacketSize;
struct darwin_interface *cInterface;
+#if InterfaceVersion >= 550
+ IOUSBEndpointProperties pipeProperties;
+#else
+ /* None of the values below are used in libusb for bulk transfers */
+ uint8_t direction, number, interval;
+#endif
if (ep_to_pipeRef (transfer->dev_handle, transfer->endpoint, &pipeRef, NULL, &cInterface) != 0) {
usbi_err (TRANSFER_CTX (transfer), "endpoint not found on any open interface");
@@ -1782,8 +1787,15 @@ static int submit_bulk_transfer(struct usbi_transfer *itransfer) {
return LIBUSB_ERROR_NOT_FOUND;
}
+#if InterfaceVersion >= 550
+ ret = (*(cInterface->interface))->GetPipePropertiesV3 (cInterface->interface, pipeRef, &pipeProperties);
+
+ transferType = pipeProperties.bTransferType;
+ maxPacketSize = pipeProperties.wMaxPacketSize;
+#else
ret = (*(cInterface->interface))->GetPipeProperties (cInterface->interface, pipeRef, &direction, &number,
&transferType, &maxPacketSize, &interval);
+#endif
if (ret) {
usbi_err (TRANSFER_CTX (transfer), "bulk transfer failed (dir = %s): %s (code = 0x%08x)", IS_XFERIN(transfer) ? "In" : "Out",
diff --git a/libusb/version_nano.h b/libusb/version_nano.h
index 2b653c5..2b710bd 100644
--- a/libusb/version_nano.h
+++ b/libusb/version_nano.h
@@ -1 +1 @@
-#define LIBUSB_NANO 11519
+#define LIBUSB_NANO 11520