diff options
author | Nikias Bassen | 2009-05-19 13:15:11 +0200 |
---|---|---|
committer | Matt Colyer | 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 @@ #include <errno.h> #include <netinet/in.h> #include <signal.h> -#include <usb.h> #include <libiphone/libiphone.h> #include <usbmuxd.h> @@ -48,8 +47,9 @@ int main(int argc, char *argv[]) iphone_device_t phone = NULL; iphone_error_t ret = IPHONE_E_UNKNOWN_ERROR; int i; - int bus_n = -1, dev_n = -1; + char uuid[41]; int port = 0; + uuid[0] = 0; signal(SIGINT, clean_exit); signal(SIGQUIT, clean_exit); @@ -62,11 +62,13 @@ int main(int argc, char *argv[]) iphone_set_debug_mask(DBGMASK_ALL); continue; } - else if (!strcmp(argv[i], "-u") || !strcmp(argv[i], "--usb")) { - if (sscanf(argv[++i], "%d,%d", &bus_n, &dev_n) < 2) { + else if (!strcmp(argv[i], "-u") || !strcmp(argv[i], "--uuid")) { + i++; + if (!argv[i] || (strlen(argv[i]) != 40)) { print_usage(argc, argv); return 0; } + strcpy(uuid, argv[i]); continue; } else if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "--help")) { @@ -79,21 +81,21 @@ int main(int argc, char *argv[]) } } -/* if (bus_n != -1) { - ret = iphone_get_specific_device(bus_n, dev_n, &phone); + if (uuid[0] != 0) { + ret = iphone_get_device_by_uuid(&phone, uuid); if (ret != IPHONE_E_SUCCESS) { - printf("No device found for usb bus %d and dev %d, is it plugged in?\n", bus_n, dev_n); + printf("No device found with uuid %s, is it plugged in?\n", uuid); return -1; } } else - {*/ + { ret = iphone_get_device(&phone); if (ret != IPHONE_E_SUCCESS) { printf("No device found, is it plugged in?\n"); return -1; } -/* }*/ + } if (IPHONE_E_SUCCESS != iphone_lckd_new_client(phone, &control)) { iphone_free_device(phone); @@ -152,7 +154,7 @@ void print_usage(int argc, char **argv) printf("Usage: %s [OPTIONS]\n", (strrchr(argv[0], '/') + 1)); printf("Relay syslog of a connected iPhone/iPod Touch.\n\n"); printf(" -d, --debug\t\tenable communication debugging\n"); - printf(" -u, --usb=BUS,DEV\ttarget specific device by usb bus/dev number\n"); + printf(" -u, --uuid UUID\ttarget specific device by its 40-digit device UUID\n"); printf(" -h, --help\t\tprints usage information\n"); printf("\n"); } |