diff options
author | Nathan Hjelm <hjelmn@cs.unm.edu> | 2013-04-02 22:12:47 -0600 |
---|---|---|
committer | Hans de Goede <hdegoede@redhat.com> | 2013-05-15 20:43:35 +0200 |
commit | bae927f89624a1ccdaea9581e5e6d57c7675e72c (patch) | |
tree | 8e90e7d93cdf26640e37fc633fa6b3745819fb90 /libusb/os/darwin_usb.c | |
parent | ae712a7be927d3ee4ed81ceae06a839f872fe8ff (diff) | |
download | libusb-bae927f89624a1ccdaea9581e5e6d57c7675e72c.tar.gz |
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>
Diffstat (limited to 'libusb/os/darwin_usb.c')
-rw-r--r-- | libusb/os/darwin_usb.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/libusb/os/darwin_usb.c b/libusb/os/darwin_usb.c index bc51b91..babfa28 100644 --- a/libusb/os/darwin_usb.c +++ b/libusb/os/darwin_usb.c @@ -1459,6 +1459,10 @@ static int submit_iso_transfer(struct usbi_transfer *itransfer) { cInterface = &priv->interfaces[iface]; + /* determine the properties of this endpoint and the speed of the device */ + (*(cInterface->interface))->GetPipeProperties (cInterface->interface, pipeRef, &direction, &number, + &transferType, &maxPacketSize, &interval); + /* Last but not least we need the bus frame number */ kresult = (*(cInterface->interface))->GetBusFrameNumber(cInterface->interface, &frame, &atTime); if (kresult) { @@ -1488,9 +1492,12 @@ static int submit_iso_transfer(struct usbi_transfer *itransfer) { transfer->num_iso_packets, tpriv->isoc_framelist, darwin_async_io_callback, itransfer); - cInterface->frames[transfer->endpoint] = frame + transfer->num_iso_packets * (1 << (interval - 1)); - if (transfer->dev_handle->dev->speed >= LIBUSB_SPEED_HIGH) - cInterface->frames[transfer->endpoint] /= 8; + if (LIBUSB_SPEED_FULL == transfer->dev_handle->dev->speed) + /* Full speed */ + cInterface->frames[transfer->endpoint] = frame + transfer->num_iso_packets * (1 << (interval - 1)); + else + /* High/super speed */ + cInterface->frames[transfer->endpoint] = frame + transfer->num_iso_packets * (1 << (interval - 1)) / 8; if (kresult != kIOReturnSuccess) { usbi_err (TRANSFER_CTX (transfer), "isochronous transfer failed (dir: %s): %s", IS_XFERIN(transfer) ? "In" : "Out", |