diff options
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"); } |