diff options
author | pod2g | 2010-12-28 22:56:16 +0100 |
---|---|---|
committer | pod2g | 2010-12-28 22:56:16 +0100 |
commit | f36be3da06a2175f49ed2b987b684fdf66871b58 (patch) | |
tree | 998a5468298b6ebe3dc316681df19a60769d1327 | |
parent | 9440393948de8d8db43f29f3bc859d9968085f15 (diff) | |
download | libirecovery-f36be3da06a2175f49ed2b987b684fdf66871b58.tar.gz libirecovery-f36be3da06a2175f49ed2b987b684fdf66871b58.tar.bz2 |
MacOSX test: Console reading fixed
-rw-r--r-- | irecovery.c | 5 | ||||
-rw-r--r-- | libirecovery.c | 15 |
2 files changed, 14 insertions, 6 deletions
diff --git a/irecovery.c b/irecovery.c index 39ac425..3e32395 100644 --- a/irecovery.c +++ b/irecovery.c @@ -277,6 +277,9 @@ int main(int argc, char* argv[]) { } } + if (verbose) irecv_set_debug_level(verbose); + + irecv_init(); irecv_client_t client = NULL; for (i = 0; i <= 5; i++) { debug("Attempting to connect... \n"); @@ -291,8 +294,6 @@ int main(int argc, char* argv[]) { } } - if (verbose) irecv_set_debug_level(verbose); - switch (action) { case kResetDevice: irecv_reset(client); 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) { return error; } - error = irecv_set_interface(client, 0, 0); + // pod2g 2010-12-28: switched to interface 1.1 by default on non DFU modes + error = irecv_set_interface(client, 1, 1); if (error != IRECV_E_SUCCESS) { return error; } @@ -408,7 +409,8 @@ irecv_error_t irecv_set_interface(irecv_client_t client, int interface, int alt_ if (check_context(client) != IRECV_E_SUCCESS) return IRECV_E_NO_DEVICE; #ifndef WIN32 - libusb_release_interface(client->handle, client->interface); + // pod2g 2010-12-28: this crashes iBoot on MacOSX + //libusb_release_interface(client->handle, client->interface); debug("Setting to interface %d:%d\n", interface, alt_interface); if (libusb_claim_interface(client->handle, interface) < 0) { @@ -744,9 +746,10 @@ irecv_error_t irecv_receive(irecv_client_t client) { char buffer[BUFFER_SIZE]; memset(buffer, '\0', BUFFER_SIZE); if (check_context(client) != IRECV_E_SUCCESS) return IRECV_E_NO_DEVICE; - - int bytes = 0; + // pod2g 2010-12-28: switch to interface 0 for console reading then return to interface 1 + irecv_set_interface(client, 0, 0); + int bytes = 0; while (irecv_bulk_transfer(client, 0x81, (unsigned char*) buffer, BUFFER_SIZE, &bytes, 1000) == 0) { if (bytes > 0) { if (client->received_callback != NULL) { @@ -755,12 +758,16 @@ irecv_error_t irecv_receive(irecv_client_t client) { event.data = buffer; event.type = IRECV_RECEIVED; if (client->received_callback(client, &event) != 0) { + irecv_set_interface(client, 1, 1); return IRECV_E_SUCCESS; } } } else break; } + // pod2g 2010-12-28: MacOSX need a reset if read times out + irecv_reset(client); + irecv_set_interface(client, 1, 1); return IRECV_E_SUCCESS; } |