summaryrefslogtreecommitdiffstats
path: root/dev/lckdclient.c
diff options
context:
space:
mode:
authorGravatar Matt Colyer2009-07-26 19:34:22 -0700
committerGravatar Matt Colyer2009-07-26 19:34:22 -0700
commiteea538c94f01f8054f69f059614f19400187a472 (patch)
tree209a12dc8c8eaece15b8153d15e689c8c2147ab6 /dev/lckdclient.c
parent8ebfd7d8eea89bb27e4e6dbb1f37fd90d98b439c (diff)
parent19c9750d670435ce430f0fc85a55faf127bdfbf9 (diff)
downloadlibimobiledevice-eea538c94f01f8054f69f059614f19400187a472.tar.gz
libimobiledevice-eea538c94f01f8054f69f059614f19400187a472.tar.bz2
Merge commit 'martin-s/martin'
[#46 state:resolved]
Diffstat (limited to 'dev/lckdclient.c')
-rw-r--r--dev/lckdclient.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/dev/lckdclient.c b/dev/lckdclient.c
index e7ad962..b880253 100644
--- a/dev/lckdclient.c
+++ b/dev/lckdclient.c
@@ -34,22 +34,23 @@ int main(int argc, char *argv[])
lockdownd_client_t client = NULL;
iphone_device_t phone = NULL;
- iphone_set_debug(1);
+ iphone_set_debug_level(1);
if (IPHONE_E_SUCCESS != iphone_get_device(&phone)) {
printf("No iPhone found, is it plugged in?\n");
return -1;
}
- if (IPHONE_E_SUCCESS != lockdownd_new_client(phone, &client)) {
- iphone_free_device(phone);
- return -1;
+ char *uuid = NULL;
+ if (IPHONE_E_SUCCESS == iphone_device_get_uuid(phone, &uuid)) {
+ printf("DeviceUniqueID : %s\n", uuid);
}
+ if (uuid)
+ free(uuid);
- char *uid = NULL;
- if (IPHONE_E_SUCCESS == lockdownd_get_device_uid(client, &uid)) {
- printf("DeviceUniqueID : %s\n", uid);
- free(uid);
+ if (LOCKDOWN_E_SUCCESS != lockdownd_client_new(phone, &client)) {
+ iphone_device_free(phone);
+ return -1;
}
using_history();
@@ -75,7 +76,7 @@ int main(int argc, char *argv[])
if (!strcmp(*args, "get") && len >= 2) {
plist_t value = NULL;
- if (IPHONE_E_SUCCESS == lockdownd_get_value(client, len == 3 ? *(args + 1):NULL, len == 3 ? *(args + 2):*(args + 1), &value))
+ if (LOCKDOWN_E_SUCCESS == lockdownd_get_value(client, len == 3 ? *(args + 1):NULL, len == 3 ? *(args + 2):*(args + 1), &value))
{
char *xml = NULL;
uint32_t length;
@@ -92,8 +93,13 @@ int main(int argc, char *argv[])
if (!strcmp(*args, "start") && len == 2) {
int port = 0;
- lockdownd_start_service(client, *(args + 1), &port);
- printf("%i\n", port);
+ if(LOCKDOWN_E_SUCCESS == lockdownd_start_service(client, *(args + 1), &port)) {
+ printf("started service %s on port %i\n", *(args + 1), port);
+ }
+ else
+ {
+ printf("failed to start service %s on device.\n", *(args + 1));
+ }
}
}
g_strfreev(args);
@@ -102,8 +108,8 @@ int main(int argc, char *argv[])
cmd = NULL;
}
clear_history();
- lockdownd_free_client(client);
- iphone_free_device(phone);
+ lockdownd_client_free(client);
+ iphone_device_free(phone);
return 0;
}