diff options
| author | 2015-01-27 21:56:48 +0100 | |
|---|---|---|
| committer | 2015-01-27 22:01:23 +0100 | |
| commit | a6fcb3fd337bf63aba9237f54e4ecb8c737e984c (patch) | |
| tree | c69914b4b1c2fb0056ea190b30b51c5d2b66d743 /tools/idevicedebug.c | |
| parent | 294dea4eaa847527c5940e402a0c5cff35026e9e (diff) | |
| download | libimobiledevice-a6fcb3fd337bf63aba9237f54e4ecb8c737e984c.tar.gz libimobiledevice-a6fcb3fd337bf63aba9237f54e4ecb8c737e984c.tar.bz2 | |
idevicedebug: Use more efficient instproxy_lookup instead of browsing all apps
Diffstat (limited to 'tools/idevicedebug.c')
| -rw-r--r-- | tools/idevicedebug.c | 28 |
1 files changed, 8 insertions, 20 deletions
diff --git a/tools/idevicedebug.c b/tools/idevicedebug.c index c9648d0..996fa46 100644 --- a/tools/idevicedebug.c +++ b/tools/idevicedebug.c | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | * idevicedebug.c | 2 | * idevicedebug.c |
| 3 | * Interact with the debugserver service of a device. | 3 | * Interact with the debugserver service of a device. |
| 4 | * | 4 | * |
| 5 | * Copyright (c) 2014 Martin Szulecki All Rights Reserved. | 5 | * Copyright (c) 2014-2015 Martin Szulecki All Rights Reserved. |
| 6 | * | 6 | * |
| 7 | * This library is free software; you can redistribute it and/or | 7 | * This library is free software; you can redistribute it and/or |
| 8 | * modify it under the terms of the GNU Lesser General Public | 8 | * modify it under the terms of the GNU Lesser General Public |
| @@ -65,31 +65,19 @@ static instproxy_error_t instproxy_client_get_object_by_key_from_info_directiona | |||
| 65 | // only return attributes we need | 65 | // only return attributes we need |
| 66 | instproxy_client_options_set_return_attributes(client_opts, "CFBundleIdentifier", "CFBundleExecutable", key, NULL); | 66 | instproxy_client_options_set_return_attributes(client_opts, "CFBundleIdentifier", "CFBundleExecutable", key, NULL); |
| 67 | 67 | ||
| 68 | // only query for specific appid | ||
| 69 | const char* appids[] = {appid, NULL}; | ||
| 70 | |||
| 68 | // query device for list of apps | 71 | // query device for list of apps |
| 69 | instproxy_error_t ierr = instproxy_browse(client, client_opts, &apps); | 72 | instproxy_error_t ierr = instproxy_lookup(client, appids, client_opts, &apps); |
| 73 | |||
| 70 | instproxy_client_options_free(client_opts); | 74 | instproxy_client_options_free(client_opts); |
| 75 | |||
| 71 | if (ierr != INSTPROXY_E_SUCCESS) { | 76 | if (ierr != INSTPROXY_E_SUCCESS) { |
| 72 | return ierr; | 77 | return ierr; |
| 73 | } | 78 | } |
| 74 | 79 | ||
| 75 | plist_t app_found = NULL; | 80 | plist_t app_found = plist_access_path(apps, 1, appid); |
| 76 | uint32_t i; | ||
| 77 | for (i = 0; i < plist_array_get_size(apps); i++) { | ||
| 78 | char *appid_str = NULL; | ||
| 79 | plist_t app_info = plist_array_get_item(apps, i); | ||
| 80 | plist_t idp = plist_dict_get_item(app_info, "CFBundleIdentifier"); | ||
| 81 | if (idp) { | ||
| 82 | plist_get_string_val(idp, &appid_str); | ||
| 83 | } | ||
| 84 | if (appid_str && strcmp(appid, appid_str) == 0) { | ||
| 85 | app_found = app_info; | ||
| 86 | } | ||
| 87 | free(appid_str); | ||
| 88 | if (app_found) { | ||
| 89 | break; | ||
| 90 | } | ||
| 91 | } | ||
| 92 | |||
| 93 | if (!app_found) { | 81 | if (!app_found) { |
| 94 | if (apps) | 82 | if (apps) |
| 95 | plist_free(apps); | 83 | plist_free(apps); |
