diff options
| author | 2009-05-24 00:25:03 +0200 | |
|---|---|---|
| committer | 2009-05-24 00:25:03 +0200 | |
| commit | 36ea32e0064f33d6a285684c3069f4d75bbac7a8 (patch) | |
| tree | 039291b47e954fe8529f52e1fc71f7e924761a6a /dev/iphoneinfo.c | |
| parent | 46f8d46845355e6a33a6dcb97ba11d4c4cab62eb (diff) | |
| parent | 435f5feb4b5c501db52743a170908687d3ba6f60 (diff) | |
| download | libimobiledevice-36ea32e0064f33d6a285684c3069f4d75bbac7a8.tar.gz libimobiledevice-36ea32e0064f33d6a285684c3069f4d75bbac7a8.tar.bz2 | |
Merge branch 'master' of git://github.com/MattColyer/libiphone into martin
Conflicts:
src/Makefile.am
Diffstat (limited to 'dev/iphoneinfo.c')
| -rw-r--r-- | dev/iphoneinfo.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/dev/iphoneinfo.c b/dev/iphoneinfo.c index 4995b9b..c28eb9e 100644 --- a/dev/iphoneinfo.c +++ b/dev/iphoneinfo.c | |||
| @@ -22,7 +22,6 @@ | |||
| 22 | #include <stdio.h> | 22 | #include <stdio.h> |
| 23 | #include <string.h> | 23 | #include <string.h> |
| 24 | #include <errno.h> | 24 | #include <errno.h> |
| 25 | #include <usb.h> | ||
| 26 | 25 | ||
| 27 | #include <libiphone/libiphone.h> | 26 | #include <libiphone/libiphone.h> |
| 28 | 27 | ||
| @@ -37,7 +36,8 @@ int main(int argc, char *argv[]) | |||
| 37 | iphone_device_t phone = NULL; | 36 | iphone_device_t phone = NULL; |
| 38 | iphone_error_t ret = IPHONE_E_UNKNOWN_ERROR; | 37 | iphone_error_t ret = IPHONE_E_UNKNOWN_ERROR; |
| 39 | int i; | 38 | int i; |
| 40 | int bus_n = -1, dev_n = -1; | 39 | char uuid[41]; |
| 40 | uuid[0] = 0; | ||
| 41 | 41 | ||
| 42 | /* parse cmdline args */ | 42 | /* parse cmdline args */ |
| 43 | for (i = 1; i < argc; i++) { | 43 | for (i = 1; i < argc; i++) { |
| @@ -45,11 +45,13 @@ int main(int argc, char *argv[]) | |||
| 45 | iphone_set_debug_mask(DBGMASK_ALL); | 45 | iphone_set_debug_mask(DBGMASK_ALL); |
| 46 | continue; | 46 | continue; |
| 47 | } | 47 | } |
| 48 | else if (!strcmp(argv[i], "-u") || !strcmp(argv[i], "--usb")) { | 48 | else if (!strcmp(argv[i], "-u") || !strcmp(argv[i], "--uuid")) { |
| 49 | if (sscanf(argv[++i], "%d,%d", &bus_n, &dev_n) < 2) { | 49 | i++; |
| 50 | if (!argv[i] || (strlen(argv[i]) != 40)) { | ||
| 50 | print_usage(argc, argv); | 51 | print_usage(argc, argv); |
| 51 | return 0; | 52 | return 0; |
| 52 | } | 53 | } |
| 54 | strcpy(uuid, argv[i]); | ||
| 53 | continue; | 55 | continue; |
| 54 | } | 56 | } |
| 55 | else if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "--help")) { | 57 | else if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "--help")) { |
| @@ -62,10 +64,10 @@ int main(int argc, char *argv[]) | |||
| 62 | } | 64 | } |
| 63 | } | 65 | } |
| 64 | 66 | ||
| 65 | if (bus_n != -1) { | 67 | if (uuid[0] != 0) { |
| 66 | ret = iphone_get_specific_device(bus_n, dev_n, &phone); | 68 | ret = iphone_get_device_by_uuid(&phone, uuid); |
| 67 | if (ret != IPHONE_E_SUCCESS) { | 69 | if (ret != IPHONE_E_SUCCESS) { |
| 68 | printf("No device found for usb bus %d and dev %d, is it plugged in?\n", bus_n, dev_n); | 70 | printf("No device found with uuid %s, is it plugged in?\n", uuid); |
| 69 | return -1; | 71 | return -1; |
| 70 | } | 72 | } |
| 71 | } | 73 | } |
| @@ -108,7 +110,7 @@ void print_usage(int argc, char **argv) | |||
| 108 | printf("Usage: %s [OPTIONS]\n", (strrchr(argv[0], '/') + 1)); | 110 | printf("Usage: %s [OPTIONS]\n", (strrchr(argv[0], '/') + 1)); |
| 109 | printf("Show information about the first connected iPhone/iPod Touch.\n\n"); | 111 | printf("Show information about the first connected iPhone/iPod Touch.\n\n"); |
| 110 | printf(" -d, --debug\t\tenable communication debugging\n"); | 112 | printf(" -d, --debug\t\tenable communication debugging\n"); |
| 111 | printf(" -u, --usb=BUS,DEV\ttarget specific device by usb bus/dev number\n"); | 113 | printf(" -u, --uuid UUID\ttarget specific device by its 40-digit device UUID\n"); |
| 112 | printf(" -h, --help\t\tprints usage information\n"); | 114 | printf(" -h, --help\t\tprints usage information\n"); |
| 113 | printf("\n"); | 115 | printf("\n"); |
| 114 | } | 116 | } |
