diff options
Diffstat (limited to 'adb/usb_osx.c')
-rw-r--r-- | adb/usb_osx.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/adb/usb_osx.c b/adb/usb_osx.c index 45ce444..ee893f5 100644 --- a/adb/usb_osx.c +++ b/adb/usb_osx.c @@ -197,7 +197,8 @@ AndroidInterfaceAdded(void *refCon, io_iterator_t iterator) kr = (*dev)->GetDeviceProduct(dev, &product); kr = (*dev)->GetLocationID(dev, &locationId); if (kr == 0) { - snprintf(devpathBuf, sizeof(devpathBuf), "usb:%lX", locationId); + snprintf(devpathBuf, sizeof(devpathBuf), "usb:%" PRIu32 "X", + (unsigned int)locationId); devpath = devpathBuf; } kr = (*dev)->USBGetSerialNumberStringIndex(dev, &serialIndex); @@ -512,14 +513,18 @@ int usb_read(usb_handle *handle, void *buf, int len) return -1; } - result = - (*handle->interface)->ReadPipe(handle->interface, - handle->bulkIn, buf, &numBytes); + result = (*handle->interface)->ReadPipe(handle->interface, handle->bulkIn, buf, &numBytes); - if (0 == result) + if (kIOUSBPipeStalled == result) { + DBG(" Pipe stalled, clearing stall.\n"); + (*handle->interface)->ClearPipeStall(handle->interface, handle->bulkIn); + result = (*handle->interface)->ReadPipe(handle->interface, handle->bulkIn, buf, &numBytes); + } + + if (kIOReturnSuccess == result) return 0; else { - DBG("ERR: usb_read failed with status %d\n", result); + DBG("ERR: usb_read failed with status %x\n", result); } return -1; |