diff options
| author | 2019-10-09 01:06:09 +0200 | |
|---|---|---|
| committer | 2019-10-09 01:06:09 +0200 | |
| commit | e542d279c1185048b9b61aebfb0d726bcb5bdec5 (patch) | |
| tree | 4327a695be398ecdee7336c6873cf1921805bcc5 | |
| 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
| -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) { | |||
| 2697 | return IRECV_E_NO_DEVICE; | 2697 | return IRECV_E_NO_DEVICE; |
| 2698 | 2698 | ||
| 2699 | int bytes = 0; | 2699 | int bytes = 0; |
| 2700 | while (irecv_usb_bulk_transfer(client, 0x81, (unsigned char*) buffer, BUFFER_SIZE, &bytes, 500) == 0) { | 2700 | while (1) { |
| 2701 | irecv_usb_set_interface(client, 1, 1); | ||
| 2702 | int r = irecv_usb_bulk_transfer(client, 0x81, (unsigned char*) buffer, BUFFER_SIZE, &bytes, 500); | ||
| 2703 | irecv_usb_set_interface(client, 0, 0); | ||
| 2704 | if (r != 0) { | ||
| 2705 | break; | ||
| 2706 | } | ||
| 2701 | if (bytes > 0) { | 2707 | if (bytes > 0) { |
| 2702 | if (client->received_callback != NULL) { | 2708 | if (client->received_callback != NULL) { |
| 2703 | irecv_event_t event; | 2709 | irecv_event_t event; |
| @@ -2705,12 +2711,11 @@ IRECV_API irecv_error_t irecv_receive(irecv_client_t client) { | |||
| 2705 | event.data = buffer; | 2711 | event.data = buffer; |
| 2706 | event.type = IRECV_RECEIVED; | 2712 | event.type = IRECV_RECEIVED; |
| 2707 | if (client->received_callback(client, &event) != 0) { | 2713 | if (client->received_callback(client, &event) != 0) { |
| 2708 | return IRECV_E_SUCCESS; | 2714 | break; |
| 2709 | } | 2715 | } |
| 2710 | } | 2716 | } |
| 2711 | } else break; | 2717 | } else break; |
| 2712 | } | 2718 | } |
| 2713 | |||
| 2714 | return IRECV_E_SUCCESS; | 2719 | return IRECV_E_SUCCESS; |
| 2715 | #endif | 2720 | #endif |
| 2716 | } | 2721 | } |
