diff options
Diffstat (limited to 'tools/ideviceactivation.c')
| -rw-r--r-- | tools/ideviceactivation.c | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/tools/ideviceactivation.c b/tools/ideviceactivation.c index 757c54e..0ea3901 100644 --- a/tools/ideviceactivation.c +++ b/tools/ideviceactivation.c @@ -30,7 +30,7 @@ #include <string.h> #include <unistd.h> #include <ctype.h> -#ifndef WIN32 +#ifndef _WIN32 #include <signal.h> #endif @@ -40,7 +40,7 @@ #include <libimobiledevice/mobileactivation.h> #include <libideviceactivation.h> -#ifdef WIN32 +#ifdef _WIN32 #include <windows.h> #include <conio.h> #else @@ -60,6 +60,7 @@ static void print_usage(int argc, char **argv) printf(" activate\t\tattempt to activate the device\n"); printf(" deactivate\t\tdeactivate the device\n"); printf(" state\t\t\tquery device about its activation state\n"); + printf(" itunes\t\ttell the device that it has been connected to iTunes (useful for < iOS 4)\n"); printf("\n"); printf("The following OPTIONS are accepted:\n"); printf(" -d, --debug\t\tenable communication debugging\n"); @@ -74,7 +75,7 @@ static void print_usage(int argc, char **argv) printf("Bug Reports: <" PACKAGE_BUGREPORT ">\n"); } -#ifdef WIN32 +#ifdef _WIN32 #define BS_CC '\b' #define my_getch getch #else @@ -142,11 +143,11 @@ int main(int argc, char *argv[]) int use_network = 0; typedef enum { - OP_NONE = 0, OP_ACTIVATE, OP_DEACTIVATE, OP_GETSTATE + OP_NONE = 0, OP_ACTIVATE, OP_DEACTIVATE, OP_GETSTATE, OP_ITUNES } op_t; op_t op = OP_NONE; -#ifndef WIN32 +#ifndef _WIN32 signal(SIGPIPE, SIG_IGN); #endif /* parse cmdline args */ @@ -202,6 +203,10 @@ int main(int argc, char *argv[]) op = OP_GETSTATE; continue; } + else if (!strcmp(argv[i], "itunes")) { + op = OP_ITUNES; + continue; + } else { print_usage(argc, argv); return EXIT_SUCCESS; @@ -602,6 +607,18 @@ int main(int argc, char *argv[]) } } break; + + case OP_ITUNES: { + // set iTunesHasConnected if we succeeded + if (LOCKDOWN_E_SUCCESS != lockdownd_set_value(lockdown, NULL, "iTunesHasConnected", plist_new_bool(1))) { + fprintf(stderr, "Failed to set iTunesHasConnected on device.\n"); + result = EXIT_FAILURE; + goto cleanup; + } + result = EXIT_SUCCESS; + printf("Successfully set 'iTunesHasConnected'.\n"); + } + break; } cleanup: |
