Incremented version to 1.5.0

This commit is contained in:
Shazron Abdullah 2015-04-06 13:53:56 -07:00
parent 54818aae5c
commit 5efdcae8ce
2 changed files with 63 additions and 64 deletions

View File

@ -16,7 +16,7 @@
#include <netinet/tcp.h> #include <netinet/tcp.h>
#include "MobileDevice.h" #include "MobileDevice.h"
#define APP_VERSION "1.4.0" #define APP_VERSION "1.5.0"
#define PREP_CMDS_PATH "/tmp/fruitstrap-lldb-prep-cmds-" #define PREP_CMDS_PATH "/tmp/fruitstrap-lldb-prep-cmds-"
#define LLDB_SHELL "lldb -s " PREP_CMDS_PATH #define LLDB_SHELL "lldb -s " PREP_CMDS_PATH
/* /*
@ -328,16 +328,16 @@ const CFStringRef get_device_hardware_name(const AMDeviceRef device) {
} }
// iPod Touch // iPod Touch
GET_FRIENDLY_MODEL_NAME(model, "N45AP", "iPod Touch") GET_FRIENDLY_MODEL_NAME(model, "N45AP", "iPod Touch")
GET_FRIENDLY_MODEL_NAME(model, "N72AP", "iPod Touch 2G") GET_FRIENDLY_MODEL_NAME(model, "N72AP", "iPod Touch 2G")
GET_FRIENDLY_MODEL_NAME(model, "N18AP", "iPod Touch 3G") GET_FRIENDLY_MODEL_NAME(model, "N18AP", "iPod Touch 3G")
GET_FRIENDLY_MODEL_NAME(model, "N81AP", "iPod Touch 4G") GET_FRIENDLY_MODEL_NAME(model, "N81AP", "iPod Touch 4G")
GET_FRIENDLY_MODEL_NAME(model, "N78AP", "iPod Touch 5G") GET_FRIENDLY_MODEL_NAME(model, "N78AP", "iPod Touch 5G")
GET_FRIENDLY_MODEL_NAME(model, "N78AAP", "iPod Touch 5G") GET_FRIENDLY_MODEL_NAME(model, "N78AAP", "iPod Touch 5G")
// iPad // iPad
GET_FRIENDLY_MODEL_NAME(model, "K48AP", "iPad") GET_FRIENDLY_MODEL_NAME(model, "K48AP", "iPad")
GET_FRIENDLY_MODEL_NAME(model, "K93AP", "iPad 2") GET_FRIENDLY_MODEL_NAME(model, "K93AP", "iPad 2")
GET_FRIENDLY_MODEL_NAME(model, "K94AP", "iPad 2 (GSM)") GET_FRIENDLY_MODEL_NAME(model, "K94AP", "iPad 2 (GSM)")
@ -349,7 +349,7 @@ const CFStringRef get_device_hardware_name(const AMDeviceRef device) {
GET_FRIENDLY_MODEL_NAME(model, "P101AP", "iPad 4") GET_FRIENDLY_MODEL_NAME(model, "P101AP", "iPad 4")
GET_FRIENDLY_MODEL_NAME(model, "P102AP", "iPad 4 (GSM)") GET_FRIENDLY_MODEL_NAME(model, "P102AP", "iPad 4 (GSM)")
GET_FRIENDLY_MODEL_NAME(model, "P103AP", "iPad 4 (CDMA)") GET_FRIENDLY_MODEL_NAME(model, "P103AP", "iPad 4 (CDMA)")
// iPad Mini // iPad Mini
GET_FRIENDLY_MODEL_NAME(model, "P105AP", "iPad mini") GET_FRIENDLY_MODEL_NAME(model, "P105AP", "iPad mini")
@ -357,11 +357,11 @@ const CFStringRef get_device_hardware_name(const AMDeviceRef device) {
GET_FRIENDLY_MODEL_NAME(model, "P107AP", "iPad mini (CDMA)") GET_FRIENDLY_MODEL_NAME(model, "P107AP", "iPad mini (CDMA)")
// Apple TV // Apple TV
GET_FRIENDLY_MODEL_NAME(model, "K66AP", "Apple TV 2G") GET_FRIENDLY_MODEL_NAME(model, "K66AP", "Apple TV 2G")
GET_FRIENDLY_MODEL_NAME(model, "J33AP", "Apple TV 3G") GET_FRIENDLY_MODEL_NAME(model, "J33AP", "Apple TV 3G")
GET_FRIENDLY_MODEL_NAME(model, "J33IAP", "Apple TV 3.1G") GET_FRIENDLY_MODEL_NAME(model, "J33IAP", "Apple TV 3.1G")
// iPhone // iPhone
GET_FRIENDLY_MODEL_NAME(model, "M68AP", "iPhone") GET_FRIENDLY_MODEL_NAME(model, "M68AP", "iPhone")
@ -407,7 +407,7 @@ CFStringRef get_device_full_name(const AMDeviceRef device) {
model_name = NULL; model_name = NULL;
AMDeviceConnect(device); AMDeviceConnect(device);
device_name = AMDeviceCopyValue(device, 0, CFSTR("DeviceName")), device_name = AMDeviceCopyValue(device, 0, CFSTR("DeviceName")),
model_name = get_device_hardware_name(device); model_name = get_device_hardware_name(device);
@ -418,7 +418,7 @@ CFStringRef get_device_full_name(const AMDeviceRef device) {
CFShow(device_name); CFShow(device_name);
printf("\n"); printf("\n");
free(devName); free(devName);
char *mdlName = MYCFStringCopyUTF8String(model_name); char *mdlName = MYCFStringCopyUTF8String(model_name);
printf("Model Name:[%s]\n",mdlName); printf("Model Name:[%s]\n",mdlName);
printf("MM: [%s]\n",CFStringGetCStringPtr(model_name, kCFStringEncodingUTF8)); printf("MM: [%s]\n",CFStringGetCStringPtr(model_name, kCFStringEncodingUTF8));
@ -658,10 +658,10 @@ CFURLRef copy_device_app_url(AMDeviceRef device, CFStringRef identifier) {
@"UIStatusBarHidden", @"UIStatusBarHidden",
@"UISupportedInterfaceOrientations", @"UISupportedInterfaceOrientations",
nil]; nil];
NSDictionary *optionsDict = [NSDictionary dictionaryWithObject:a forKey:@"ReturnAttributes"]; NSDictionary *optionsDict = [NSDictionary dictionaryWithObject:a forKey:@"ReturnAttributes"];
CFDictionaryRef options = (CFDictionaryRef)optionsDict; CFDictionaryRef options = (CFDictionaryRef)optionsDict;
afc_error_t resultStatus = AMDeviceLookupApplications(device, options, &result); afc_error_t resultStatus = AMDeviceLookupApplications(device, options, &result);
assert(resultStatus == 0); assert(resultStatus == 0);
@ -717,13 +717,13 @@ void write_lldb_prep_cmds(AMDeviceRef device, CFURLRef disk_app_url) {
rangeLLDB.length = CFStringGetLength(pmodule); rangeLLDB.length = CFStringGetLength(pmodule);
CFStringFindAndReplace(pmodule, CFSTR("{args}"), cf_args, rangeLLDB, 0); CFStringFindAndReplace(pmodule, CFSTR("{args}"), cf_args, rangeLLDB, 0);
//printf("write_lldb_prep_cmds:args: [%s][%s]\n", CFStringGetCStringPtr (cmds,kCFStringEncodingMacRoman), //printf("write_lldb_prep_cmds:args: [%s][%s]\n", CFStringGetCStringPtr (cmds,kCFStringEncodingMacRoman),
// CFStringGetCStringPtr(pmodule, kCFStringEncodingMacRoman)); // CFStringGetCStringPtr(pmodule, kCFStringEncodingMacRoman));
CFRelease(cf_args); CFRelease(cf_args);
} else { } else {
CFStringFindAndReplace(cmds, CFSTR("{args}"), CFSTR(""), range, 0); CFStringFindAndReplace(cmds, CFSTR("{args}"), CFSTR(""), range, 0);
CFStringFindAndReplace(pmodule, CFSTR("{args}"), CFSTR(""), rangeLLDB, 0); CFStringFindAndReplace(pmodule, CFSTR("{args}"), CFSTR(""), rangeLLDB, 0);
//printf("write_lldb_prep_cmds: [%s][%s]\n", CFStringGetCStringPtr (cmds,kCFStringEncodingMacRoman), //printf("write_lldb_prep_cmds: [%s][%s]\n", CFStringGetCStringPtr (cmds,kCFStringEncodingMacRoman),
// CFStringGetCStringPtr(pmodule, kCFStringEncodingMacRoman)); // CFStringGetCStringPtr(pmodule, kCFStringEncodingMacRoman));
} }
range.length = CFStringGetLength(cmds); range.length = CFStringGetLength(cmds);
@ -974,38 +974,38 @@ void setup_dummy_pipe_on_stdin(int pfd[2]) {
void setup_lldb(AMDeviceRef device, CFURLRef url) { void setup_lldb(AMDeviceRef device, CFURLRef url) {
CFStringRef device_full_name = get_device_full_name(device), CFStringRef device_full_name = get_device_full_name(device),
device_interface_name = get_device_interface_name(device); device_interface_name = get_device_interface_name(device);
AMDeviceConnect(device); AMDeviceConnect(device);
assert(AMDeviceIsPaired(device)); assert(AMDeviceIsPaired(device));
assert(AMDeviceValidatePairing(device) == 0); assert(AMDeviceValidatePairing(device) == 0);
assert(AMDeviceStartSession(device) == 0); assert(AMDeviceStartSession(device) == 0);
printf("------ Debug phase ------\n"); printf("------ Debug phase ------\n");
if(AMDeviceGetInterfaceType(device) == 2) if(AMDeviceGetInterfaceType(device) == 2)
{ {
printf("Cannot debug %s over %s.\n", CFStringGetCStringPtr(device_full_name, CFStringGetSystemEncoding()), CFStringGetCStringPtr(device_interface_name, CFStringGetSystemEncoding())); printf("Cannot debug %s over %s.\n", CFStringGetCStringPtr(device_full_name, CFStringGetSystemEncoding()), CFStringGetCStringPtr(device_interface_name, CFStringGetSystemEncoding()));
exit(0); exit(0);
} }
printf("Starting debug of %s connected through %s...\n", CFStringGetCStringPtr(device_full_name, CFStringGetSystemEncoding()), CFStringGetCStringPtr(device_interface_name, CFStringGetSystemEncoding())); printf("Starting debug of %s connected through %s...\n", CFStringGetCStringPtr(device_full_name, CFStringGetSystemEncoding()), CFStringGetCStringPtr(device_interface_name, CFStringGetSystemEncoding()));
mount_developer_image(device); // put debugserver on the device mount_developer_image(device); // put debugserver on the device
start_remote_debug_server(device); // start debugserver start_remote_debug_server(device); // start debugserver
write_lldb_prep_cmds(device, url); // dump the necessary lldb commands into a file write_lldb_prep_cmds(device, url); // dump the necessary lldb commands into a file
CFRelease(url); CFRelease(url);
printf("[100%%] Connecting to remote debug server\n"); printf("[100%%] Connecting to remote debug server\n");
printf("-------------------------\n"); printf("-------------------------\n");
setpgid(getpid(), 0); setpgid(getpid(), 0);
signal(SIGHUP, killed); signal(SIGHUP, killed);
signal(SIGINT, killed); signal(SIGINT, killed);
signal(SIGTERM, killed); signal(SIGTERM, killed);
// Need this before fork to avoid race conditions. For child process we remove this right after fork. // Need this before fork to avoid race conditions. For child process we remove this right after fork.
signal(SIGLLDB, lldb_finished_handler); signal(SIGLLDB, lldb_finished_handler);
parent = getpid(); parent = getpid();
} }
@ -1039,7 +1039,7 @@ void launch_debugger(AMDeviceRef device, CFURLRef url) {
close(pfd[0]); close(pfd[0]);
close(pfd[1]); close(pfd[1]);
// Notify parent we're exiting // Notify parent we're exiting
kill(parent, SIGLLDB); kill(parent, SIGLLDB);
// Pass lldb exit code // Pass lldb exit code
@ -1062,21 +1062,21 @@ void launch_debugger_and_exit(AMDeviceRef device, CFURLRef url) {
signal(SIGHUP, SIG_DFL); signal(SIGHUP, SIG_DFL);
signal(SIGLLDB, SIG_DFL); signal(SIGLLDB, SIG_DFL);
child = getpid(); child = getpid();
if (dup2(pfd[0],STDIN_FILENO) == -1) if (dup2(pfd[0],STDIN_FILENO) == -1)
perror("dup2 failed"); perror("dup2 failed");
char lldb_shell[400]; char lldb_shell[400];
sprintf(lldb_shell, LLDB_SHELL); sprintf(lldb_shell, LLDB_SHELL);
if(device_id != NULL) if(device_id != NULL)
strcat(lldb_shell, device_id); strcat(lldb_shell, device_id);
int status = system(lldb_shell); // launch lldb int status = system(lldb_shell); // launch lldb
if (status == -1) if (status == -1)
perror("failed launching lldb"); perror("failed launching lldb");
close(pfd[0]); close(pfd[0]);
// Notify parent we're exiting // Notify parent we're exiting
kill(parent, SIGLLDB); kill(parent, SIGLLDB);
// Pass lldb exit code // Pass lldb exit code
@ -1127,20 +1127,20 @@ CFStringRef get_bundle_id(CFURLRef app_url)
return bundle_id; return bundle_id;
} }
void read_dir(service_conn_t afcFd, afc_connection* afc_conn_p, const char* dir, void read_dir(service_conn_t afcFd, afc_connection* afc_conn_p, const char* dir,
void(*callback)(afc_connection *conn,const char *dir,int file)) void(*callback)(afc_connection *conn,const char *dir,int file))
{ {
char *dir_ent; char *dir_ent;
afc_connection afc_conn; afc_connection afc_conn;
if (!afc_conn_p) { if (!afc_conn_p) {
afc_conn_p = &afc_conn; afc_conn_p = &afc_conn;
AFCConnectionOpen(afcFd, 0, &afc_conn_p); AFCConnectionOpen(afcFd, 0, &afc_conn_p);
} }
printf("%s\n", dir); printf("%s\n", dir);
afc_dictionary* afc_dict_p; afc_dictionary* afc_dict_p;
char *key, *val; char *key, *val;
int not_dir = 0; int not_dir = 0;
@ -1150,7 +1150,7 @@ void read_dir(service_conn_t afcFd, afc_connection* afc_conn_p, const char* dir,
// there was a problem reading or opening the file to get info on it, abort // there was a problem reading or opening the file to get info on it, abort
return; return;
} }
while((AFCKeyValueRead(afc_dict_p,&key,&val) == 0) && key && val) { while((AFCKeyValueRead(afc_dict_p,&key,&val) == 0) && key && val) {
if (strcmp(key,"st_ifmt")==0) { if (strcmp(key,"st_ifmt")==0) {
not_dir = strcmp(val,"S_IFDIR"); not_dir = strcmp(val,"S_IFDIR");
@ -1166,23 +1166,23 @@ void read_dir(service_conn_t afcFd, afc_connection* afc_conn_p, const char* dir,
afc_directory* afc_dir_p; afc_directory* afc_dir_p;
afc_error_t err = AFCDirectoryOpen(afc_conn_p, dir, &afc_dir_p); afc_error_t err = AFCDirectoryOpen(afc_conn_p, dir, &afc_dir_p);
if (err != 0) { if (err != 0) {
// Couldn't open dir - was probably a file // Couldn't open dir - was probably a file
return; return;
} else { } else {
if (callback) (*callback)(afc_conn_p, dir, not_dir); if (callback) (*callback)(afc_conn_p, dir, not_dir);
} }
while(true) { while(true) {
err = AFCDirectoryRead(afc_conn_p, afc_dir_p, &dir_ent); err = AFCDirectoryRead(afc_conn_p, afc_dir_p, &dir_ent);
if (err != 0 || !dir_ent) if (err != 0 || !dir_ent)
break; break;
if (strcmp(dir_ent, ".") == 0 || strcmp(dir_ent, "..") == 0) if (strcmp(dir_ent, ".") == 0 || strcmp(dir_ent, "..") == 0)
continue; continue;
char* dir_joined = malloc(strlen(dir) + strlen(dir_ent) + 2); char* dir_joined = malloc(strlen(dir) + strlen(dir_ent) + 2);
strcpy(dir_joined, dir); strcpy(dir_joined, dir);
if (dir_joined[strlen(dir)-1] != '/') if (dir_joined[strlen(dir)-1] != '/')
@ -1191,7 +1191,7 @@ void read_dir(service_conn_t afcFd, afc_connection* afc_conn_p, const char* dir,
read_dir(afcFd, afc_conn_p, dir_joined, callback); read_dir(afcFd, afc_conn_p, dir_joined, callback);
free(dir_joined); free(dir_joined);
} }
AFCDirectoryClose(afc_conn_p, afc_dir_p); AFCDirectoryClose(afc_conn_p, afc_dir_p);
} }
@ -1202,25 +1202,25 @@ service_conn_t start_house_arrest_service(AMDeviceRef device) {
assert(AMDeviceIsPaired(device)); assert(AMDeviceIsPaired(device));
assert(AMDeviceValidatePairing(device) == 0); assert(AMDeviceValidatePairing(device) == 0);
assert(AMDeviceStartSession(device) == 0); assert(AMDeviceStartSession(device) == 0);
service_conn_t houseFd; service_conn_t houseFd;
if (bundle_id == NULL) { if (bundle_id == NULL) {
printf("Bundle id is not specified\n"); printf("Bundle id is not specified\n");
exit(1); exit(1);
} }
CFStringRef cf_bundle_id = CFStringCreateWithCString(NULL, bundle_id, kCFStringEncodingASCII); CFStringRef cf_bundle_id = CFStringCreateWithCString(NULL, bundle_id, kCFStringEncodingASCII);
if (AMDeviceStartHouseArrestService(device, cf_bundle_id, 0, &houseFd, 0) != 0) if (AMDeviceStartHouseArrestService(device, cf_bundle_id, 0, &houseFd, 0) != 0)
{ {
printf("Unable to find bundle with id: %s\n", bundle_id); printf("Unable to find bundle with id: %s\n", bundle_id);
exit(1); exit(1);
} }
assert(AMDeviceStopSession(device) == 0); assert(AMDeviceStopSession(device) == 0);
assert(AMDeviceDisconnect(device) == 0); assert(AMDeviceDisconnect(device) == 0);
CFRelease(cf_bundle_id); CFRelease(cf_bundle_id);
return houseFd; return houseFd;
} }
@ -1248,7 +1248,7 @@ void* read_file_to_memory(char * path, size_t* file_size)
{ {
return NULL; return NULL;
} }
*file_size = buf.st_size; *file_size = buf.st_size;
FILE* fd = fopen(path, "r"); FILE* fd = fopen(path, "r");
char* content = malloc(*file_size); char* content = malloc(*file_size);
@ -1264,7 +1264,7 @@ void* read_file_to_memory(char * path, size_t* file_size)
void list_files(AMDeviceRef device) void list_files(AMDeviceRef device)
{ {
service_conn_t houseFd = start_house_arrest_service(device); service_conn_t houseFd = start_house_arrest_service(device);
afc_connection* afc_conn_p; afc_connection* afc_conn_p;
if (AFCConnectionOpen(houseFd, 0, &afc_conn_p) == 0) { if (AFCConnectionOpen(houseFd, 0, &afc_conn_p) == 0) {
read_dir(houseFd, afc_conn_p, list_root?list_root:"/", NULL); read_dir(houseFd, afc_conn_p, list_root?list_root:"/", NULL);
@ -1289,7 +1289,7 @@ int app_exists(AMDeviceRef device)
NSArray *a = [NSArray arrayWithObjects:@"CFBundleIdentifier", nil]; NSArray *a = [NSArray arrayWithObjects:@"CFBundleIdentifier", nil];
NSDictionary *optionsDict = [NSDictionary dictionaryWithObject:a forKey:@"ReturnAttributes"]; NSDictionary *optionsDict = [NSDictionary dictionaryWithObject:a forKey:@"ReturnAttributes"];
CFDictionaryRef options = (CFDictionaryRef)optionsDict; CFDictionaryRef options = (CFDictionaryRef)optionsDict;
CFDictionaryRef result = nil; CFDictionaryRef result = nil;
afc_error_t resultStatus = AMDeviceLookupApplications(device, options, &result); afc_error_t resultStatus = AMDeviceLookupApplications(device, options, &result);
assert(resultStatus == 0); assert(resultStatus == 0);
@ -1399,15 +1399,15 @@ void download_tree(AMDeviceRef device)
void upload_file(AMDeviceRef device) { void upload_file(AMDeviceRef device) {
service_conn_t houseFd = start_house_arrest_service(device); service_conn_t houseFd = start_house_arrest_service(device);
afc_file_ref file_ref; afc_file_ref file_ref;
afc_connection afc_conn; afc_connection afc_conn;
afc_connection* afc_conn_p = &afc_conn; afc_connection* afc_conn_p = &afc_conn;
AFCConnectionOpen(houseFd, 0, &afc_conn_p); AFCConnectionOpen(houseFd, 0, &afc_conn_p);
// read_dir(houseFd, NULL, "/", NULL); // read_dir(houseFd, NULL, "/", NULL);
if (!target_filename) if (!target_filename)
{ {
target_filename = get_filename_from_path(upload_pathname); target_filename = get_filename_from_path(upload_pathname);
@ -1415,7 +1415,7 @@ void upload_file(AMDeviceRef device) {
size_t file_size; size_t file_size;
void* file_content = read_file_to_memory(upload_pathname, &file_size); void* file_content = read_file_to_memory(upload_pathname, &file_size);
if (!file_content) if (!file_content)
{ {
printf("Could not open file: %s\n", upload_pathname); printf("Could not open file: %s\n", upload_pathname);
@ -1435,7 +1435,7 @@ void upload_file(AMDeviceRef device) {
*lastSlash = '\0'; *lastSlash = '\0';
assert(AFCDirectoryCreate(afc_conn_p, dirpath) == 0); assert(AFCDirectoryCreate(afc_conn_p, dirpath) == 0);
} }
int ret = AFCFileRefOpen(afc_conn_p, target_filename, 3, &file_ref); int ret = AFCFileRefOpen(afc_conn_p, target_filename, 3, &file_ref);
if (ret == 0x000a) { if (ret == 0x000a) {
@ -1450,12 +1450,12 @@ void upload_file(AMDeviceRef device) {
assert(AFCFileRefWrite(afc_conn_p, file_ref, file_content, file_size) == 0); assert(AFCFileRefWrite(afc_conn_p, file_ref, file_content, file_size) == 0);
assert(AFCFileRefClose(afc_conn_p, file_ref) == 0); assert(AFCFileRefClose(afc_conn_p, file_ref) == 0);
assert(AFCConnectionClose(afc_conn_p) == 0); assert(AFCConnectionClose(afc_conn_p) == 0);
free(file_content); free(file_content);
} }
void handle_device(AMDeviceRef device) { void handle_device(AMDeviceRef device) {
//if (found_device) //if (found_device)
// return; // handle one device only // return; // handle one device only
CFStringRef found_device_id = AMDeviceCopyDeviceIdentifier(device), CFStringRef found_device_id = AMDeviceCopyDeviceIdentifier(device),
@ -1480,7 +1480,7 @@ void handle_device(AMDeviceRef device) {
} }
printf("[....] Using %s (%s).\n", CFStringGetCStringPtr(device_full_name, CFStringGetSystemEncoding()), CFStringGetCStringPtr(found_device_id, CFStringGetSystemEncoding())); printf("[....] Using %s (%s).\n", CFStringGetCStringPtr(device_full_name, CFStringGetSystemEncoding()), CFStringGetCStringPtr(found_device_id, CFStringGetSystemEncoding()));
if (command_only) { if (command_only) {
if (strcmp("list", command) == 0) { if (strcmp("list", command) == 0) {
list_files(device); list_files(device);
@ -1514,7 +1514,7 @@ void handle_device(AMDeviceRef device) {
assert(AMDeviceIsPaired(device)); assert(AMDeviceIsPaired(device));
assert(AMDeviceValidatePairing(device) == 0); assert(AMDeviceValidatePairing(device) == 0);
assert(AMDeviceStartSession(device) == 0); assert(AMDeviceStartSession(device) == 0);
int code = AMDeviceSecureUninstallApplication(0, device, bundle_id, 0, NULL, 0); int code = AMDeviceSecureUninstallApplication(0, device, bundle_id, 0, NULL, 0);
if (code == 0) { if (code == 0) {
printf("[ OK ] Uninstalled package with bundle id %s\n", CFStringGetCStringPtr(bundle_id, CFStringGetSystemEncoding())); printf("[ OK ] Uninstalled package with bundle id %s\n", CFStringGetCStringPtr(bundle_id, CFStringGetSystemEncoding()));
@ -1551,7 +1551,7 @@ void handle_device(AMDeviceRef device) {
close(afcFd); close(afcFd);
AMDeviceConnect(device); AMDeviceConnect(device);
assert(AMDeviceIsPaired(device)); assert(AMDeviceIsPaired(device));
@ -1587,9 +1587,9 @@ void handle_device(AMDeviceRef device) {
printf("[100%%] Installed package %s\n", app_path); printf("[100%%] Installed package %s\n", app_path);
} }
if (!debug) if (!debug)
exit(0); // no debug phase exit(0); // no debug phase
if (justlaunch) if (justlaunch)
launch_debugger_and_exit(device, url); launch_debugger_and_exit(device, url);
else else
@ -1602,7 +1602,7 @@ void device_callback(struct am_device_notification_callback_info *info, void *ar
if(device_id != NULL || !debug || AMDeviceGetInterfaceType(info->dev) != 2) { if(device_id != NULL || !debug || AMDeviceGetInterfaceType(info->dev) != 2) {
handle_device(info->dev); 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);
} }
default: default:
@ -1629,7 +1629,7 @@ void timeout_callback(CFRunLoopTimerRef timer, void *info) {
if (!debug) { if (!debug) {
printf("[....] No more devices found.\n"); printf("[....] No more devices found.\n");
} }
if (detect_only && !found_device) { if (detect_only && !found_device) {
exit(exitcode_error); exit(exitcode_error);
return; return;
@ -1822,4 +1822,3 @@ int main(int argc, char *argv[]) {
AMDeviceNotificationSubscribe(&device_callback, 0, 0, NULL, &notify); AMDeviceNotificationSubscribe(&device_callback, 0, 0, NULL, &notify);
CFRunLoopRun(); CFRunLoopRun();
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "ios-deploy", "name": "ios-deploy",
"version": "1.4.0", "version": "1.5.0",
"description": "launch iOS apps iOS devices from the command line (Xcode 6)", "description": "launch iOS apps iOS devices from the command line (Xcode 6)",
"main": "ios-deploy", "main": "ios-deploy",
"scripts": { "scripts": {