summaryrefslogtreecommitdiffstats
path: root/tools/ideviceinfo.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/ideviceinfo.c')
-rw-r--r--tools/ideviceinfo.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/tools/ideviceinfo.c b/tools/ideviceinfo.c
index 0697990..9b13ab8 100644
--- a/tools/ideviceinfo.c
+++ b/tools/ideviceinfo.c
@@ -24,6 +24,8 @@
24#include <config.h> 24#include <config.h>
25#endif 25#endif
26 26
27#define TOOL_NAME "ideviceinfo"
28
27#include <stdio.h> 29#include <stdio.h>
28#include <string.h> 30#include <string.h>
29#include <errno.h> 31#include <errno.h>
@@ -97,14 +99,15 @@ static void print_usage(int argc, char **argv, int is_error)
97 "Show information about a connected device.\n" \ 99 "Show information about a connected device.\n" \
98 "\n" \ 100 "\n" \
99 "OPTIONS:\n" \ 101 "OPTIONS:\n" \
100 " -s, --simple use a simple connection to avoid auto-pairing with the device\n" \
101 " -u, --udid UDID target specific device by UDID\n" \ 102 " -u, --udid UDID target specific device by UDID\n" \
102 " -n, --network connect to network device even if available via USB\n" \ 103 " -n, --network connect to network device even if available via USB\n" \
104 " -s, --simple use a simple connection to avoid auto-pairing with the device\n" \
103 " -q, --domain NAME set domain of query to NAME. Default: None\n" \ 105 " -q, --domain NAME set domain of query to NAME. Default: None\n" \
104 " -k, --key NAME only query key specified by NAME. Default: All keys.\n" \ 106 " -k, --key NAME only query key specified by NAME. Default: All keys.\n" \
105 " -x, --xml output information as xml plist instead of key/value pairs\n" \ 107 " -x, --xml output information as xml plist instead of key/value pairs\n" \
106 " -h, --help prints usage information\n" \ 108 " -h, --help prints usage information\n" \
107 " -d, --debug enable communication debugging\n" \ 109 " -d, --debug enable communication debugging\n" \
110 " -v, --version prints version information\n" \
108 "\n" 111 "\n"
109 ); 112 );
110 fprintf(is_error ? stderr : stdout, "Known domains are:\n\n"); 113 fprintf(is_error ? stderr : stdout, "Known domains are:\n\n");
@@ -144,6 +147,7 @@ int main(int argc, char *argv[])
144 { "key", required_argument, NULL, 'k' }, 147 { "key", required_argument, NULL, 'k' },
145 { "simple", no_argument, NULL, 's' }, 148 { "simple", no_argument, NULL, 's' },
146 { "xml", no_argument, NULL, 'x' }, 149 { "xml", no_argument, NULL, 'x' },
150 { "version", no_argument, NULL, 'v' },
147 { NULL, 0, NULL, 0} 151 { NULL, 0, NULL, 0}
148 }; 152 };
149 153
@@ -151,7 +155,7 @@ int main(int argc, char *argv[])
151 signal(SIGPIPE, SIG_IGN); 155 signal(SIGPIPE, SIG_IGN);
152#endif 156#endif
153 157
154 while ((c = getopt_long(argc, argv, "dhu:nq:k:sx", longopts, NULL)) != -1) { 158 while ((c = getopt_long(argc, argv, "dhu:nq:k:sxv", longopts, NULL)) != -1) {
155 switch (c) { 159 switch (c) {
156 case 'd': 160 case 'd':
157 idevice_set_debug_level(1); 161 idevice_set_debug_level(1);
@@ -195,6 +199,9 @@ int main(int argc, char *argv[])
195 case 'h': 199 case 'h':
196 print_usage(argc, argv, 0); 200 print_usage(argc, argv, 0);
197 return 0; 201 return 0;
202 case 'v':
203 printf("%s %s\n", TOOL_NAME, PACKAGE_VERSION);
204 return 0;
198 default: 205 default:
199 print_usage(argc, argv, 1); 206 print_usage(argc, argv, 1);
200 return 2; 207 return 2;
@@ -215,8 +222,8 @@ int main(int argc, char *argv[])
215 } 222 }
216 223
217 if (LOCKDOWN_E_SUCCESS != (ldret = simple ? 224 if (LOCKDOWN_E_SUCCESS != (ldret = simple ?
218 lockdownd_client_new(device, &client, "ideviceinfo"): 225 lockdownd_client_new(device, &client, TOOL_NAME):
219 lockdownd_client_new_with_handshake(device, &client, "ideviceinfo"))) { 226 lockdownd_client_new_with_handshake(device, &client, TOOL_NAME))) {
220 fprintf(stderr, "ERROR: Could not connect to lockdownd: %s (%d)\n", lockdownd_strerror(ldret), ldret); 227 fprintf(stderr, "ERROR: Could not connect to lockdownd: %s (%d)\n", lockdownd_strerror(ldret), ldret);
221 idevice_free(device); 228 idevice_free(device);
222 return -1; 229 return -1;