diff options
Diffstat (limited to 'libirecovery.c')
| -rw-r--r-- | libirecovery.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/libirecovery.c b/libirecovery.c index f3d6f28..97432b7 100644 --- a/libirecovery.c +++ b/libirecovery.c | |||
| @@ -359,7 +359,8 @@ irecv_error_t irecv_open(irecv_client_t* pclient) { | |||
| 359 | return error; | 359 | return error; |
| 360 | } | 360 | } |
| 361 | 361 | ||
| 362 | error = irecv_set_interface(client, 0, 0); | 362 | // pod2g 2010-12-28: switched to interface 1.1 by default on non DFU modes |
| 363 | error = irecv_set_interface(client, 1, 1); | ||
| 363 | if (error != IRECV_E_SUCCESS) { | 364 | if (error != IRECV_E_SUCCESS) { |
| 364 | return error; | 365 | return error; |
| 365 | } | 366 | } |
| @@ -408,7 +409,8 @@ irecv_error_t irecv_set_interface(irecv_client_t client, int interface, int alt_ | |||
| 408 | if (check_context(client) != IRECV_E_SUCCESS) return IRECV_E_NO_DEVICE; | 409 | if (check_context(client) != IRECV_E_SUCCESS) return IRECV_E_NO_DEVICE; |
| 409 | 410 | ||
| 410 | #ifndef WIN32 | 411 | #ifndef WIN32 |
| 411 | libusb_release_interface(client->handle, client->interface); | 412 | // pod2g 2010-12-28: this crashes iBoot on MacOSX |
| 413 | //libusb_release_interface(client->handle, client->interface); | ||
| 412 | 414 | ||
| 413 | debug("Setting to interface %d:%d\n", interface, alt_interface); | 415 | debug("Setting to interface %d:%d\n", interface, alt_interface); |
| 414 | if (libusb_claim_interface(client->handle, interface) < 0) { | 416 | if (libusb_claim_interface(client->handle, interface) < 0) { |
| @@ -744,9 +746,10 @@ irecv_error_t irecv_receive(irecv_client_t client) { | |||
| 744 | char buffer[BUFFER_SIZE]; | 746 | char buffer[BUFFER_SIZE]; |
| 745 | memset(buffer, '\0', BUFFER_SIZE); | 747 | memset(buffer, '\0', BUFFER_SIZE); |
| 746 | if (check_context(client) != IRECV_E_SUCCESS) return IRECV_E_NO_DEVICE; | 748 | if (check_context(client) != IRECV_E_SUCCESS) return IRECV_E_NO_DEVICE; |
| 747 | |||
| 748 | int bytes = 0; | ||
| 749 | 749 | ||
| 750 | // pod2g 2010-12-28: switch to interface 0 for console reading then return to interface 1 | ||
| 751 | irecv_set_interface(client, 0, 0); | ||
| 752 | int bytes = 0; | ||
| 750 | while (irecv_bulk_transfer(client, 0x81, (unsigned char*) buffer, BUFFER_SIZE, &bytes, 1000) == 0) { | 753 | while (irecv_bulk_transfer(client, 0x81, (unsigned char*) buffer, BUFFER_SIZE, &bytes, 1000) == 0) { |
| 751 | if (bytes > 0) { | 754 | if (bytes > 0) { |
| 752 | if (client->received_callback != NULL) { | 755 | if (client->received_callback != NULL) { |
| @@ -755,12 +758,16 @@ irecv_error_t irecv_receive(irecv_client_t client) { | |||
| 755 | event.data = buffer; | 758 | event.data = buffer; |
| 756 | event.type = IRECV_RECEIVED; | 759 | event.type = IRECV_RECEIVED; |
| 757 | if (client->received_callback(client, &event) != 0) { | 760 | if (client->received_callback(client, &event) != 0) { |
| 761 | irecv_set_interface(client, 1, 1); | ||
| 758 | return IRECV_E_SUCCESS; | 762 | return IRECV_E_SUCCESS; |
| 759 | } | 763 | } |
| 760 | } | 764 | } |
| 761 | } else break; | 765 | } else break; |
| 762 | } | 766 | } |
| 763 | 767 | ||
| 768 | // pod2g 2010-12-28: MacOSX need a reset if read times out | ||
| 769 | irecv_reset(client); | ||
| 770 | irecv_set_interface(client, 1, 1); | ||
| 764 | return IRECV_E_SUCCESS; | 771 | return IRECV_E_SUCCESS; |
| 765 | } | 772 | } |
| 766 | 773 | ||
