summaryrefslogtreecommitdiffstats
path: root/tools/iphone_id.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/iphone_id.c')
-rw-r--r--tools/iphone_id.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/tools/iphone_id.c b/tools/iphone_id.c
index 835e214..80f22e1 100644
--- a/tools/iphone_id.c
+++ b/tools/iphone_id.c
@@ -3,7 +3,6 @@
3#include <stdlib.h> 3#include <stdlib.h>
4#include <libiphone/libiphone.h> 4#include <libiphone/libiphone.h>
5#include <libiphone/lockdown.h> 5#include <libiphone/lockdown.h>
6#include <usbmuxd.h>
7 6
8#define MODE_NONE 0 7#define MODE_NONE 0
9#define MODE_SHOW_ID 1 8#define MODE_SHOW_ID 1
@@ -18,7 +17,7 @@ static void print_usage(int argc, char **argv)
18 printf("Prints device name or a list of attached iPhone/iPod Touch devices.\n\n"); 17 printf("Prints device name or a list of attached iPhone/iPod Touch devices.\n\n");
19 printf(" The UUID is a 40-digit hexadecimal number of the device\n"); 18 printf(" The UUID is a 40-digit hexadecimal number of the device\n");
20 printf(" for which the name should be retrieved.\n\n"); 19 printf(" for which the name should be retrieved.\n\n");
21 printf(" -l, --list\t\tlist all attached devices\n"); 20 printf(" -l, --list\t\tlist UUID of all attached devices\n");
22 printf(" -d, --debug\t\tenable communication debugging\n"); 21 printf(" -d, --debug\t\tenable communication debugging\n");
23 printf(" -h, --help\t\tprints usage information\n"); 22 printf(" -h, --help\t\tprints usage information\n");
24 printf("\n"); 23 printf("\n");
@@ -28,7 +27,7 @@ int main(int argc, char **argv)
28{ 27{
29 iphone_device_t phone = NULL; 28 iphone_device_t phone = NULL;
30 lockdownd_client_t client = NULL; 29 lockdownd_client_t client = NULL;
31 usbmuxd_scan_result *dev_list; 30 char **dev_list = NULL;
32 char *devname = NULL; 31 char *devname = NULL;
33 int ret = 0; 32 int ret = 0;
34 int i; 33 int i;
@@ -65,7 +64,7 @@ int main(int argc, char **argv)
65 64
66 switch (mode) { 65 switch (mode) {
67 case MODE_SHOW_ID: 66 case MODE_SHOW_ID:
68 iphone_get_device_by_uuid(&phone, uuid); 67 iphone_device_new(&phone, uuid);
69 if (!phone) { 68 if (!phone) {
70 fprintf(stderr, "ERROR: No device with UUID=%s attached.\n", uuid); 69 fprintf(stderr, "ERROR: No device with UUID=%s attached.\n", uuid);
71 return -2; 70 return -2;
@@ -96,13 +95,14 @@ int main(int argc, char **argv)
96 return ret; 95 return ret;
97 case MODE_LIST_DEVICES: 96 case MODE_LIST_DEVICES:
98 default: 97 default:
99 if (usbmuxd_scan(&dev_list) < 0) { 98 if (iphone_get_device_list(&dev_list, &i) < 0) {
100 fprintf(stderr, "ERROR: usbmuxd is not running!\n"); 99 fprintf(stderr, "ERROR: Unable to retrieve device list!\n");
101 return -1; 100 return -1;
102 } 101 }
103 for (i = 0; dev_list[i].handle > 0; i++) { 102 for (i = 0; dev_list[i] != NULL; i++) {
104 printf("handle=%d product_id=%04x uuid=%s\n", dev_list[i].handle, dev_list[i].product_id, dev_list[i].serial_number); 103 printf("%s\n", dev_list[i]);
105 } 104 }
105 iphone_device_list_free(dev_list);
106 return 0; 106 return 0;
107 } 107 }
108} 108}