diff options
author | Nikias Bassen | 2020-06-05 23:17:12 +0200 |
---|---|---|
committer | Nikias Bassen | 2020-06-05 23:17:12 +0200 |
commit | 86f466396437d21ccc27dda33730993eb181e60e (patch) | |
tree | c4f5d0c88f3196ae8ad4a167b27c648608db186f | |
parent | 18a93b10821a01cf1f706013e6a14014a4d3e2a5 (diff) | |
download | libimobiledevice-86f466396437d21ccc27dda33730993eb181e60e.tar.gz libimobiledevice-86f466396437d21ccc27dda33730993eb181e60e.tar.bz2 |
idevice_id: Update usage and man page, and list all devices when run without options
-rw-r--r-- | docs/idevice_id.1 | 46 | ||||
-rw-r--r-- | tools/idevice_id.c | 12 |
2 files changed, 23 insertions, 35 deletions
diff --git a/docs/idevice_id.1 b/docs/idevice_id.1 index af9db92..caded75 100644 --- a/docs/idevice_id.1 +++ b/docs/idevice_id.1 @@ -1,53 +1,39 @@ .TH "idevice_id" 1 .SH NAME -idevice_id \- Prints device name or a list of attached devices. +idevice_id \- List attached devices or print device name of given device. .SH SYNOPSIS .B idevice_id [OPTIONS] [UDID] .SH DESCRIPTION -Prints device name or a list of attached devices. -UDID is the unique device identifier of the device -for which the name should be retrieved. +\f[B]idevice_id\f[] prints a list of attached devices. If a UDID is given, +the name of the connected device with that UDID will be retrieved. + +Without any options, \f[B]idevice_id\f[] will list all available devices, +USB and network. +The output can be further controlled with the following OPTIONS. .SH OPTIONS .TP .B \-l, \-\-list -list UDID of all attached devices +List UDIDs of all devices attached via USB. +.TP +.B \-n, \-\-network +List UDIDs of all devices available via network. .TP .B \-d, \-\-debug -enable communication debugging. +Enable communication debugging. .TP .B \-h, \-\-help -prints usage information. +Prints usage information. .TP .B \-v, \-\-version -prints version information. +Prints version information. .TP -.SH AUTHORS - Zach C. - - Jonathan Beck - - Matt Colyer - - Martin Aumueller - - Christophe Fergeau - - Martin S. - - Paul Sladen - - Patrick Walton - - Zoltan Balaton - - Nikias Bassen - - Todd Zullinger +.SH AUTHOR +Nikias Bassen Man page written to conform with Debian by Julien Lavergne. diff --git a/tools/idevice_id.c b/tools/idevice_id.c index 7c1b3b4..467d0d3 100644 --- a/tools/idevice_id.c +++ b/tools/idevice_id.c @@ -43,7 +43,7 @@ static void print_usage(int argc, char **argv, int is_error) fprintf(is_error ? stderr : stdout, "Usage: %s [OPTIONS] [UDID]\n", (name ? name + 1: argv[0])); fprintf(is_error ? stderr : stdout, "\n" \ - "Prints device name or a list of attached devices.\n" \ + "List attached devices or print device name of given device.\n" \ "\n" \ " If UDID is given, the name of the connected device with that UDID" \ " will be retrieved.\n" \ @@ -68,7 +68,7 @@ int main(int argc, char **argv) char *device_name = NULL; int ret = 0; int i; - int mode = MODE_SHOW_ID; + int mode = MODE_LIST_DEVICES; int include_usb = 0; int include_network = 0; const char* udid = NULL; @@ -110,9 +110,11 @@ int main(int argc, char **argv) argc -= optind; argv += optind; - if (mode == MODE_SHOW_ID && argc != 1) { - print_usage(argc + optind, argv - optind, 1); - exit(EXIT_FAILURE); + if (argc == 1) { + mode = MODE_SHOW_ID; + } else if (argc == 0 && optind == 1) { + include_usb = 1; + include_network = 1; } udid = argv[0]; |