From 8baf18c6cb9fbf067d092ba3c5275af88afff1ef Mon Sep 17 00:00:00 2001 From: Martin Szulecki Date: Fri, 28 May 2010 12:21:11 +0200 Subject: Promote ideviceenterrecovery into tools as it is quite useful --- dev/Makefile.am | 9 +---- dev/ideviceenterrecovery.c | 93 -------------------------------------------- tools/Makefile.am | 7 +++- tools/ideviceenterrecovery.c | 93 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 101 insertions(+), 101 deletions(-) delete mode 100644 dev/ideviceenterrecovery.c create mode 100644 tools/ideviceenterrecovery.c diff --git a/dev/Makefile.am b/dev/Makefile.am index 17b67db..0790c80 100644 --- a/dev/Makefile.am +++ b/dev/Makefile.am @@ -4,7 +4,7 @@ AM_CFLAGS = $(GLOBAL_CFLAGS) $(libglib2_CFLAGS) $(libgnutls_CFLAGS) $(libtasn1_C AM_LDFLAGS = $(libglib2_LIBS) $(libgnutls_LIBS) $(libtasn1_LIBS) $(libgthread2_LIBS) if ENABLE_DEVTOOLS -noinst_PROGRAMS = ideviceclient lckd-client afccheck msyncclient ideviceenterrecovery filerelaytest +noinst_PROGRAMS = ideviceclient lckd-client afccheck msyncclient filerelaytest ideviceclient_SOURCES = ideviceclient.c ideviceclient_LDADD = ../src/libimobiledevice.la @@ -24,11 +24,6 @@ msyncclient_CFLAGS = $(AM_CFLAGS) msyncclient_LDFLAGS = $(AM_LDFLAGS) msyncclient_LDADD = ../src/libimobiledevice.la -ideviceenterrecovery_SOURCES = ideviceenterrecovery.c -ideviceenterrecovery_CFLAGS = $(AM_CFLAGS) -ideviceenterrecovery_LDFLAGS = $(AM_LDFLAGS) -ideviceenterrecovery_LDADD = ../src/libimobiledevice.la - filerelaytest_SOURCES = filerelaytest.c filerelaytest_CFLAGS = $(AM_CFLAGS) filerelaytest_LDFLAGS = $(AM_LDFLAGS) @@ -36,4 +31,4 @@ filerelaytest_LDADD = ../src/libimobiledevice.la endif # ENABLE_DEVTOOLS -EXTRA_DIST = ideviceclient.c lckdclient.c afccheck.c msyncclient.c ideviceenterrecovery.c +EXTRA_DIST = ideviceclient.c lckdclient.c afccheck.c msyncclient.c diff --git a/dev/ideviceenterrecovery.c b/dev/ideviceenterrecovery.c deleted file mode 100644 index 827946b..0000000 --- a/dev/ideviceenterrecovery.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - * ideviceenterrecovery.c - * Simple utility to make a device in normal mode enter recovery mode. - * - * Copyright (c) 2009 Martin Szulecki All Rights Reserved. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include -#include -#include - -#include -#include - -static void print_usage(int argc, char **argv) -{ - char *name = NULL; - - name = strrchr(argv[0], '/'); - printf("Usage: %s [OPTIONS] UUID\n", (name ? name + 1: argv[0])); - printf("Makes a device with the supplied 40-digit UUID enter recovery mode immediately.\n\n"); - printf(" -d, --debug\t\tenable communication debugging\n"); - printf(" -h, --help\t\tprints usage information\n"); - printf("\n"); -} - -int main(int argc, char *argv[]) -{ - lockdownd_client_t client = NULL; - idevice_t phone = NULL; - idevice_error_t ret = IDEVICE_E_UNKNOWN_ERROR; - int i; - char uuid[41]; - uuid[0] = 0; - - /* parse cmdline args */ - for (i = 1; i < argc; i++) { - if (!strcmp(argv[i], "-d") || !strcmp(argv[i], "--debug")) { - idevice_set_debug_level(1); - continue; - } - else if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "--help")) { - print_usage(argc, argv); - return 0; - } - } - - i--; - if (!argv[i] || (strlen(argv[i]) != 40)) { - print_usage(argc, argv); - return 0; - } - strcpy(uuid, argv[i]); - - ret = idevice_new(&phone, uuid); - if (ret != IDEVICE_E_SUCCESS) { - printf("No device found with uuid %s, is it plugged in?\n", uuid); - return -1; - } - - if (LOCKDOWN_E_SUCCESS != lockdownd_client_new(phone, &client, "ideviceenterrecovery")) { - idevice_free(phone); - return -1; - } - - /* run query and output information */ - printf("Telling device with uuid %s to enter recovery mode.\n", uuid); - if(lockdownd_enter_recovery(client) != LOCKDOWN_E_SUCCESS) - { - printf("Failed to enter recovery mode.\n"); - } - printf("Device is successfully switching to recovery mode.\n"); - - lockdownd_client_free(client); - idevice_free(phone); - - return 0; -} diff --git a/tools/Makefile.am b/tools/Makefile.am index de80b92..f274084 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -3,7 +3,7 @@ AM_CPPFLAGS = -I$(top_srcdir)/include AM_CFLAGS = $(GLOBAL_CFLAGS) $(libglib2_CFLAGS) $(libgnutls_CFLAGS) $(libtasn1_CFLAGS) $(libgthread2_CFLAGS) $(LFS_CFLAGS) AM_LDFLAGS = $(libglib2_LIBS) $(libgnutls_LIBS) $(libtasn1_LIBS) $(libgthread2_LIBS) -bin_PROGRAMS = idevice_id ideviceinfo idevicepair idevicesyslog idevicebackup ideviceimagemounter idevicescreenshot +bin_PROGRAMS = idevice_id ideviceinfo idevicepair idevicesyslog idevicebackup ideviceimagemounter idevicescreenshot ideviceenterrecovery ideviceinfo_SOURCES = ideviceinfo.c ideviceinfo_CFLAGS = $(AM_CFLAGS) @@ -39,3 +39,8 @@ idevicescreenshot_SOURCES = idevicescreenshot.c idevicescreenshot_CFLAGS = $(AM_CFLAGS) idevicescreenshot_LDFLAGS = $(AM_LDFLAGS) idevicescreenshot_LDADD = ../src/libimobiledevice.la + +ideviceenterrecovery_SOURCES = ideviceenterrecovery.c +ideviceenterrecovery_CFLAGS = $(AM_CFLAGS) +ideviceenterrecovery_LDFLAGS = $(AM_LDFLAGS) +ideviceenterrecovery_LDADD = ../src/libimobiledevice.la diff --git a/tools/ideviceenterrecovery.c b/tools/ideviceenterrecovery.c new file mode 100644 index 0000000..827946b --- /dev/null +++ b/tools/ideviceenterrecovery.c @@ -0,0 +1,93 @@ +/* + * ideviceenterrecovery.c + * Simple utility to make a device in normal mode enter recovery mode. + * + * Copyright (c) 2009 Martin Szulecki All Rights Reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include +#include +#include +#include + +#include +#include + +static void print_usage(int argc, char **argv) +{ + char *name = NULL; + + name = strrchr(argv[0], '/'); + printf("Usage: %s [OPTIONS] UUID\n", (name ? name + 1: argv[0])); + printf("Makes a device with the supplied 40-digit UUID enter recovery mode immediately.\n\n"); + printf(" -d, --debug\t\tenable communication debugging\n"); + printf(" -h, --help\t\tprints usage information\n"); + printf("\n"); +} + +int main(int argc, char *argv[]) +{ + lockdownd_client_t client = NULL; + idevice_t phone = NULL; + idevice_error_t ret = IDEVICE_E_UNKNOWN_ERROR; + int i; + char uuid[41]; + uuid[0] = 0; + + /* parse cmdline args */ + for (i = 1; i < argc; i++) { + if (!strcmp(argv[i], "-d") || !strcmp(argv[i], "--debug")) { + idevice_set_debug_level(1); + continue; + } + else if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "--help")) { + print_usage(argc, argv); + return 0; + } + } + + i--; + if (!argv[i] || (strlen(argv[i]) != 40)) { + print_usage(argc, argv); + return 0; + } + strcpy(uuid, argv[i]); + + ret = idevice_new(&phone, uuid); + if (ret != IDEVICE_E_SUCCESS) { + printf("No device found with uuid %s, is it plugged in?\n", uuid); + return -1; + } + + if (LOCKDOWN_E_SUCCESS != lockdownd_client_new(phone, &client, "ideviceenterrecovery")) { + idevice_free(phone); + return -1; + } + + /* run query and output information */ + printf("Telling device with uuid %s to enter recovery mode.\n", uuid); + if(lockdownd_enter_recovery(client) != LOCKDOWN_E_SUCCESS) + { + printf("Failed to enter recovery mode.\n"); + } + printf("Device is successfully switching to recovery mode.\n"); + + lockdownd_client_free(client); + idevice_free(phone); + + return 0; +} -- cgit v1.1-32-gdbae