summaryrefslogtreecommitdiffstats
path: root/tools/ideviceimagemounter.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/ideviceimagemounter.c')
-rw-r--r--tools/ideviceimagemounter.c28
1 files changed, 19 insertions, 9 deletions
diff --git a/tools/ideviceimagemounter.c b/tools/ideviceimagemounter.c
index df43d5a..c89ddd3 100644
--- a/tools/ideviceimagemounter.c
+++ b/tools/ideviceimagemounter.c
@@ -49,6 +49,7 @@
49#include "common/utils.h" 49#include "common/utils.h"
50 50
51static int list_mode = 0; 51static int list_mode = 0;
52static int use_network = 0;
52static int xml_mode = 0; 53static int xml_mode = 0;
53static char *udid = NULL; 54static char *udid = NULL;
54static char *imagetype = NULL; 55static char *imagetype = NULL;
@@ -72,6 +73,7 @@ static void print_usage(int argc, char **argv)
72 printf("\n"); 73 printf("\n");
73 printf("OPTIONS:\n"); 74 printf("OPTIONS:\n");
74 printf(" -u, --udid UDID\ttarget specific device by UDID\n"); 75 printf(" -u, --udid UDID\ttarget specific device by UDID\n");
76 printf(" -n, --network\t\tconnect to network device\n");
75 printf(" -l, --list\t\tList mount information\n"); 77 printf(" -l, --list\t\tList mount information\n");
76 printf(" -t, --imagetype\tImage type to use, default is 'Developer'\n"); 78 printf(" -t, --imagetype\tImage type to use, default is 'Developer'\n");
77 printf(" -x, --xml\t\tUse XML output\n"); 79 printf(" -x, --xml\t\tUse XML output\n");
@@ -86,19 +88,20 @@ static void print_usage(int argc, char **argv)
86static void parse_opts(int argc, char **argv) 88static void parse_opts(int argc, char **argv)
87{ 89{
88 static struct option longopts[] = { 90 static struct option longopts[] = {
89 { "help", no_argument, NULL, 'h'}, 91 { "help", no_argument, NULL, 'h' },
90 { "udid", required_argument, NULL, 'u'}, 92 { "udid", required_argument, NULL, 'u' },
91 { "list", no_argument, NULL, 'l'}, 93 { "network", no_argument, NULL, 'n' },
92 { "imagetype", required_argument, NULL, 't'}, 94 { "list", no_argument, NULL, 'l' },
93 { "xml", no_argument, NULL, 'x'}, 95 { "imagetype", required_argument, NULL, 't' },
94 { "debug", no_argument, NULL, 'd'}, 96 { "xml", no_argument, NULL, 'x' },
97 { "debug", no_argument, NULL, 'd' },
95 { "version", no_argument, NULL, 'v' }, 98 { "version", no_argument, NULL, 'v' },
96 { NULL, 0, NULL, 0 } 99 { NULL, 0, NULL, 0 }
97 }; 100 };
98 int c; 101 int c;
99 102
100 while (1) { 103 while (1) {
101 c = getopt_long(argc, argv, "hu:lt:xdv", longopts, NULL); 104 c = getopt_long(argc, argv, "hu:lt:xdnv", longopts, NULL);
102 if (c == -1) { 105 if (c == -1) {
103 break; 106 break;
104 } 107 }
@@ -116,6 +119,9 @@ static void parse_opts(int argc, char **argv)
116 free(udid); 119 free(udid);
117 udid = strdup(optarg); 120 udid = strdup(optarg);
118 break; 121 break;
122 case 'n':
123 use_network = 1;
124 break;
119 case 'l': 125 case 'l':
120 list_mode = 1; 126 list_mode = 1;
121 break; 127 break;
@@ -191,8 +197,12 @@ int main(int argc, char **argv)
191 } 197 }
192 } 198 }
193 199
194 if (IDEVICE_E_SUCCESS != idevice_new(&device, udid)) { 200 if (IDEVICE_E_SUCCESS != idevice_new_with_options(&device, udid, (use_network) ? IDEVICE_LOOKUP_NETWORK : IDEVICE_LOOKUP_USBMUX)) {
195 printf("No device found, is it plugged in?\n"); 201 if (udid) {
202 printf("No device found with udid %s.\n", udid);
203 } else {
204 printf("No device found.\n");
205 }
196 return -1; 206 return -1;
197 } 207 }
198 208