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