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

  • configure.ac

    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 
    2525*-darwin*) 
    2626        AC_DEFINE(OS_DARWIN, [], [Darwin backend]) 
    2727        AC_SUBST(OS_DARWIN) 
    28         AC_DEFINE(USBI_OS_HANDLES_TIMEOUT, [], [Backend handles timeout]) 
    2928        AC_MSG_RESULT([Darwin/MacOS X]) 
    3029        backend="darwin" 
    3130        AM_LDFLAGS="-Wl,-framework -Wl,IOKit -Wl,-framework -Wl,CoreFoundation -Wl,-prebind -no-undefined" 
  • libusb/os/darwin_usb.c

    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) { 
    10961096                                                 &transferType, &maxPacketSize, &interval); 
    10971097   
    10981098  /* submit the request */ 
    1099   /* timeouts are unavailable on interrupt endpoints */ 
    1100   if (transferType == kUSBInterrupt) { 
    1101     if (is_read) 
     1099    if (is_read) { 
    11021100      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 { 
    11051104      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    } 
    11171107 
    11181108  if (ret) 
    11191109    usbi_err (TRANSFER_CTX (transfer), "bulk transfer failed (dir = %s): %s (code = 0x%08x)", is_read ? "In" : "Out",