summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/idevice_id.c36
1 files changed, 13 insertions, 23 deletions
diff --git a/tools/idevice_id.c b/tools/idevice_id.c
index 963d1d5..b746491 100644
--- a/tools/idevice_id.c
+++ b/tools/idevice_id.c
@@ -104,20 +104,9 @@ int main(int argc, char **argv)
104 } 104 }
105 udid = argv[0]; 105 udid = argv[0];
106 106
107 enum idevice_connection_type conn_type = 0;
108 enum idevice_options opts = 0;
109 if (include_usb) {
110 conn_type |= CONNECTION_USBMUXD;
111 opts |= IDEVICE_LOOKUP_USBMUX;
112 }
113 if (include_network) {
114 conn_type |= CONNECTION_NETWORK;
115 opts |= IDEVICE_LOOKUP_NETWORK;
116 }
117
118 switch (mode) { 107 switch (mode) {
119 case MODE_SHOW_ID: 108 case MODE_SHOW_ID:
120 idevice_new_with_options(&device, udid, opts); 109 idevice_new_with_options(&device, udid, IDEVICE_LOOKUP_USBMUX | IDEVICE_LOOKUP_NETWORK);
121 if (!device) { 110 if (!device) {
122 fprintf(stderr, "ERROR: No device with UDID %s attached.\n", udid); 111 fprintf(stderr, "ERROR: No device with UDID %s attached.\n", udid);
123 return -2; 112 return -2;
@@ -144,8 +133,8 @@ int main(int argc, char **argv)
144 if (device_name) { 133 if (device_name) {
145 free(device_name); 134 free(device_name);
146 } 135 }
136 break;
147 137
148 return ret;
149 case MODE_LIST_DEVICES: 138 case MODE_LIST_DEVICES:
150 default: 139 default:
151 if (idevice_get_device_list_extended(&dev_list, &i) < 0) { 140 if (idevice_get_device_list_extended(&dev_list, &i) < 0) {
@@ -153,19 +142,20 @@ int main(int argc, char **argv)
153 return -1; 142 return -1;
154 } 143 }
155 for (i = 0; dev_list[i] != NULL; i++) { 144 for (i = 0; dev_list[i] != NULL; i++) {
156 if (dev_list[i]->conn_type & conn_type) { 145 if (dev_list[i]->conn_type == CONNECTION_USBMUXD && !include_usb) continue;
157 printf("%s", dev_list[i]->udid); 146 if (dev_list[i]->conn_type == CONNECTION_NETWORK && !include_network) continue;
158 if (include_usb && include_network) { 147 printf("%s", dev_list[i]->udid);
159 if (dev_list[i]->conn_type == CONNECTION_NETWORK) { 148 if (include_usb && include_network) {
160 printf(" (WiFi)"); 149 if (dev_list[i]->conn_type == CONNECTION_NETWORK) {
161 } else { 150 printf(" (WiFi)");
162 printf(" (USB)"); 151 } else {
163 } 152 printf(" (USB)");
164 } 153 }
165 printf("\n");
166 } 154 }
155 printf("\n");
167 } 156 }
168 idevice_device_list_extended_free(dev_list); 157 idevice_device_list_extended_free(dev_list);
169 return 0; 158 break;
170 } 159 }
160 return ret;
171} 161}