summaryrefslogtreecommitdiffstats
path: root/tools/idevicedebug.c
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2020-06-05 20:50:34 +0200
committerGravatar Nikias Bassen2020-06-05 20:50:34 +0200
commit489a673aeeef4706af3986d41c24ab434e77d7d5 (patch)
tree123022859215220cf7f10a483d02bffdf157a0ce /tools/idevicedebug.c
parent3aa4e243faa8198550cb2851cb6f0b9cbb293812 (diff)
downloadlibimobiledevice-489a673aeeef4706af3986d41c24ab434e77d7d5.tar.gz
libimobiledevice-489a673aeeef4706af3986d41c24ab434e77d7d5.tar.bz2
tools: Unify --network command line switch and add it where missing
Diffstat (limited to 'tools/idevicedebug.c')
-rw-r--r--tools/idevicedebug.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/tools/idevicedebug.c b/tools/idevicedebug.c
index 66e997d..83a70a4 100644
--- a/tools/idevicedebug.c
+++ b/tools/idevicedebug.c
@@ -196,6 +196,7 @@ static void print_usage(int argc, char **argv)
196 printf("\n"); 196 printf("\n");
197 printf("The following OPTIONS are accepted:\n"); 197 printf("The following OPTIONS are accepted:\n");
198 printf(" -u, --udid UDID\ttarget specific device by UDID\n"); 198 printf(" -u, --udid UDID\ttarget specific device by UDID\n");
199 printf(" -n, --network\t\tconnect to network device\n");
199 printf(" -e, --env NAME=VALUE\tset environment variable NAME to VALUE\n"); 200 printf(" -e, --env NAME=VALUE\tset environment variable NAME to VALUE\n");
200 printf(" -d, --debug\t\tenable communication debugging\n"); 201 printf(" -d, --debug\t\tenable communication debugging\n");
201 printf(" -h, --help\t\tprints usage information\n"); 202 printf(" -h, --help\t\tprints usage information\n");
@@ -215,6 +216,7 @@ int main(int argc, char *argv[])
215 int i; 216 int i;
216 int cmd = CMD_NONE; 217 int cmd = CMD_NONE;
217 const char* udid = NULL; 218 const char* udid = NULL;
219 int use_network = 0;
218 const char* bundle_identifier = NULL; 220 const char* bundle_identifier = NULL;
219 char* path = NULL; 221 char* path = NULL;
220 char* working_directory = NULL; 222 char* working_directory = NULL;
@@ -249,6 +251,9 @@ int main(int argc, char *argv[])
249 } 251 }
250 udid = argv[i]; 252 udid = argv[i];
251 continue; 253 continue;
254 } else if (!strcmp(argv[i], "-n") || !strcmp(argv[i], "--network")) {
255 use_network = 1;
256 continue;
252 } else if (!strcmp(argv[i], "-e") || !strcmp(argv[i], "--env")) { 257 } else if (!strcmp(argv[i], "-e") || !strcmp(argv[i], "--env")) {
253 i++; 258 i++;
254 if (!argv[i] || (strlen(argv[i]) <= 1) || strchr(argv[i], '=') == NULL) { 259 if (!argv[i] || (strlen(argv[i]) <= 1) || strchr(argv[i], '=') == NULL) {
@@ -306,12 +311,12 @@ int main(int argc, char *argv[])
306 } 311 }
307 312
308 /* connect to the device */ 313 /* connect to the device */
309 ret = idevice_new(&device, udid); 314 ret = idevice_new_with_options(&device, udid, (use_network) ? IDEVICE_LOOKUP_NETWORK : IDEVICE_LOOKUP_USBMUX);
310 if (ret != IDEVICE_E_SUCCESS) { 315 if (ret != IDEVICE_E_SUCCESS) {
311 if (udid) { 316 if (udid) {
312 printf("No device found with udid %s, is it plugged in?\n", udid); 317 printf("No device found with udid %s.\n", udid);
313 } else { 318 } else {
314 printf("No device found, is it plugged in?\n"); 319 printf("No device found.\n");
315 } 320 }
316 goto cleanup; 321 goto cleanup;
317 } 322 }