Attachments you submit will be routed for moderation. If you have an account, please
log in first.
Ticket #31: 0001-Removed-the-USBI_OS_HANDLES_TIMEOUT-assumption-and-c.patch
| File 0001-Removed-the-USBI_OS_HANDLES_TIMEOUT-assumption-and-c.patch,
2.5 KB
(added by mikef, 2 years ago) |
|
Removes the USBI_OS_HANDLES_TIMEOUT for Mac OS X
|
-
From 00db5032f326eb5c1c40b8a74764c62b29562ba7 Mon Sep 17 00:00:00 2001
From: Mike F <support@labjack.com>
Date: Mon, 22 Feb 2010 14:22:21 -0700
Subject: [PATCH] Removed the USBI_OS_HANDLES_TIMEOUT assumption and code for darwin machines. This allows both bulk and interrupt transfers to timeout correctly.
---
configure.ac | 1 -
libusb/os/darwin_usb.c | 22 ++++++----------------
2 files changed, 6 insertions(+), 17 deletions(-)
diff --git a/configure.ac b/configure.ac
index 093a875..9ee16f6 100644
|
a
|
b
|
case $host in |
| 25 | 25 | *-darwin*) |
| 26 | 26 | AC_DEFINE(OS_DARWIN, [], [Darwin backend]) |
| 27 | 27 | AC_SUBST(OS_DARWIN) |
| 28 | | AC_DEFINE(USBI_OS_HANDLES_TIMEOUT, [], [Backend handles timeout]) |
| 29 | 28 | AC_MSG_RESULT([Darwin/MacOS X]) |
| 30 | 29 | backend="darwin" |
| 31 | 30 | AM_LDFLAGS="-Wl,-framework -Wl,IOKit -Wl,-framework -Wl,CoreFoundation -Wl,-prebind -no-undefined" |
-
diff --git a/libusb/os/darwin_usb.c b/libusb/os/darwin_usb.c
index fb5b8d5..dde1366 100644
|
a
|
b
|
static int submit_bulk_transfer(struct usbi_transfer *itransfer) { |
| 1096 | 1096 | &transferType, &maxPacketSize, &interval); |
| 1097 | 1097 | |
| 1098 | 1098 | /* submit the request */ |
| 1099 | | /* timeouts are unavailable on interrupt endpoints */ |
| 1100 | | if (transferType == kUSBInterrupt) { |
| 1101 | | if (is_read) |
| | 1099 | if (is_read) { |
| 1102 | 1100 | ret = (*(cInterface->interface))->ReadPipeAsync(cInterface->interface, pipeRef, transfer->buffer, |
| 1103 | | transfer->length, darwin_async_io_callback, itransfer); |
| 1104 | | else |
| | 1101 | transfer->length, darwin_async_io_callback, (void *)itransfer); |
| | 1102 | } |
| | 1103 | else { |
| 1105 | 1104 | ret = (*(cInterface->interface))->WritePipeAsync(cInterface->interface, pipeRef, transfer->buffer, |
| 1106 | | transfer->length, darwin_async_io_callback, itransfer); |
| 1107 | | } else { |
| 1108 | | if (is_read) |
| 1109 | | ret = (*(cInterface->interface))->ReadPipeAsyncTO(cInterface->interface, pipeRef, transfer->buffer, |
| 1110 | | transfer->length, transfer->timeout, transfer->timeout, |
| 1111 | | darwin_async_io_callback, (void *)itransfer); |
| 1112 | | else |
| 1113 | | ret = (*(cInterface->interface))->WritePipeAsyncTO(cInterface->interface, pipeRef, transfer->buffer, |
| 1114 | | transfer->length, transfer->timeout, transfer->timeout, |
| 1115 | | darwin_async_io_callback, (void *)itransfer); |
| 1116 | | } |
| | 1105 | transfer->length, darwin_async_io_callback, (void *)itransfer); |
| | 1106 | } |
| 1117 | 1107 | |
| 1118 | 1108 | if (ret) |
| 1119 | 1109 | usbi_err (TRANSFER_CTX (transfer), "bulk transfer failed (dir = %s): %s (code = 0x%08x)", is_read ? "In" : "Out", |
Download in other formats: