diff options
author | 2021-02-09 02:45:06 +0100 | |
---|---|---|
committer | 2021-03-05 09:09:39 +0100 | |
commit | 25059d4c7d75e03aab516af2929d7c6e6d4c17de (patch) | |
tree | e40097de160e2599b64206465bf31b566f6a9a5f /tools/ideviceenterrecovery.c | |
parent | 4837527745d98b9314eec1a250e2e13ce1ec3031 (diff) | |
download | libimobiledevice-25059d4c7d75e03aab516af2929d7c6e6d4c17de.tar.gz libimobiledevice-25059d4c7d75e03aab516af2929d7c6e6d4c17de.tar.bz2 |
tools: Fix entering recovery mode on iOS 14.5+ which now requires a pairing
Diffstat (limited to 'tools/ideviceenterrecovery.c')
-rw-r--r-- | tools/ideviceenterrecovery.c | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/tools/ideviceenterrecovery.c b/tools/ideviceenterrecovery.c index 822c10a..0cc9936 100644 --- a/tools/ideviceenterrecovery.c +++ b/tools/ideviceenterrecovery.c | |||
@@ -92,25 +92,37 @@ int main(int argc, char *argv[]) | |||
92 | ret = idevice_new(&device, udid); | 92 | ret = idevice_new(&device, udid); |
93 | if (ret != IDEVICE_E_SUCCESS) { | 93 | if (ret != IDEVICE_E_SUCCESS) { |
94 | printf("No device found with udid %s.\n", udid); | 94 | printf("No device found with udid %s.\n", udid); |
95 | return -1; | 95 | return 1; |
96 | } | 96 | } |
97 | 97 | ||
98 | if (LOCKDOWN_E_SUCCESS != (ldret = lockdownd_client_new(device, &client, TOOL_NAME))) { | 98 | if (LOCKDOWN_E_SUCCESS != (ldret = lockdownd_client_new(device, &client, TOOL_NAME))) { |
99 | printf("ERROR: Could not connect to lockdownd, error code %d\n", ldret); | 99 | printf("ERROR: Could not connect to lockdownd: %s (%d)\n", lockdownd_strerror(ldret), ldret); |
100 | idevice_free(device); | 100 | idevice_free(device); |
101 | return -1; | 101 | return 1; |
102 | } | 102 | } |
103 | 103 | ||
104 | /* run query and output information */ | 104 | int res = 0; |
105 | printf("Telling device with udid %s to enter recovery mode.\n", udid); | 105 | printf("Telling device with udid %s to enter recovery mode.\n", udid); |
106 | if(lockdownd_enter_recovery(client) != LOCKDOWN_E_SUCCESS) | 106 | ldret = lockdownd_enter_recovery(client); |
107 | { | 107 | if (ldret == LOCKDOWN_E_SESSION_INACTIVE) { |
108 | lockdownd_client_free(client); | ||
109 | client = NULL; | ||
110 | if (LOCKDOWN_E_SUCCESS != (ldret = lockdownd_client_new_with_handshake(device, &client, TOOL_NAME))) { | ||
111 | printf("ERROR: Could not connect to lockdownd: %s (%d)\n", lockdownd_strerror(ldret), ldret); | ||
112 | idevice_free(device); | ||
113 | return 1; | ||
114 | } | ||
115 | ldret = lockdownd_enter_recovery(client); | ||
116 | } | ||
117 | if (ldret != LOCKDOWN_E_SUCCESS) { | ||
108 | printf("Failed to enter recovery mode.\n"); | 118 | printf("Failed to enter recovery mode.\n"); |
119 | res = 1; | ||
120 | } else { | ||
121 | printf("Device is successfully switching to recovery mode.\n"); | ||
109 | } | 122 | } |
110 | printf("Device is successfully switching to recovery mode.\n"); | ||
111 | 123 | ||
112 | lockdownd_client_free(client); | 124 | lockdownd_client_free(client); |
113 | idevice_free(device); | 125 | idevice_free(device); |
114 | 126 | ||
115 | return 0; | 127 | return res; |
116 | } | 128 | } |