diff options
| author | 2020-06-05 20:50:34 +0200 | |
|---|---|---|
| committer | 2020-06-05 20:50:34 +0200 | |
| commit | 489a673aeeef4706af3986d41c24ab434e77d7d5 (patch) | |
| tree | 123022859215220cf7f10a483d02bffdf157a0ce /tools/idevicedate.c | |
| parent | 3aa4e243faa8198550cb2851cb6f0b9cbb293812 (diff) | |
| download | libimobiledevice-489a673aeeef4706af3986d41c24ab434e77d7d5.tar.gz libimobiledevice-489a673aeeef4706af3986d41c24ab434e77d7d5.tar.bz2 | |
tools: Unify --network command line switch and add it where missing
Diffstat (limited to 'tools/idevicedate.c')
| -rw-r--r-- | tools/idevicedate.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/tools/idevicedate.c b/tools/idevicedate.c index e1fbc20..a9d78c1 100644 --- a/tools/idevicedate.c +++ b/tools/idevicedate.c | |||
| @@ -59,6 +59,7 @@ static void print_usage(int argc, char **argv) | |||
| 59 | printf("\n"); | 59 | printf("\n"); |
| 60 | printf("OPTIONS:\n"); | 60 | printf("OPTIONS:\n"); |
| 61 | printf(" -u, --udid UDID\ttarget specific device by UDID\n"); | 61 | printf(" -u, --udid UDID\ttarget specific device by UDID\n"); |
| 62 | printf(" -n, --network\t\tconnect to network device\n"); | ||
| 62 | printf(" -s, --set TIMESTAMP\tset UTC time described by TIMESTAMP\n"); | 63 | printf(" -s, --set TIMESTAMP\tset UTC time described by TIMESTAMP\n"); |
| 63 | printf(" -c, --sync\t\tset time of device to current system time\n"); | 64 | printf(" -c, --sync\t\tset time of device to current system time\n"); |
| 64 | printf(" -d, --debug\t\tenable communication debugging\n"); | 65 | printf(" -d, --debug\t\tenable communication debugging\n"); |
| @@ -77,6 +78,7 @@ int main(int argc, char *argv[]) | |||
| 77 | idevice_error_t ret = IDEVICE_E_UNKNOWN_ERROR; | 78 | idevice_error_t ret = IDEVICE_E_UNKNOWN_ERROR; |
| 78 | int i; | 79 | int i; |
| 79 | const char* udid = NULL; | 80 | const char* udid = NULL; |
| 81 | int use_network = 0; | ||
| 80 | time_t setdate = 0; | 82 | time_t setdate = 0; |
| 81 | plist_t node = NULL; | 83 | plist_t node = NULL; |
| 82 | int node_type = -1; | 84 | int node_type = -1; |
| @@ -104,6 +106,10 @@ int main(int argc, char *argv[]) | |||
| 104 | udid = argv[i]; | 106 | udid = argv[i]; |
| 105 | continue; | 107 | continue; |
| 106 | } | 108 | } |
| 109 | else if (!strcmp(argv[i], "-n") || !strcmp(argv[i], "--network")) { | ||
| 110 | use_network = 1; | ||
| 111 | continue; | ||
| 112 | } | ||
| 107 | else if (!strcmp(argv[i], "-s") || !strcmp(argv[i], "--set")) { | 113 | else if (!strcmp(argv[i], "-s") || !strcmp(argv[i], "--set")) { |
| 108 | i++; | 114 | i++; |
| 109 | if (!argv[i] || (strlen(argv[i]) <= 1)) { | 115 | if (!argv[i] || (strlen(argv[i]) <= 1)) { |
| @@ -142,12 +148,12 @@ int main(int argc, char *argv[]) | |||
| 142 | } | 148 | } |
| 143 | } | 149 | } |
| 144 | 150 | ||
| 145 | ret = idevice_new(&device, udid); | 151 | ret = idevice_new_with_options(&device, udid, (use_network) ? IDEVICE_LOOKUP_NETWORK : IDEVICE_LOOKUP_USBMUX); |
| 146 | if (ret != IDEVICE_E_SUCCESS) { | 152 | if (ret != IDEVICE_E_SUCCESS) { |
| 147 | if (udid) { | 153 | if (udid) { |
| 148 | printf("No device found with udid %s, is it plugged in?\n", udid); | 154 | printf("No device found with udid %s.\n", udid); |
| 149 | } else { | 155 | } else { |
| 150 | printf("No device found, is it plugged in?\n"); | 156 | printf("No device found.\n"); |
| 151 | } | 157 | } |
| 152 | return -1; | 158 | return -1; |
| 153 | } | 159 | } |
