Created
July 18, 2016 18:21
-
-
Save zchee/a8b990a68cb3f90fb955fd9bdda2e7ba to your computer and use it in GitHub Desktop.
With this tool you can enter in recovery mode easily without adding your udid instead of the initial code from Libimobiledevice
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* gcc ideviceenterrecovery.c -o ideviceenterrecovery -limobiledevice */ | |
#include <stdlib.h> | |
#include <stdio.h> | |
#include <errno.h> | |
#include <libimobiledevice/libimobiledevice.h> | |
#include <libimobiledevice/lockdown.h> | |
static char *udid = NULL; | |
int main() | |
{ | |
idevice_error_t ret = IDEVICE_E_UNKNOWN_ERROR; | |
idevice_t device = NULL; | |
lockdownd_client_t client = NULL; | |
lockdownd_error_t ldret = LOCKDOWN_E_UNKNOWN_ERROR; | |
if (IDEVICE_E_SUCCESS != idevice_new(&device, NULL)) | |
{ | |
printf("No device found, is it plugged in?\n"); | |
return EXIT_FAILURE; | |
} | |
ret = idevice_get_udid(device, &udid); | |
printf("Telling device with udid %s to enter recovery mode.\n", udid); | |
if (LOCKDOWN_E_SUCCESS != (ldret = lockdownd_client_new(device, &client, "ideviceenterrecovery"))) { | |
printf("ERROR: Could not connect to lockdownd, error code %d\n", ldret); | |
idevice_free(device); | |
return -1; | |
} | |
if (lockdownd_enter_recovery(client) != LOCKDOWN_E_SUCCESS) | |
{ | |
printf("Failed to enter recovery mode : %s\n", strerror(errno)); | |
exit(1); | |
} | |
printf("Device is switching to recovery mode.\n"); | |
lockdownd_client_free(client); | |
idevice_free(device); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment