diff options
| author | 2009-05-19 13:15:11 +0200 | |
|---|---|---|
| committer | 2009-05-19 07:30:34 -0700 | |
| commit | b61667e9eae1a588815453ccdaa8721e228cc0b8 (patch) | |
| tree | 7a14a6cb7af138abbca7be4bb822dda9df2dafb7 /dev/syslog_relay.c | |
| parent | 34b8e4d575876ace41b91fb6e25a5fa9f9290608 (diff) | |
| download | libimobiledevice-b61667e9eae1a588815453ccdaa8721e228cc0b8.tar.gz libimobiledevice-b61667e9eae1a588815453ccdaa8721e228cc0b8.tar.bz2 | |
Adapted iphoneinfo and iphonesyslog to new API to allow device selection Added iphone_id tool to list devices attached and retrieve device name.
Signed-off-by: Matt Colyer <matt@colyer.name>
Diffstat (limited to 'dev/syslog_relay.c')
| -rw-r--r-- | dev/syslog_relay.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/dev/syslog_relay.c b/dev/syslog_relay.c index 6fc981b..3407f2f 100644 --- a/dev/syslog_relay.c +++ b/dev/syslog_relay.c | |||
| @@ -24,7 +24,6 @@ | |||
| 24 | #include <errno.h> | 24 | #include <errno.h> |
| 25 | #include <netinet/in.h> | 25 | #include <netinet/in.h> |
| 26 | #include <signal.h> | 26 | #include <signal.h> |
| 27 | #include <usb.h> | ||
| 28 | 27 | ||
| 29 | #include <libiphone/libiphone.h> | 28 | #include <libiphone/libiphone.h> |
| 30 | #include <usbmuxd.h> | 29 | #include <usbmuxd.h> |
| @@ -48,8 +47,9 @@ int main(int argc, char *argv[]) | |||
| 48 | iphone_device_t phone = NULL; | 47 | iphone_device_t phone = NULL; |
| 49 | iphone_error_t ret = IPHONE_E_UNKNOWN_ERROR; | 48 | iphone_error_t ret = IPHONE_E_UNKNOWN_ERROR; |
| 50 | int i; | 49 | int i; |
| 51 | int bus_n = -1, dev_n = -1; | 50 | char uuid[41]; |
| 52 | int port = 0; | 51 | int port = 0; |
| 52 | uuid[0] = 0; | ||
| 53 | 53 | ||
| 54 | signal(SIGINT, clean_exit); | 54 | signal(SIGINT, clean_exit); |
| 55 | signal(SIGQUIT, clean_exit); | 55 | signal(SIGQUIT, clean_exit); |
| @@ -62,11 +62,13 @@ int main(int argc, char *argv[]) | |||
| 62 | iphone_set_debug_mask(DBGMASK_ALL); | 62 | iphone_set_debug_mask(DBGMASK_ALL); |
| 63 | continue; | 63 | continue; |
| 64 | } | 64 | } |
| 65 | else if (!strcmp(argv[i], "-u") || !strcmp(argv[i], "--usb")) { | 65 | else if (!strcmp(argv[i], "-u") || !strcmp(argv[i], "--uuid")) { |
| 66 | if (sscanf(argv[++i], "%d,%d", &bus_n, &dev_n) < 2) { | 66 | i++; |
| 67 | if (!argv[i] || (strlen(argv[i]) != 40)) { | ||
| 67 | print_usage(argc, argv); | 68 | print_usage(argc, argv); |
| 68 | return 0; | 69 | return 0; |
| 69 | } | 70 | } |
| 71 | strcpy(uuid, argv[i]); | ||
| 70 | continue; | 72 | continue; |
| 71 | } | 73 | } |
| 72 | else if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "--help")) { | 74 | else if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "--help")) { |
| @@ -79,21 +81,21 @@ int main(int argc, char *argv[]) | |||
| 79 | } | 81 | } |
| 80 | } | 82 | } |
| 81 | 83 | ||
| 82 | /* if (bus_n != -1) { | 84 | if (uuid[0] != 0) { |
| 83 | ret = iphone_get_specific_device(bus_n, dev_n, &phone); | 85 | ret = iphone_get_device_by_uuid(&phone, uuid); |
| 84 | if (ret != IPHONE_E_SUCCESS) { | 86 | if (ret != IPHONE_E_SUCCESS) { |
| 85 | printf("No device found for usb bus %d and dev %d, is it plugged in?\n", bus_n, dev_n); | 87 | printf("No device found with uuid %s, is it plugged in?\n", uuid); |
| 86 | return -1; | 88 | return -1; |
| 87 | } | 89 | } |
| 88 | } | 90 | } |
| 89 | else | 91 | else |
| 90 | {*/ | 92 | { |
| 91 | ret = iphone_get_device(&phone); | 93 | ret = iphone_get_device(&phone); |
| 92 | if (ret != IPHONE_E_SUCCESS) { | 94 | if (ret != IPHONE_E_SUCCESS) { |
| 93 | printf("No device found, is it plugged in?\n"); | 95 | printf("No device found, is it plugged in?\n"); |
| 94 | return -1; | 96 | return -1; |
| 95 | } | 97 | } |
| 96 | /* }*/ | 98 | } |
| 97 | 99 | ||
| 98 | if (IPHONE_E_SUCCESS != iphone_lckd_new_client(phone, &control)) { | 100 | if (IPHONE_E_SUCCESS != iphone_lckd_new_client(phone, &control)) { |
| 99 | iphone_free_device(phone); | 101 | iphone_free_device(phone); |
| @@ -152,7 +154,7 @@ void print_usage(int argc, char **argv) | |||
| 152 | printf("Usage: %s [OPTIONS]\n", (strrchr(argv[0], '/') + 1)); | 154 | printf("Usage: %s [OPTIONS]\n", (strrchr(argv[0], '/') + 1)); |
| 153 | printf("Relay syslog of a connected iPhone/iPod Touch.\n\n"); | 155 | printf("Relay syslog of a connected iPhone/iPod Touch.\n\n"); |
| 154 | printf(" -d, --debug\t\tenable communication debugging\n"); | 156 | printf(" -d, --debug\t\tenable communication debugging\n"); |
| 155 | printf(" -u, --usb=BUS,DEV\ttarget specific device by usb bus/dev number\n"); | 157 | printf(" -u, --uuid UUID\ttarget specific device by its 40-digit device UUID\n"); |
| 156 | printf(" -h, --help\t\tprints usage information\n"); | 158 | printf(" -h, --help\t\tprints usage information\n"); |
| 157 | printf("\n"); | 159 | printf("\n"); |
| 158 | } | 160 | } |
