From: Nathan Hjelm Date: Fri, 12 Jun 2020 05:31:36 +0000 (-0600) Subject: darwin: use GetPipePropertiesV3 on 10.9 and later X-Git-Tag: upstream/1.0.24~64 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d55b2fdafb31f1c85a611f9c5438d47a54535a59;p=platform%2Fupstream%2Flibusb.git 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 --- 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