summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/iphone_id.c16
-rw-r--r--tools/iphoneinfo.c4
-rw-r--r--tools/iphonesyslog.c17
3 files changed, 17 insertions, 20 deletions
diff --git a/tools/iphone_id.c b/tools/iphone_id.c
index 835e214..80f22e1 100644
--- a/tools/iphone_id.c
+++ b/tools/iphone_id.c
@@ -3,7 +3,6 @@
#include <stdlib.h>
#include <libiphone/libiphone.h>
#include <libiphone/lockdown.h>
-#include <usbmuxd.h>
#define MODE_NONE 0
#define MODE_SHOW_ID 1
@@ -18,7 +17,7 @@ static void print_usage(int argc, char **argv)
printf("Prints device name or a list of attached iPhone/iPod Touch devices.\n\n");
printf(" The UUID is a 40-digit hexadecimal number of the device\n");
printf(" for which the name should be retrieved.\n\n");
- printf(" -l, --list\t\tlist all attached devices\n");
+ printf(" -l, --list\t\tlist UUID of all attached devices\n");
printf(" -d, --debug\t\tenable communication debugging\n");
printf(" -h, --help\t\tprints usage information\n");
printf("\n");
@@ -28,7 +27,7 @@ int main(int argc, char **argv)
{
iphone_device_t phone = NULL;
lockdownd_client_t client = NULL;
- usbmuxd_scan_result *dev_list;
+ char **dev_list = NULL;
char *devname = NULL;
int ret = 0;
int i;
@@ -65,7 +64,7 @@ int main(int argc, char **argv)
switch (mode) {
case MODE_SHOW_ID:
- iphone_get_device_by_uuid(&phone, uuid);
+ iphone_device_new(&phone, uuid);
if (!phone) {
fprintf(stderr, "ERROR: No device with UUID=%s attached.\n", uuid);
return -2;
@@ -96,13 +95,14 @@ int main(int argc, char **argv)
return ret;
case MODE_LIST_DEVICES:
default:
- if (usbmuxd_scan(&dev_list) < 0) {
- fprintf(stderr, "ERROR: usbmuxd is not running!\n");
+ if (iphone_get_device_list(&dev_list, &i) < 0) {
+ fprintf(stderr, "ERROR: Unable to retrieve device list!\n");
return -1;
}
- for (i = 0; dev_list[i].handle > 0; i++) {
- printf("handle=%d product_id=%04x uuid=%s\n", dev_list[i].handle, dev_list[i].product_id, dev_list[i].serial_number);
+ for (i = 0; dev_list[i] != NULL; i++) {
+ printf("%s\n", dev_list[i]);
}
+ iphone_device_list_free(dev_list);
return 0;
}
}
diff --git a/tools/iphoneinfo.c b/tools/iphoneinfo.c
index 09ba3e3..4d6da31 100644
--- a/tools/iphoneinfo.c
+++ b/tools/iphoneinfo.c
@@ -121,7 +121,7 @@ int main(int argc, char *argv[])
}
if (uuid[0] != 0) {
- ret = iphone_get_device_by_uuid(&phone, uuid);
+ ret = iphone_device_new(&phone, uuid);
if (ret != IPHONE_E_SUCCESS) {
printf("No device found with uuid %s, is it plugged in?\n", uuid);
return -1;
@@ -129,7 +129,7 @@ int main(int argc, char *argv[])
}
else
{
- ret = iphone_get_device(&phone);
+ ret = iphone_device_new(&phone, NULL);
if (ret != IPHONE_E_SUCCESS) {
printf("No device found, is it plugged in?\n");
return -1;
diff --git a/tools/iphonesyslog.c b/tools/iphonesyslog.c
index a096101..8fa3b04 100644
--- a/tools/iphonesyslog.c
+++ b/tools/iphonesyslog.c
@@ -28,7 +28,6 @@
#include <libiphone/libiphone.h>
#include <libiphone/lockdown.h>
-#include <usbmuxd.h>
static int quit_flag = 0;
@@ -52,7 +51,6 @@ int main(int argc, char *argv[])
char uuid[41];
int port = 0;
uuid[0] = 0;
- uint32_t handle = 0;
signal(SIGINT, clean_exit);
signal(SIGQUIT, clean_exit);
@@ -86,7 +84,7 @@ int main(int argc, char *argv[])
}
if (uuid[0] != 0) {
- ret = iphone_get_device_by_uuid(&phone, uuid);
+ ret = iphone_device_new(&phone, uuid);
if (ret != IPHONE_E_SUCCESS) {
printf("No device found with uuid %s, is it plugged in?\n", uuid);
return -1;
@@ -94,7 +92,7 @@ int main(int argc, char *argv[])
}
else
{
- ret = iphone_get_device(&phone);
+ ret = iphone_device_new(&phone, NULL);
if (ret != IPHONE_E_SUCCESS) {
printf("No device found, is it plugged in?\n");
return -1;
@@ -112,16 +110,15 @@ int main(int argc, char *argv[])
lockdownd_client_free(client);
/* connect to socket relay messages */
- iphone_device_get_handle(phone, &handle);
- int sfd = usbmuxd_connect(handle, port);
- if (sfd < 0) {
+ iphone_connection_t conn = NULL;
+ if ((iphone_device_connect(phone, port, &conn) != IPHONE_E_SUCCESS) || !conn) {
printf("ERROR: Could not open usbmux connection.\n");
} else {
while (!quit_flag) {
char *receive = NULL;
uint32_t datalen = 0, bytes = 0, recv_bytes = 0;
- ret = usbmuxd_recv(sfd, (char *) &datalen, sizeof(datalen), &bytes);
+ ret = iphone_device_recv(conn, (char *) &datalen, sizeof(datalen), &bytes);
datalen = ntohl(datalen);
if (datalen == 0)
@@ -131,7 +128,7 @@ int main(int argc, char *argv[])
receive = (char *) malloc(sizeof(char) * datalen);
while (!quit_flag && (recv_bytes <= datalen)) {
- ret = usbmuxd_recv(sfd, receive, datalen, &bytes);
+ ret = iphone_device_recv(conn, receive, datalen, &bytes);
if (bytes == 0)
break;
@@ -144,7 +141,7 @@ int main(int argc, char *argv[])
free(receive);
}
}
- usbmuxd_disconnect(sfd);
+ iphone_device_disconnect(conn);
} else {
printf("ERROR: Could not start service com.apple.syslog_relay.\n");
}