diff options
author | Nikias Bassen | 2019-10-09 01:06:09 +0200 |
---|---|---|
committer | Nikias Bassen | 2019-10-09 01:06:09 +0200 |
commit | e542d279c1185048b9b61aebfb0d726bcb5bdec5 (patch) | |
tree | 4327a695be398ecdee7336c6873cf1921805bcc5 /src/libirecovery.c | |
parent | 34be7a6142d9aecac317c9293fec528d716bee42 (diff) | |
download | libirecovery-e542d279c1185048b9b61aebfb0d726bcb5bdec5.tar.gz libirecovery-e542d279c1185048b9b61aebfb0d726bcb5bdec5.tar.bz2 |
Fix problem with irecovery shell disconnecting bluetooth or other usb devices on macOS
Diffstat (limited to 'src/libirecovery.c')
-rw-r--r-- | src/libirecovery.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/libirecovery.c b/src/libirecovery.c index 377f571..b0cb0d4 100644 --- a/src/libirecovery.c +++ b/src/libirecovery.c @@ -2697,7 +2697,13 @@ IRECV_API irecv_error_t irecv_receive(irecv_client_t client) { return IRECV_E_NO_DEVICE; int bytes = 0; - while (irecv_usb_bulk_transfer(client, 0x81, (unsigned char*) buffer, BUFFER_SIZE, &bytes, 500) == 0) { + while (1) { + irecv_usb_set_interface(client, 1, 1); + int r = irecv_usb_bulk_transfer(client, 0x81, (unsigned char*) buffer, BUFFER_SIZE, &bytes, 500); + irecv_usb_set_interface(client, 0, 0); + if (r != 0) { + break; + } if (bytes > 0) { if (client->received_callback != NULL) { irecv_event_t event; @@ -2705,12 +2711,11 @@ IRECV_API irecv_error_t irecv_receive(irecv_client_t client) { event.data = buffer; event.type = IRECV_RECEIVED; if (client->received_callback(client, &event) != 0) { - return IRECV_E_SUCCESS; + break; } } } else break; } - return IRECV_E_SUCCESS; #endif } |