summaryrefslogtreecommitdiffstats
path: root/libirecovery.c
diff options
context:
space:
mode:
Diffstat (limited to 'libirecovery.c')
-rw-r--r--libirecovery.c27
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) {
353 client->interface = 0; 353 client->interface = 0;
354 client->handle = usb_handle; 354 client->handle = usb_handle;
355 client->mode = usb_descriptor.idProduct; 355 client->mode = usb_descriptor.idProduct;
356
357 error = irecv_set_configuration(client, 1);
358 if (error != IRECV_E_SUCCESS) {
359 return error;
360 }
361
356 if (client->mode != kDfuMode) { 362 if (client->mode != kDfuMode) {
357 error = irecv_set_configuration(client, 1);
358 if (error != IRECV_E_SUCCESS) {
359 return error;
360 }
361
362 // pod2g 2010-12-28: switched to interface 1.1 by default on non DFU modes 363 // pod2g 2010-12-28: switched to interface 1.1 by default on non DFU modes
363 error = irecv_set_interface(client, 1, 1); 364 error = irecv_set_interface(client, 1, 1);
364 if (error != IRECV_E_SUCCESS) { 365 } else {
365 return error; 366 error = irecv_set_interface(client, 0, 0);
366 } 367 }
368 if (error != IRECV_E_SUCCESS) {
369 return error;
367 } 370 }
368 371
369 /* cache usb serial */ 372 /* cache usb serial */
@@ -678,9 +681,11 @@ irecv_error_t irecv_send_buffer(irecv_client_t client, unsigned char* buffer, un
678 /* initiate transfer */ 681 /* initiate transfer */
679 if (recovery_mode) { 682 if (recovery_mode) {
680 error = irecv_control_transfer(client, 0x41, 0, 0, 0, NULL, 0, 1000); 683 error = irecv_control_transfer(client, 0x41, 0, 0, 0, NULL, 0, 1000);
681 if (error != IRECV_E_SUCCESS) { 684 } else {
682 return error; 685 error = irecv_control_transfer(client, 0x21, 4, 0, 0, NULL, 0, 1000);
683 } 686 }
687 if (error != IRECV_E_SUCCESS) {
688 return error;
684 } 689 }
685 690
686 int i = 0; 691 int i = 0;