summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Martin Szulecki2020-06-04 23:53:47 +0200
committerGravatar Martin Szulecki2020-06-04 23:53:47 +0200
commitc3be9b94d3960fb546cdb721c5f00d26567ba511 (patch)
treed029b0bcd417c82fa36766e39083fab5852cce23
parent03c9bbaa1d036f232e1c5c5f2a0b818a63ff9658 (diff)
downloadlibideviceactivation-c3be9b94d3960fb546cdb721c5f00d26567ba511.tar.gz
libideviceactivation-c3be9b94d3960fb546cdb721c5f00d26567ba511.tar.bz2
Add "--network" option in ideviceactivation tool to support network devices
-rw-r--r--tools/ideviceactivation.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/tools/ideviceactivation.c b/tools/ideviceactivation.c
index a0adba1..bc660d5 100644
--- a/tools/ideviceactivation.c
+++ b/tools/ideviceactivation.c
@@ -64,6 +64,7 @@ static void print_usage(int argc, char **argv)
printf("The following OPTIONS are accepted:\n");
printf(" -d, --debug\t\tenable communication debugging\n");
printf(" -u, --udid UDID\ttarget specific device by UDID\n");
+ printf(" -n, --network\t\tconnect to network device even if available via USB\n");
printf(" -b, --batch\t\texplicitly run in non-interactive mode (default: auto-detect)\n");
printf(" -s, --service URL\tuse activation webservice at URL instead of default\n");
printf(" -v, --version\t\tprint version information and exit\n");
@@ -138,6 +139,7 @@ int main(int argc, char *argv[])
int i;
int interactive = 1;
int result = EXIT_FAILURE;
+ enum idevice_options lookup_opts = IDEVICE_LOOKUP_USBMUX | IDEVICE_LOOKUP_NETWORK;
typedef enum {
OP_NONE = 0, OP_ACTIVATE, OP_DEACTIVATE, OP_GETSTATE
@@ -163,6 +165,10 @@ int main(int argc, char *argv[])
udid = argv[i];
continue;
}
+ else if (!strcmp(argv[i], "-n") || !strcmp(argv[i], "--network")) {
+ lookup_opts |= IDEVICE_LOOKUP_PREFER_NETWORK;
+ continue;
+ }
else if (!strcmp(argv[i], "-s") || !strcmp(argv[i], "--service")) {
i++;
if (!argv[i]) {
@@ -213,20 +219,14 @@ int main(int argc, char *argv[])
return EXIT_FAILURE;
}
- if (udid) {
- ret = idevice_new(&device, udid);
- if (ret != IDEVICE_E_SUCCESS) {
- printf("No device found with UDID %s, is it plugged in?\n", udid);
- return EXIT_FAILURE;
- }
- }
- else
- {
- ret = idevice_new(&device, NULL);
- if (ret != IDEVICE_E_SUCCESS) {
- printf("No device found, is it plugged in?\n");
- return EXIT_FAILURE;
+ ret = idevice_new_with_options(&device, udid, lookup_opts);
+ if (ret != IDEVICE_E_SUCCESS) {
+ if (udid) {
+ printf("ERROR: Device %s not found!\n", udid);
+ } else {
+ printf("ERROR: No device found!\n");
}
+ return EXIT_FAILURE;
}
if (LOCKDOWN_E_SUCCESS != lockdownd_client_new_with_handshake(device, &lockdown, "ideviceactivation")) {