diff options
| author | 2020-06-05 23:17:12 +0200 | |
|---|---|---|
| committer | 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 @@ | |||
| 1 | .TH "idevice_id" 1 | 1 | .TH "idevice_id" 1 |
| 2 | .SH NAME | 2 | .SH NAME |
| 3 | idevice_id \- Prints device name or a list of attached devices. | 3 | idevice_id \- List attached devices or print device name of given device. |
| 4 | .SH SYNOPSIS | 4 | .SH SYNOPSIS |
| 5 | .B idevice_id | 5 | .B idevice_id |
| 6 | [OPTIONS] [UDID] | 6 | [OPTIONS] [UDID] |
| 7 | 7 | ||
| 8 | .SH DESCRIPTION | 8 | .SH DESCRIPTION |
| 9 | 9 | ||
| 10 | Prints device name or a list of attached devices. | 10 | \f[B]idevice_id\f[] prints a list of attached devices. If a UDID is given, |
| 11 | UDID is the unique device identifier of the device | 11 | the name of the connected device with that UDID will be retrieved. |
| 12 | for which the name should be retrieved. | 12 | |
| 13 | Without any options, \f[B]idevice_id\f[] will list all available devices, | ||
| 14 | USB and network. | ||
| 15 | The output can be further controlled with the following OPTIONS. | ||
| 13 | 16 | ||
| 14 | .SH OPTIONS | 17 | .SH OPTIONS |
| 15 | .TP | 18 | .TP |
| 16 | .B \-l, \-\-list | 19 | .B \-l, \-\-list |
| 17 | list UDID of all attached devices | 20 | List UDIDs of all devices attached via USB. |
| 21 | .TP | ||
| 22 | .B \-n, \-\-network | ||
| 23 | List UDIDs of all devices available via network. | ||
| 18 | .TP | 24 | .TP |
| 19 | .B \-d, \-\-debug | 25 | .B \-d, \-\-debug |
| 20 | enable communication debugging. | 26 | Enable communication debugging. |
| 21 | .TP | 27 | .TP |
| 22 | .B \-h, \-\-help | 28 | .B \-h, \-\-help |
| 23 | prints usage information. | 29 | Prints usage information. |
| 24 | .TP | 30 | .TP |
| 25 | .B \-v, \-\-version | 31 | .B \-v, \-\-version |
| 26 | prints version information. | 32 | Prints version information. |
| 27 | .TP | 33 | .TP |
| 28 | 34 | ||
| 29 | .SH AUTHORS | 35 | .SH AUTHOR |
| 30 | Zach C. | 36 | Nikias Bassen |
| 31 | |||
| 32 | Jonathan Beck | ||
| 33 | |||
| 34 | Matt Colyer | ||
| 35 | |||
| 36 | Martin Aumueller | ||
| 37 | |||
| 38 | Christophe Fergeau | ||
| 39 | |||
| 40 | Martin S. | ||
| 41 | |||
| 42 | Paul Sladen | ||
| 43 | |||
| 44 | Patrick Walton | ||
| 45 | |||
| 46 | Zoltan Balaton | ||
| 47 | |||
| 48 | Nikias Bassen | ||
| 49 | |||
| 50 | Todd Zullinger | ||
| 51 | 37 | ||
| 52 | Man page written to conform with Debian by Julien Lavergne. | 38 | Man page written to conform with Debian by Julien Lavergne. |
| 53 | 39 | ||
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) | |||
| 43 | fprintf(is_error ? stderr : stdout, "Usage: %s [OPTIONS] [UDID]\n", (name ? name + 1: argv[0])); | 43 | fprintf(is_error ? stderr : stdout, "Usage: %s [OPTIONS] [UDID]\n", (name ? name + 1: argv[0])); |
| 44 | fprintf(is_error ? stderr : stdout, | 44 | fprintf(is_error ? stderr : stdout, |
| 45 | "\n" \ | 45 | "\n" \ |
| 46 | "Prints device name or a list of attached devices.\n" \ | 46 | "List attached devices or print device name of given device.\n" \ |
| 47 | "\n" \ | 47 | "\n" \ |
| 48 | " If UDID is given, the name of the connected device with that UDID" \ | 48 | " If UDID is given, the name of the connected device with that UDID" \ |
| 49 | " will be retrieved.\n" \ | 49 | " will be retrieved.\n" \ |
| @@ -68,7 +68,7 @@ int main(int argc, char **argv) | |||
| 68 | char *device_name = NULL; | 68 | char *device_name = NULL; |
| 69 | int ret = 0; | 69 | int ret = 0; |
| 70 | int i; | 70 | int i; |
| 71 | int mode = MODE_SHOW_ID; | 71 | int mode = MODE_LIST_DEVICES; |
| 72 | int include_usb = 0; | 72 | int include_usb = 0; |
| 73 | int include_network = 0; | 73 | int include_network = 0; |
| 74 | const char* udid = NULL; | 74 | const char* udid = NULL; |
| @@ -110,9 +110,11 @@ int main(int argc, char **argv) | |||
| 110 | argc -= optind; | 110 | argc -= optind; |
| 111 | argv += optind; | 111 | argv += optind; |
| 112 | 112 | ||
| 113 | if (mode == MODE_SHOW_ID && argc != 1) { | 113 | if (argc == 1) { |
| 114 | print_usage(argc + optind, argv - optind, 1); | 114 | mode = MODE_SHOW_ID; |
| 115 | exit(EXIT_FAILURE); | 115 | } else if (argc == 0 && optind == 1) { |
| 116 | include_usb = 1; | ||
| 117 | include_network = 1; | ||
| 116 | } | 118 | } |
| 117 | udid = argv[0]; | 119 | udid = argv[0]; |
| 118 | 120 | ||
