diff options
| -rw-r--r-- | dev/syslog_relay.c | 5 | ||||
| -rw-r--r-- | include/libiphone/libiphone.h | 2 | ||||
| -rw-r--r-- | src/iphone.c | 19 | ||||
| -rw-r--r-- | src/iphone.h | 2 |
4 files changed, 15 insertions, 13 deletions
diff --git a/dev/syslog_relay.c b/dev/syslog_relay.c index 58a2544..a096101 100644 --- a/dev/syslog_relay.c +++ b/dev/syslog_relay.c | |||
| @@ -52,6 +52,7 @@ int main(int argc, char *argv[]) | |||
| 52 | char uuid[41]; | 52 | char uuid[41]; |
| 53 | int port = 0; | 53 | int port = 0; |
| 54 | uuid[0] = 0; | 54 | uuid[0] = 0; |
| 55 | uint32_t handle = 0; | ||
| 55 | 56 | ||
| 56 | signal(SIGINT, clean_exit); | 57 | signal(SIGINT, clean_exit); |
| 57 | signal(SIGQUIT, clean_exit); | 58 | signal(SIGQUIT, clean_exit); |
| @@ -111,8 +112,8 @@ int main(int argc, char *argv[]) | |||
| 111 | lockdownd_client_free(client); | 112 | lockdownd_client_free(client); |
| 112 | 113 | ||
| 113 | /* connect to socket relay messages */ | 114 | /* connect to socket relay messages */ |
| 114 | 115 | iphone_device_get_handle(phone, &handle); | |
| 115 | int sfd = usbmuxd_connect(iphone_get_device_handle(phone), port); | 116 | int sfd = usbmuxd_connect(handle, port); |
| 116 | if (sfd < 0) { | 117 | if (sfd < 0) { |
| 117 | printf("ERROR: Could not open usbmux connection.\n"); | 118 | printf("ERROR: Could not open usbmux connection.\n"); |
| 118 | } else { | 119 | } else { |
diff --git a/include/libiphone/libiphone.h b/include/libiphone/libiphone.h index 7974526..61820e0 100644 --- a/include/libiphone/libiphone.h +++ b/include/libiphone/libiphone.h | |||
| @@ -62,7 +62,7 @@ void iphone_set_debug_level(int level); | |||
| 62 | iphone_error_t iphone_get_device(iphone_device_t *device); | 62 | iphone_error_t iphone_get_device(iphone_device_t *device); |
| 63 | iphone_error_t iphone_get_device_by_uuid(iphone_device_t *device, const char *uuid); | 63 | iphone_error_t iphone_get_device_by_uuid(iphone_device_t *device, const char *uuid); |
| 64 | iphone_error_t iphone_device_free(iphone_device_t device); | 64 | iphone_error_t iphone_device_free(iphone_device_t device); |
| 65 | uint32_t iphone_get_device_handle(iphone_device_t device); | 65 | iphone_error_t iphone_device_get_handle(iphone_device_t device, uint32_t *handle); |
| 66 | iphone_error_t iphone_device_get_uuid(iphone_device_t device, char **uuid); | 66 | iphone_error_t iphone_device_get_uuid(iphone_device_t device, char **uuid); |
| 67 | 67 | ||
| 68 | #ifdef __cplusplus | 68 | #ifdef __cplusplus |
diff --git a/src/iphone.c b/src/iphone.c index bdabc35..e694373 100644 --- a/src/iphone.c +++ b/src/iphone.c | |||
| @@ -19,13 +19,12 @@ | |||
| 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 20 | */ | 20 | */ |
| 21 | 21 | ||
| 22 | #include "iphone.h" | ||
| 23 | #include "utils.h" | ||
| 24 | #include <stdio.h> | 22 | #include <stdio.h> |
| 25 | #include <stdlib.h> | 23 | #include <stdlib.h> |
| 26 | #include <string.h> | 24 | #include <string.h> |
| 27 | #include <errno.h> | 25 | |
| 28 | #include <libiphone/libiphone.h> | 26 | #include "iphone.h" |
| 27 | #include "utils.h" | ||
| 29 | 28 | ||
| 30 | /** | 29 | /** |
| 31 | * Retrieves a list of connected devices from usbmuxd and matches their | 30 | * Retrieves a list of connected devices from usbmuxd and matches their |
| @@ -95,13 +94,13 @@ iphone_error_t iphone_get_device(iphone_device_t * device) | |||
| 95 | return iphone_get_device_by_uuid(device, NULL); | 94 | return iphone_get_device_by_uuid(device, NULL); |
| 96 | } | 95 | } |
| 97 | 96 | ||
| 98 | uint32_t iphone_get_device_handle(iphone_device_t device) | 97 | iphone_error_t iphone_device_get_handle(iphone_device_t device, uint32_t *handle) |
| 99 | { | 98 | { |
| 100 | if (device) { | 99 | if (!device) |
| 101 | return device->handle; | 100 | return IPHONE_E_INVALID_ARG; |
| 102 | } else { | 101 | |
| 103 | return 0; | 102 | *handle = device->handle; |
| 104 | } | 103 | return IPHONE_E_SUCCESS; |
| 105 | } | 104 | } |
| 106 | 105 | ||
| 107 | iphone_error_t iphone_device_get_uuid(iphone_device_t device, char **uuid) | 106 | iphone_error_t iphone_device_get_uuid(iphone_device_t device, char **uuid) |
diff --git a/src/iphone.h b/src/iphone.h index 2ed0fba..6e14280 100644 --- a/src/iphone.h +++ b/src/iphone.h | |||
| @@ -24,6 +24,8 @@ | |||
| 24 | 24 | ||
| 25 | #include <stdint.h> | 25 | #include <stdint.h> |
| 26 | 26 | ||
| 27 | #include "libiphone/libiphone.h" | ||
| 28 | |||
| 27 | struct iphone_device_int { | 29 | struct iphone_device_int { |
| 28 | char *buffer; | 30 | char *buffer; |
| 29 | uint32_t handle; | 31 | uint32_t handle; |
