diff options
| -rw-r--r-- | dev/msyncclient.c | 2 | ||||
| -rw-r--r-- | include/libiphone/libiphone.h | 11 | ||||
| -rw-r--r-- | src/MobileSync.c | 8 | ||||
| -rw-r--r-- | src/usbmux.c | 1 | ||||
| -rw-r--r-- | src/utils.h | 6 |
5 files changed, 16 insertions, 12 deletions
diff --git a/dev/msyncclient.c b/dev/msyncclient.c index a6764b4..2762f04 100644 --- a/dev/msyncclient.c +++ b/dev/msyncclient.c | |||
| @@ -28,8 +28,6 @@ | |||
| 28 | #include <libxml/tree.h> | 28 | #include <libxml/tree.h> |
| 29 | 29 | ||
| 30 | #include <libiphone/libiphone.h> | 30 | #include <libiphone/libiphone.h> |
| 31 | #include "../src/MobileSync.h" | ||
| 32 | #include "../src/utils.h" | ||
| 33 | 31 | ||
| 34 | 32 | ||
| 35 | int main(int argc, char *argv[]) | 33 | int main(int argc, char *argv[]) |
diff --git a/include/libiphone/libiphone.h b/include/libiphone/libiphone.h index 59d2de2..6197923 100644 --- a/include/libiphone/libiphone.h +++ b/include/libiphone/libiphone.h | |||
| @@ -81,8 +81,17 @@ typedef struct iphone_afc_file_int *iphone_afc_file_t; | |||
| 81 | struct iphone_msync_client_int; | 81 | struct iphone_msync_client_int; |
| 82 | typedef struct iphone_msync_client_int *iphone_msync_client_t; | 82 | typedef struct iphone_msync_client_int *iphone_msync_client_t; |
| 83 | 83 | ||
| 84 | //device related functions | 84 | //debug related functions |
| 85 | #define DBGMASK_ALL 0xFFFF | ||
| 86 | #define DBGMASK_NONE 0x0000 | ||
| 87 | #define DBGMASK_USBMUX (1 << 1) | ||
| 88 | #define DBGMASK_LOCKDOWND (1 << 2) | ||
| 89 | #define DBGMASK_MOBILESYNC (1 << 3) | ||
| 90 | |||
| 91 | void iphone_set_debug_mask(uint16_t mask); | ||
| 85 | void iphone_set_debug(int level); | 92 | void iphone_set_debug(int level); |
| 93 | |||
| 94 | //device related functions | ||
| 86 | iphone_error_t iphone_get_device ( iphone_device_t *device ); | 95 | iphone_error_t iphone_get_device ( iphone_device_t *device ); |
| 87 | iphone_error_t iphone_free_device ( iphone_device_t device ); | 96 | iphone_error_t iphone_free_device ( iphone_device_t device ); |
| 88 | 97 | ||
diff --git a/src/MobileSync.c b/src/MobileSync.c index a2a361e..752aee9 100644 --- a/src/MobileSync.c +++ b/src/MobileSync.c | |||
| @@ -51,7 +51,7 @@ iphone_error_t iphone_msync_new_client(iphone_device_t device, int src_port, int | |||
| 51 | ret = iphone_msync_recv(client_loc, &array); | 51 | ret = iphone_msync_recv(client_loc, &array); |
| 52 | 52 | ||
| 53 | plist_t msg_node = | 53 | plist_t msg_node = |
| 54 | plist_find_node(array, PLIST_STRING, "DLMessageVersionExchange", strlen("DLMessageVersionExchange")); | 54 | plist_find_node_by_string(array, "DLMessageVersionExchange"); |
| 55 | plist_t ver_1 = plist_get_next_sibling(msg_node); | 55 | plist_t ver_1 = plist_get_next_sibling(msg_node); |
| 56 | plist_t ver_2 = plist_get_next_sibling(ver_1); | 56 | plist_t ver_2 = plist_get_next_sibling(ver_1); |
| 57 | 57 | ||
| @@ -83,7 +83,7 @@ iphone_error_t iphone_msync_new_client(iphone_device_t device, int src_port, int | |||
| 83 | 83 | ||
| 84 | ret = iphone_msync_recv(client_loc, &array); | 84 | ret = iphone_msync_recv(client_loc, &array); |
| 85 | plist_t rep_node = | 85 | plist_t rep_node = |
| 86 | plist_find_node(array, PLIST_STRING, "DLMessageDeviceReady", strlen("DLMessageDeviceReady")); | 86 | plist_find_node_by_string(array, "DLMessageDeviceReady"); |
| 87 | 87 | ||
| 88 | if (rep_node) { | 88 | if (rep_node) { |
| 89 | ret = IPHONE_E_SUCCESS; | 89 | ret = IPHONE_E_SUCCESS; |
| @@ -117,8 +117,10 @@ static void iphone_msync_stop_session(iphone_msync_client_t client) | |||
| 117 | 117 | ||
| 118 | iphone_error_t iphone_msync_free_client(iphone_msync_client_t client) | 118 | iphone_error_t iphone_msync_free_client(iphone_msync_client_t client) |
| 119 | { | 119 | { |
| 120 | iphone_msync_stop_session(client); | 120 | if (!client) |
| 121 | return IPHONE_E_INVALID_ARG; | ||
| 121 | 122 | ||
| 123 | iphone_msync_stop_session(client); | ||
| 122 | return iphone_mux_free_client(client->connection); | 124 | return iphone_mux_free_client(client->connection); |
| 123 | } | 125 | } |
| 124 | 126 | ||
diff --git a/src/usbmux.c b/src/usbmux.c index eb7ec97..5eaa1d1 100644 --- a/src/usbmux.c +++ b/src/usbmux.c | |||
| @@ -313,6 +313,7 @@ iphone_error_t iphone_mux_recv(iphone_umux_client_t client, char *data, uint32_t | |||
| 313 | } else { | 313 | } else { |
| 314 | memcpy(data, client->recv_buffer, client->r_len); | 314 | memcpy(data, client->recv_buffer, client->r_len); |
| 315 | free(client->recv_buffer); // don't need to deal with anymore, but... | 315 | free(client->recv_buffer); // don't need to deal with anymore, but... |
| 316 | client->recv_buffer = NULL; | ||
| 316 | offset = client->r_len; // see #2b, above | 317 | offset = client->r_len; // see #2b, above |
| 317 | client->r_len = 0; | 318 | client->r_len = 0; |
| 318 | } | 319 | } |
diff --git a/src/utils.h b/src/utils.h index d9a441d..1750b8e 100644 --- a/src/utils.h +++ b/src/utils.h | |||
| @@ -24,13 +24,7 @@ | |||
| 24 | 24 | ||
| 25 | #include "libiphone/libiphone.h" | 25 | #include "libiphone/libiphone.h" |
| 26 | 26 | ||
| 27 | #define DBGMASK_ALL 0xFFFF | ||
| 28 | #define DBGMASK_NONE 0x0000 | ||
| 29 | #define DBGMASK_USBMUX (1 << 1) | ||
| 30 | #define DBGMASK_LOCKDOWND (1 << 2) | ||
| 31 | #define DBGMASK_MOBILESYNC (1 << 3) | ||
| 32 | 27 | ||
| 33 | void iphone_set_debug_mask(uint16_t mask); | ||
| 34 | 28 | ||
| 35 | inline void log_debug_msg(const char *format, ...); | 29 | inline void log_debug_msg(const char *format, ...); |
| 36 | inline void log_dbg_msg(uint16_t id, const char *format, ...); | 30 | inline void log_dbg_msg(uint16_t id, const char *format, ...); |
