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 342965c16a
commit a6e94923cf
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
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
* notification callback will give to you.
*

View File

@ -180,6 +180,7 @@ pid_t child = 0;
const int SIGLLDB = SIGUSR1;
AMDeviceRef best_device_match = NULL;
NSString* tmpUUID;
struct am_device_notification *notify;
// 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.
@ -1709,7 +1710,8 @@ 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) {
handle_device(info->dev);
AMDeviceNotificationUnsubscribe(*notify);
handle_device(info->dev);
} else if(best_device_match == NULL) {
best_device_match = info->dev;
CFRetain(best_device_match);
@ -1962,7 +1964,6 @@ int main(int argc, char *argv[]) {
NSLogOut(@"[....] Waiting for iOS device to be connected");
}
struct am_device_notification *notify;
AMDeviceNotificationSubscribe(&device_callback, 0, 0, NULL, &notify);
CFRunLoopRun();
}