Ticket #12839: patch-darwin.c

File patch-darwin.c, 1.4 KB (added by rwilcox (Ryan Wilcox), 17 years ago)

patch from libusb group (for files dir)

Line 
1--- darwin.c.orig       2006-02-25 19:40:17.000000000 +0100
2+++ darwin.c    2006-04-27 22:15:22.000000000 +0200
3@@ -189,6 +189,8 @@
4     return "invalid argument";
5   case kIOReturnAborted:
6     return "transaction aborted";
7+  case kIOReturnNotResponding:
8+    return "the device is not responding";
9   default:
10     return "unknown error";
11   }
12@@ -207,6 +209,7 @@
13   case kIOUSBNoAsyncPortErr:
14     return ENXIO;
15   case kIOReturnExclusiveAccess:
16+  case kIOReturnNotResponding:
17     return EBUSY;
18   case kIOUSBPipeStalled:
19     return LUSBDARWINSTALL;
20@@ -838,19 +841,13 @@
21 
22   if (result == kIOReturnSuccess) {
23     /* wait for write to complete */
24-    if (CFRunLoopRunInMode(kCFRunLoopDefaultMode, (timeout+999)/1000, true) == kCFRunLoopRunTimedOut) {
25-      (*(device->interface))->AbortPipe(device->interface, pipeRef);
26-      CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0, true); /* Pick up aborted callback */
27-      if (usb_debug)
28-       fprintf(stderr, "usb_bulk_read: input timed out\n");
29-    }
30+    CFRunLoopRun();
31   }
32 
33   CFRunLoopRemoveSource(CFRunLoopGetCurrent(), cfSource, kCFRunLoopDefaultMode);
34   
35   /* Check the return code of both the write and completion functions. */
36-  if (result != kIOReturnSuccess || (rw_arg.result != kIOReturnSuccess && 
37-      rw_arg.result != kIOReturnAborted) ) {
38+  if (result != kIOReturnSuccess || rw_arg.result != kIOReturnSuccess) {
39     int error_code;
40     char *error_str;
41