diff options
author | pod2g | 2010-12-31 01:15:38 +0100 |
---|---|---|
committer | pod2g | 2010-12-31 01:15:38 +0100 |
commit | b8976a4c3cadcec938e2c493511187a8b5fc8a21 (patch) | |
tree | 47d5eb3d81a5d1fe4c8ce20b6795ba361da0e418 /libirecovery.c | |
parent | 72e1427dde744addb0e5aeca364ec43ddf954895 (diff) | |
download | libirecovery-b8976a4c3cadcec938e2c493511187a8b5fc8a21.tar.gz libirecovery-b8976a4c3cadcec938e2c493511187a8b5fc8a21.tar.bz2 |
DFU mode fixed
Diffstat (limited to 'libirecovery.c')
-rw-r--r-- | libirecovery.c | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/libirecovery.c b/libirecovery.c index 58ef080..0aed224 100644 --- a/libirecovery.c +++ b/libirecovery.c @@ -353,17 +353,20 @@ irecv_error_t irecv_open(irecv_client_t* pclient) { client->interface = 0; client->handle = usb_handle; client->mode = usb_descriptor.idProduct; + + error = irecv_set_configuration(client, 1); + if (error != IRECV_E_SUCCESS) { + return error; + } + if (client->mode != kDfuMode) { - error = irecv_set_configuration(client, 1); - if (error != IRECV_E_SUCCESS) { - return error; - } - // 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; - } + } else { + error = irecv_set_interface(client, 0, 0); + } + if (error != IRECV_E_SUCCESS) { + return error; } /* cache usb serial */ @@ -678,9 +681,11 @@ irecv_error_t irecv_send_buffer(irecv_client_t client, unsigned char* buffer, un /* initiate transfer */ if (recovery_mode) { error = irecv_control_transfer(client, 0x41, 0, 0, 0, NULL, 0, 1000); - if (error != IRECV_E_SUCCESS) { - return error; - } + } else { + error = irecv_control_transfer(client, 0x21, 4, 0, 0, NULL, 0, 1000); + } + if (error != IRECV_E_SUCCESS) { + return error; } int i = 0; |