diff options
| author | 2013-09-26 23:23:51 +0200 | |
|---|---|---|
| committer | 2013-09-26 23:23:51 +0200 | |
| commit | 7f721d5a6ce397e045d1bbcf6b895d886dfc7bf5 (patch) | |
| tree | d841cf1cfe98a0076a8c642ecc7581b4736e7bac /src/libirecovery.c | |
| parent | 188d8cbe0b788eeb07eea45204d59dc97fcc911e (diff) | |
| download | libirecovery-7f721d5a6ce397e045d1bbcf6b895d886dfc7bf5.tar.gz libirecovery-7f721d5a6ce397e045d1bbcf6b895d886dfc7bf5.tar.bz2 | |
Rename mode enum items to uppercase IRECV_K_* name scheme
Diffstat (limited to 'src/libirecovery.c')
| -rw-r--r-- | src/libirecovery.c | 49 |
1 files changed, 25 insertions, 24 deletions
diff --git a/src/libirecovery.c b/src/libirecovery.c index 3c0780a..43be58c 100644 --- a/src/libirecovery.c +++ b/src/libirecovery.c | |||
| @@ -176,16 +176,16 @@ irecv_error_t mobiledevice_connect(irecv_client_t* client, unsigned long long ec | |||
| 176 | continue; | 176 | continue; |
| 177 | } | 177 | } |
| 178 | 178 | ||
| 179 | if (ecid == kWTFMode) { | 179 | if (ecid == IRECV_K_WTF_MODE) { |
| 180 | if (_client->mode != kWTFMode) { | 180 | if (_client->mode != IRECV_K_WTF_MODE) { |
| 181 | // special ecid case, ignore !kWTFMode | 181 | // special ecid case, ignore !IRECV_K_WTF_MODE |
| 182 | continue; | 182 | continue; |
| 183 | } else { | 183 | } else { |
| 184 | ecid = 0; | 184 | ecid = 0; |
| 185 | } | 185 | } |
| 186 | } | 186 | } |
| 187 | 187 | ||
| 188 | if ((ecid != 0) && (_client->mode == kWTFMode)) { | 188 | if ((ecid != 0) && (_client->mode == IRECV_K_WTF_MODE)) { |
| 189 | // we can't get ecid in WTF mode | 189 | // we can't get ecid in WTF mode |
| 190 | mobiledevice_closepipes(_client); | 190 | mobiledevice_closepipes(_client); |
| 191 | continue; | 191 | continue; |
| @@ -267,7 +267,7 @@ irecv_error_t mobiledevice_connect(irecv_client_t* client, unsigned long long ec | |||
| 267 | continue; | 267 | continue; |
| 268 | } | 268 | } |
| 269 | 269 | ||
| 270 | if ((ecid != 0) && (_client->mode == kWTFMode)) { | 270 | if ((ecid != 0) && (_client->mode == IRECV_K_WTF_MODE)) { |
| 271 | // we can't get ecid in WTF mode | 271 | // we can't get ecid in WTF mode |
| 272 | mobiledevice_closepipes(_client); | 272 | mobiledevice_closepipes(_client); |
| 273 | continue; | 273 | continue; |
| @@ -522,23 +522,23 @@ irecv_error_t irecv_open_with_ecid(irecv_client_t* pclient, unsigned long long e | |||
| 522 | libusb_get_device_descriptor(usb_device, &usb_descriptor); | 522 | libusb_get_device_descriptor(usb_device, &usb_descriptor); |
| 523 | if (usb_descriptor.idVendor == APPLE_VENDOR_ID) { | 523 | if (usb_descriptor.idVendor == APPLE_VENDOR_ID) { |
| 524 | /* verify this device is in a mode we understand */ | 524 | /* verify this device is in a mode we understand */ |
| 525 | if (usb_descriptor.idProduct == kRecoveryMode1 || | 525 | if (usb_descriptor.idProduct == IRECV_K_RECOVERY_MODE_1 || |
| 526 | usb_descriptor.idProduct == kRecoveryMode2 || | 526 | usb_descriptor.idProduct == IRECV_K_RECOVERY_MODE_2 || |
| 527 | usb_descriptor.idProduct == kRecoveryMode3 || | 527 | usb_descriptor.idProduct == IRECV_K_RECOVERY_MODE_3 || |
| 528 | usb_descriptor.idProduct == kRecoveryMode4 || | 528 | usb_descriptor.idProduct == IRECV_K_RECOVERY_MODE_4 || |
| 529 | usb_descriptor.idProduct == kWTFMode || | 529 | usb_descriptor.idProduct == IRECV_K_WTF_MODE || |
| 530 | usb_descriptor.idProduct == kDfuMode) { | 530 | usb_descriptor.idProduct == IRECV_K_DFU_MODE) { |
| 531 | 531 | ||
| 532 | if (ecid == kWTFMode) { | 532 | if (ecid == IRECV_K_WTF_MODE) { |
| 533 | if (usb_descriptor.idProduct != kWTFMode) { | 533 | if (usb_descriptor.idProduct != IRECV_K_WTF_MODE) { |
| 534 | // special ecid case, ignore !kWTFMode | 534 | // special ecid case, ignore !IRECV_K_WTF_MODE |
| 535 | continue; | 535 | continue; |
| 536 | } else { | 536 | } else { |
| 537 | ecid = 0; | 537 | ecid = 0; |
| 538 | } | 538 | } |
| 539 | } | 539 | } |
| 540 | 540 | ||
| 541 | if ((ecid != 0) && (usb_descriptor.idProduct == kWTFMode)) { | 541 | if ((ecid != 0) && (usb_descriptor.idProduct == IRECV_K_WTF_MODE)) { |
| 542 | // we can't get ecid in WTF mode | 542 | // we can't get ecid in WTF mode |
| 543 | continue; | 543 | continue; |
| 544 | } | 544 | } |
| @@ -595,9 +595,9 @@ irecv_error_t irecv_open_with_ecid(irecv_client_t* pclient, unsigned long long e | |||
| 595 | return error; | 595 | return error; |
| 596 | } | 596 | } |
| 597 | 597 | ||
| 598 | if ((client->mode != kDfuMode) && (client->mode != kWTFMode)) { | 598 | if ((client->mode != IRECV_K_DFU_MODE) && (client->mode != IRECV_K_WTF_MODE)) { |
| 599 | error = irecv_usb_set_interface(client, 0, 0); | 599 | error = irecv_usb_set_interface(client, 0, 0); |
| 600 | if (client->mode > kRecoveryMode2) { | 600 | if (client->mode > IRECV_K_RECOVERY_MODE_2) { |
| 601 | error = irecv_usb_set_interface(client, 1, 1); | 601 | error = irecv_usb_set_interface(client, 1, 1); |
| 602 | } | 602 | } |
| 603 | } else { | 603 | } else { |
| @@ -620,8 +620,9 @@ irecv_error_t irecv_open_with_ecid(irecv_client_t* pclient, unsigned long long e | |||
| 620 | if (ret == IRECV_E_SUCCESS) { | 620 | if (ret == IRECV_E_SUCCESS) { |
| 621 | irecv_client_t client = *pclient; | 621 | irecv_client_t client = *pclient; |
| 622 | int error = IRECV_E_SUCCESS; | 622 | int error = IRECV_E_SUCCESS; |
| 623 | if ((client->mode != IRECV_K_DFU_MODE) && (client->mode != IRECV_K_WTF_MODE)) { | ||
| 623 | error = irecv_usb_set_interface(client, 0, 0); | 624 | error = irecv_usb_set_interface(client, 0, 0); |
| 624 | if (client->mode > kRecoveryMode2) { | 625 | if (client->mode > IRECV_K_RECOVERY_MODE_2) { |
| 625 | error = irecv_usb_set_interface(client, 1, 1); | 626 | error = irecv_usb_set_interface(client, 1, 1); |
| 626 | } | 627 | } |
| 627 | } else { | 628 | } else { |
| @@ -786,7 +787,7 @@ irecv_error_t irecv_close(irecv_client_t client) { | |||
| 786 | } | 787 | } |
| 787 | #ifndef WIN32 | 788 | #ifndef WIN32 |
| 788 | if (client->handle != NULL) { | 789 | if (client->handle != NULL) { |
| 789 | if ((client->mode != kDfuMode) && (client->mode != kWTFMode)) { | 790 | if ((client->mode != IRECV_K_DFU_MODE) && (client->mode != IRECV_K_WTF_MODE)) { |
| 790 | libusb_release_interface(client->handle, client->interface); | 791 | libusb_release_interface(client->handle, client->interface); |
| 791 | } | 792 | } |
| 792 | libusb_close(client->handle); | 793 | libusb_close(client->handle); |
| @@ -920,7 +921,7 @@ static irecv_error_t irecv_get_status(irecv_client_t client, unsigned int* statu | |||
| 920 | 921 | ||
| 921 | irecv_error_t irecv_send_buffer(irecv_client_t client, unsigned char* buffer, unsigned long length, int dfuNotifyFinished) { | 922 | irecv_error_t irecv_send_buffer(irecv_client_t client, unsigned char* buffer, unsigned long length, int dfuNotifyFinished) { |
| 922 | irecv_error_t error = 0; | 923 | irecv_error_t error = 0; |
| 923 | int recovery_mode = ((client->mode != kDfuMode) && (client->mode != kWTFMode)); | 924 | int recovery_mode = ((client->mode != IRECV_K_DFU_MODE) && (client->mode != IRECV_K_WTF_MODE)); |
| 924 | if (check_context(client) != IRECV_E_SUCCESS) return IRECV_E_NO_DEVICE; | 925 | if (check_context(client) != IRECV_E_SUCCESS) return IRECV_E_NO_DEVICE; |
| 925 | 926 | ||
| 926 | unsigned int h1 = 0xFFFFFFFF; | 927 | unsigned int h1 = 0xFFFFFFFF; |
| @@ -1124,7 +1125,7 @@ irecv_error_t irecv_getret(irecv_client_t client, unsigned int* value) { | |||
| 1124 | irecv_error_t irecv_get_cpid(irecv_client_t client, unsigned int* cpid) { | 1125 | irecv_error_t irecv_get_cpid(irecv_client_t client, unsigned int* cpid) { |
| 1125 | if (check_context(client) != IRECV_E_SUCCESS) return IRECV_E_NO_DEVICE; | 1126 | if (check_context(client) != IRECV_E_SUCCESS) return IRECV_E_NO_DEVICE; |
| 1126 | 1127 | ||
| 1127 | if (client->mode == kWTFMode) { | 1128 | if (client->mode == IRECV_K_WTF_MODE) { |
| 1128 | char s_cpid[8] = {0,}; | 1129 | char s_cpid[8] = {0,}; |
| 1129 | strncpy(s_cpid, client->serial, 4); | 1130 | strncpy(s_cpid, client->serial, 4); |
| 1130 | if (sscanf(s_cpid, "%x", cpid) != 1) { | 1131 | if (sscanf(s_cpid, "%x", cpid) != 1) { |
| @@ -1376,14 +1377,14 @@ const char* irecv_strerror(irecv_error_t error) { | |||
| 1376 | 1377 | ||
| 1377 | irecv_error_t irecv_reset_counters(irecv_client_t client) { | 1378 | irecv_error_t irecv_reset_counters(irecv_client_t client) { |
| 1378 | if (check_context(client) != IRECV_E_SUCCESS) return IRECV_E_NO_DEVICE; | 1379 | if (check_context(client) != IRECV_E_SUCCESS) return IRECV_E_NO_DEVICE; |
| 1379 | if ((client->mode == kDfuMode) || (client->mode == kWTFMode)) { | 1380 | if ((client->mode == IRECV_K_DFU_MODE) || (client->mode == IRECV_K_WTF_MODE)) { |
| 1380 | irecv_usb_control_transfer(client, 0x21, 4, 0, 0, 0, 0, USB_TIMEOUT); | 1381 | irecv_usb_control_transfer(client, 0x21, 4, 0, 0, 0, 0, USB_TIMEOUT); |
| 1381 | } | 1382 | } |
| 1382 | return IRECV_E_SUCCESS; | 1383 | return IRECV_E_SUCCESS; |
| 1383 | } | 1384 | } |
| 1384 | 1385 | ||
| 1385 | irecv_error_t irecv_recv_buffer(irecv_client_t client, char* buffer, unsigned long length) { | 1386 | irecv_error_t irecv_recv_buffer(irecv_client_t client, char* buffer, unsigned long length) { |
| 1386 | int recovery_mode = ((client->mode != kDfuMode) && (client->mode != kWTFMode)); | 1387 | int recovery_mode = ((client->mode != IRECV_K_DFU_MODE) && (client->mode != IRECV_K_WTF_MODE)); |
| 1387 | 1388 | ||
| 1388 | if (check_context(client) != IRECV_E_SUCCESS) return IRECV_E_NO_DEVICE; | 1389 | if (check_context(client) != IRECV_E_SUCCESS) return IRECV_E_NO_DEVICE; |
| 1389 | 1390 | ||
