summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libusb/io.c10
-rw-r--r--libusb/os/darwin_usb.c12
-rw-r--r--libusb/version_nano.h2
3 files changed, 15 insertions, 9 deletions
diff --git a/libusb/io.c b/libusb/io.c
index 203fd47..2f38d67 100644
--- a/libusb/io.c
+++ b/libusb/io.c
@@ -3,8 +3,8 @@
* I/O functions for libusb
* Copyright © 2007-2009 Daniel Drake <dsd@gentoo.org>
* Copyright © 2001 Johannes Erdfelt <johannes@erdfelt.com>
- * Copyright © 2019 Nathan Hjelm <hjelmn@cs.umm.edu>
- * Copyright © 2019 Google LLC. All rights reserved.
+ * Copyright © 2019-2022 Nathan Hjelm <hjelmn@cs.unm.edu>
+ * Copyright © 2019-2022 Google LLC. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -311,7 +311,11 @@ if (r == 0 && actual_length == sizeof(data)) {
* libusb_cancel_transfer() is asynchronous/non-blocking in itself. When the
* cancellation actually completes, the transfer's callback function will
* be invoked, and the callback function should check the transfer status to
- * determine that it was cancelled.
+ * determine that it was cancelled. On macOS and iOS it is not possible to
+ * cancel a single transfer. In this case cancelling one tranfer on an endpoint
+ * will cause all transfers on that endpoint to be cancelled. In some cases
+ * the call may cause the endpoint to stall. A call to \ref libusb_clear_halt
+ * may be needed.
*
* Freeing the transfer after it has been cancelled but before cancellation
* has completed will result in undefined behaviour.
diff --git a/libusb/os/darwin_usb.c b/libusb/os/darwin_usb.c
index ecf5d58..574b7bb 100644
--- a/libusb/os/darwin_usb.c
+++ b/libusb/os/darwin_usb.c
@@ -2278,15 +2278,17 @@ static int darwin_abort_transfers (struct usbi_transfer *itransfer) {
/* abort transactions */
#if InterfaceVersion >= 550
if (LIBUSB_TRANSFER_TYPE_BULK_STREAM == transfer->type)
- (*(cInterface->interface))->AbortStreamsPipe (cInterface->interface, pipeRef, itransfer->stream_id);
+ kresult = (*(cInterface->interface))->AbortStreamsPipe (cInterface->interface, pipeRef, itransfer->stream_id);
else
#endif
- (*(cInterface->interface))->AbortPipe (cInterface->interface, pipeRef);
+ kresult = (*(cInterface->interface))->AbortPipe (cInterface->interface, pipeRef);
- usbi_dbg (ctx, "calling clear pipe stall to clear the data toggle bit");
-
- /* newer versions of darwin support clearing additional bits on the device's endpoint */
+#if InterfaceVersion <= 245
+ /* with older releases of IOUSBFamily the OS always clears the host side data toggle. for
+ consistency also clear the data toggle on the device. */
+ usbi_dbg (ctx, "calling ClearPipeStallBothEnds to clear the data toggle bit");
kresult = (*(cInterface->interface))->ClearPipeStallBothEnds(cInterface->interface, pipeRef);
+#endif
return darwin_to_libusb (kresult);
}
diff --git a/libusb/version_nano.h b/libusb/version_nano.h
index b997ad2..99985a0 100644
--- a/libusb/version_nano.h
+++ b/libusb/version_nano.h
@@ -1 +1 @@
-#define LIBUSB_NANO 11755
+#define LIBUSB_NANO 11756