Skip to content

Commit

Permalink
Merge pull request #192 from jcworsley/master
Browse files Browse the repository at this point in the history
Added no-wifi option to explicitly skip wifi connectivity.
  • Loading branch information
shazron committed Nov 24, 2015
2 parents 3ee31bc + 6a8ad1e commit 28ceb47
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions src/ios-deploy.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ int AMDeviceMountImage(AMDeviceRef device, CFStringRef image, CFDictionaryRef op
mach_error_t AMDeviceLookupApplications(AMDeviceRef device, CFDictionaryRef options, CFDictionaryRef *result);
int AMDeviceGetInterfaceType(struct am_device *device);

bool found_device = false, debug = false, verbose = false, unbuffered = false, nostart = false, detect_only = false, install = true, uninstall = false;
bool found_device = false, debug = false, verbose = false, unbuffered = false, nostart = false, detect_only = false, install = true, uninstall = false, no_wifi = false;
bool command_only = false;
char *command = NULL;
char *target_filename = NULL;
Expand Down Expand Up @@ -1720,8 +1720,15 @@ void device_callback(struct am_device_notification_callback_info *info, void *ar
switch (info->msg) {
case ADNCI_MSG_CONNECTED:
if(device_id != NULL || !debug || AMDeviceGetInterfaceType(info->dev) != 2) {
NSLogVerbose(@"Handling device type: %d", AMDeviceGetInterfaceType(info->dev));
handle_device(info->dev);
if (no_wifi && AMDeviceGetInterfaceType(info->dev) == 2)
{
NSLogVerbose(@"Skipping wifi device (type: %d)", AMDeviceGetInterfaceType(info->dev));
}
else
{
NSLogVerbose(@"Handling device type: %d", AMDeviceGetInterfaceType(info->dev));
handle_device(info->dev);
}
} else if(best_device_match == NULL) {
NSLogVerbose(@"Best device match: %d", AMDeviceGetInterfaceType(info->dev));
best_device_match = info->dev;
Expand Down Expand Up @@ -1793,7 +1800,8 @@ void usage(const char* app) {
@" -R, --rm <path> remove file or directory on device (directories must be empty)\n"
@" -V, --version print the executable version \n"
@" -e, --exists check if the app with given bundle_id is installed or not \n"
@" -B, --list_bundle_id list bundle_id \n",
@" -B, --list_bundle_id list bundle_id \n"
@" -W, --no-wifi ignore wifi devices\n",
[NSString stringWithUTF8String:app]);
}

Expand Down Expand Up @@ -1835,11 +1843,12 @@ int main(int argc, char *argv[]) {
{ "rm", required_argument, NULL, 'R'},
{ "exists", no_argument, NULL, 'e'},
{ "list_bundle_id", no_argument, NULL, 'B'},
{ "no-wifi", no_argument, NULL, 'W'},
{ NULL, 0, NULL, 0 },
};
char ch;

while ((ch = getopt_long(argc, argv, "VmcdvunrILeD:R:i:b:a:t:g:x:p:1:2:o:l::w::9::B::", longopts, NULL)) != -1)
while ((ch = getopt_long(argc, argv, "VmcdvunrILeD:R:i:b:a:t:g:x:p:1:2:o:l::w::9::B::W", longopts, NULL)) != -1)
{
switch (ch) {
case 'm':
Expand Down Expand Up @@ -1935,6 +1944,9 @@ int main(int argc, char *argv[]) {
command_only = true;
command = "list_bundle_id";
break;
case 'W':
no_wifi = true;
break;
default:
usage(argv[0]);
return exitcode_error;
Expand Down

0 comments on commit 28ceb47

Please sign in to comment.