diff options
| author | 2020-06-05 20:50:34 +0200 | |
|---|---|---|
| committer | 2020-06-05 20:50:34 +0200 | |
| commit | 489a673aeeef4706af3986d41c24ab434e77d7d5 (patch) | |
| tree | 123022859215220cf7f10a483d02bffdf157a0ce /tools/idevicebackup2.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/idevicebackup2.c')
| -rw-r--r-- | tools/idevicebackup2.c | 27 | 
1 files changed, 15 insertions, 12 deletions
| diff --git a/tools/idevicebackup2.c b/tools/idevicebackup2.c index 61302cc..9bbb311 100644 --- a/tools/idevicebackup2.c +++ b/tools/idevicebackup2.c @@ -1431,6 +1431,7 @@ static void print_usage(int argc, char **argv)  	printf("OPTIONS:\n");  	printf("  -u, --udid UDID\ttarget specific device by UDID\n");  	printf("  -s, --source UDID\tuse backup data from device specified by UDID\n"); +	printf("  -n, --network\t\tconnect to network device\n");  	printf("  -i, --interactive\trequest passwords interactively\n");  	printf("  -d, --debug\t\tenable communication debugging\n");  	printf("  -h, --help\t\tprints usage information\n"); @@ -1449,6 +1450,7 @@ int main(int argc, char *argv[])  	int i;  	char* udid = NULL;  	char* source_udid = NULL; +	int use_network = 0;  	lockdownd_service_descriptor_t service = NULL;  	int cmd = -1;  	int cmd_flags = 0; @@ -1496,6 +1498,10 @@ int main(int argc, char *argv[])  			source_udid = strdup(argv[i]);  			continue;  		} +		else if (!strcmp(argv[i], "-n") || !strcmp(argv[i], "--network")) { +			use_network = 1; +			continue; +		}  		else if (!strcmp(argv[i], "-i") || !strcmp(argv[i], "--interactive")) {  			interactive_mode = 1;  			continue; @@ -1669,20 +1675,17 @@ int main(int argc, char *argv[])  	}  	idevice_t device = NULL; -	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 -1; +	ret = idevice_new_with_options(&device, udid, (use_network) ? IDEVICE_LOOKUP_NETWORK : IDEVICE_LOOKUP_USBMUX); +	if (ret != IDEVICE_E_SUCCESS) { +		if (udid) { +			printf("No device found with udid %s.\n", udid); +		} else { +			printf("No device found.\n");  		} +		return -1;  	} -	else -	{ -		ret = idevice_new(&device, NULL); -		if (ret != IDEVICE_E_SUCCESS) { -			printf("No device found, is it plugged in?\n"); -			return -1; -		} + +	if (!udid) {  		idevice_get_udid(device, &udid);  	} | 
