diff options
Diffstat (limited to 'tools/iphonesyslog.c')
| -rw-r--r-- | tools/iphonesyslog.c | 17 |
1 files changed, 7 insertions, 10 deletions
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 @@ | |||
| 28 | 28 | ||
| 29 | #include <libiphone/libiphone.h> | 29 | #include <libiphone/libiphone.h> |
| 30 | #include <libiphone/lockdown.h> | 30 | #include <libiphone/lockdown.h> |
| 31 | #include <usbmuxd.h> | ||
| 32 | 31 | ||
| 33 | static int quit_flag = 0; | 32 | static int quit_flag = 0; |
| 34 | 33 | ||
| @@ -52,7 +51,6 @@ int main(int argc, char *argv[]) | |||
| 52 | char uuid[41]; | 51 | char uuid[41]; |
| 53 | int port = 0; | 52 | int port = 0; |
| 54 | uuid[0] = 0; | 53 | uuid[0] = 0; |
| 55 | uint32_t handle = 0; | ||
| 56 | 54 | ||
| 57 | signal(SIGINT, clean_exit); | 55 | signal(SIGINT, clean_exit); |
| 58 | signal(SIGQUIT, clean_exit); | 56 | signal(SIGQUIT, clean_exit); |
| @@ -86,7 +84,7 @@ int main(int argc, char *argv[]) | |||
| 86 | } | 84 | } |
| 87 | 85 | ||
| 88 | if (uuid[0] != 0) { | 86 | if (uuid[0] != 0) { |
| 89 | ret = iphone_get_device_by_uuid(&phone, uuid); | 87 | ret = iphone_device_new(&phone, uuid); |
| 90 | if (ret != IPHONE_E_SUCCESS) { | 88 | if (ret != IPHONE_E_SUCCESS) { |
| 91 | printf("No device found with uuid %s, is it plugged in?\n", uuid); | 89 | printf("No device found with uuid %s, is it plugged in?\n", uuid); |
| 92 | return -1; | 90 | return -1; |
| @@ -94,7 +92,7 @@ int main(int argc, char *argv[]) | |||
| 94 | } | 92 | } |
| 95 | else | 93 | else |
| 96 | { | 94 | { |
| 97 | ret = iphone_get_device(&phone); | 95 | ret = iphone_device_new(&phone, NULL); |
| 98 | if (ret != IPHONE_E_SUCCESS) { | 96 | if (ret != IPHONE_E_SUCCESS) { |
| 99 | printf("No device found, is it plugged in?\n"); | 97 | printf("No device found, is it plugged in?\n"); |
| 100 | return -1; | 98 | return -1; |
| @@ -112,16 +110,15 @@ int main(int argc, char *argv[]) | |||
| 112 | lockdownd_client_free(client); | 110 | lockdownd_client_free(client); |
| 113 | 111 | ||
| 114 | /* connect to socket relay messages */ | 112 | /* connect to socket relay messages */ |
| 115 | iphone_device_get_handle(phone, &handle); | 113 | iphone_connection_t conn = NULL; |
| 116 | int sfd = usbmuxd_connect(handle, port); | 114 | if ((iphone_device_connect(phone, port, &conn) != IPHONE_E_SUCCESS) || !conn) { |
| 117 | if (sfd < 0) { | ||
| 118 | printf("ERROR: Could not open usbmux connection.\n"); | 115 | printf("ERROR: Could not open usbmux connection.\n"); |
| 119 | } else { | 116 | } else { |
| 120 | while (!quit_flag) { | 117 | while (!quit_flag) { |
| 121 | char *receive = NULL; | 118 | char *receive = NULL; |
| 122 | uint32_t datalen = 0, bytes = 0, recv_bytes = 0; | 119 | uint32_t datalen = 0, bytes = 0, recv_bytes = 0; |
| 123 | 120 | ||
| 124 | ret = usbmuxd_recv(sfd, (char *) &datalen, sizeof(datalen), &bytes); | 121 | ret = iphone_device_recv(conn, (char *) &datalen, sizeof(datalen), &bytes); |
| 125 | datalen = ntohl(datalen); | 122 | datalen = ntohl(datalen); |
| 126 | 123 | ||
| 127 | if (datalen == 0) | 124 | if (datalen == 0) |
| @@ -131,7 +128,7 @@ int main(int argc, char *argv[]) | |||
| 131 | receive = (char *) malloc(sizeof(char) * datalen); | 128 | receive = (char *) malloc(sizeof(char) * datalen); |
| 132 | 129 | ||
| 133 | while (!quit_flag && (recv_bytes <= datalen)) { | 130 | while (!quit_flag && (recv_bytes <= datalen)) { |
| 134 | ret = usbmuxd_recv(sfd, receive, datalen, &bytes); | 131 | ret = iphone_device_recv(conn, receive, datalen, &bytes); |
| 135 | 132 | ||
| 136 | if (bytes == 0) | 133 | if (bytes == 0) |
| 137 | break; | 134 | break; |
| @@ -144,7 +141,7 @@ int main(int argc, char *argv[]) | |||
| 144 | free(receive); | 141 | free(receive); |
| 145 | } | 142 | } |
| 146 | } | 143 | } |
| 147 | usbmuxd_disconnect(sfd); | 144 | iphone_device_disconnect(conn); |
| 148 | } else { | 145 | } else { |
| 149 | printf("ERROR: Could not start service com.apple.syslog_relay.\n"); | 146 | printf("ERROR: Could not start service com.apple.syslog_relay.\n"); |
| 150 | } | 147 | } |
