Fixes #170 - ios-deploy installing over both USB and WiFi

This commit is contained in:
Shazron Abdullah 2015-10-06 16:51:27 -07:00
parent adc8a5b9c2
commit 3756385651
2 changed files with 7 additions and 2 deletions

View File

@ -195,6 +195,10 @@ mach_error_t AMDeviceNotificationSubscribe(am_device_notification_callback
callback, unsigned int unused0, unsigned int unused1, void* //unsigned int callback, unsigned int unused0, unsigned int unused1, void* //unsigned int
dn_unknown3, struct am_device_notification **notification); dn_unknown3, struct am_device_notification **notification);
mach_error_t AMDeviceNotificationUnsubscribe(am_device_notification subscription);
/* Connects to the iPhone. Pass in the am_device structure that the /* Connects to the iPhone. Pass in the am_device structure that the
* notification callback will give to you. * notification callback will give to you.
* *

View File

@ -180,6 +180,7 @@ pid_t child = 0;
const int SIGLLDB = SIGUSR1; const int SIGLLDB = SIGUSR1;
AMDeviceRef best_device_match = NULL; AMDeviceRef best_device_match = NULL;
NSString* tmpUUID; NSString* tmpUUID;
struct am_device_notification *notify;
// Error codes we report on different failures, so scripts can distinguish between user app exit // Error codes we report on different failures, so scripts can distinguish between user app exit
// codes and our exit codes. For non app errors we use codes in reserved 128-255 range. // codes and our exit codes. For non app errors we use codes in reserved 128-255 range.
@ -1714,7 +1715,8 @@ void device_callback(struct am_device_notification_callback_info *info, void *ar
switch (info->msg) { switch (info->msg) {
case ADNCI_MSG_CONNECTED: case ADNCI_MSG_CONNECTED:
if(device_id != NULL || !debug || AMDeviceGetInterfaceType(info->dev) != 2) { if(device_id != NULL || !debug || AMDeviceGetInterfaceType(info->dev) != 2) {
handle_device(info->dev); AMDeviceNotificationUnsubscribe(*notify);
handle_device(info->dev);
} else if(best_device_match == NULL) { } else if(best_device_match == NULL) {
best_device_match = info->dev; best_device_match = info->dev;
CFRetain(best_device_match); CFRetain(best_device_match);
@ -1967,7 +1969,6 @@ int main(int argc, char *argv[]) {
NSLogOut(@"[....] Waiting for iOS device to be connected"); NSLogOut(@"[....] Waiting for iOS device to be connected");
} }
struct am_device_notification *notify;
AMDeviceNotificationSubscribe(&device_callback, 0, 0, NULL, &notify); AMDeviceNotificationSubscribe(&device_callback, 0, 0, NULL, &notify);
CFRunLoopRun(); CFRunLoopRun();
} }