diff options
author | BALATON Zoltan | 2015-05-13 22:43:03 +0200 |
---|---|---|
committer | BALATON Zoltan | 2016-07-13 21:40:53 +0200 |
commit | fe6e9de976cbc7cd204cafa44a4e1a5c5f1a9e0f (patch) | |
tree | 5dde6d7cd399ea0c790a4093b642db6decb98155 /src | |
parent | 4397b3376dc4e4cb1c991d0aed61ce6482614196 (diff) | |
download | libusbmuxd-fe6e9de976cbc7cd204cafa44a4e1a5c5f1a9e0f.tar.gz libusbmuxd-fe6e9de976cbc7cd204cafa44a4e1a5c5f1a9e0f.tar.bz2 |
Catch Paired message even if it is ignored now to prevent returning an
error to the user on receiving this message.
Diffstat (limited to 'src')
-rw-r--r-- | src/libusbmuxd.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/libusbmuxd.c b/src/libusbmuxd.c index af8636b..a8586f2 100644 --- a/src/libusbmuxd.c +++ b/src/libusbmuxd.c @@ -41,8 +41,8 @@ #endif #ifdef WIN32 -#include <windows.h> #include <winsock2.h> +#include <windows.h> #define sleep(x) Sleep(x*1000) #ifndef EPROTO #define EPROTO 134 @@ -268,8 +268,24 @@ static int receive_packet(int sfd, struct usbmuxd_header *header, void **payload hdr.length = sizeof(hdr) + sizeof(dwval); hdr.message = MESSAGE_DEVICE_REMOVE; } + } else if (strcmp(message, "Paired") == 0) { + /* device pair message */ + uint32_t dwval = 0; + plist_t n = plist_dict_get_item(plist, "DeviceID"); + if (n) { + plist_get_uint_val(n, &val); + *payload = malloc(sizeof(uint32_t)); + dwval = val; + memcpy(*payload, &dwval, sizeof(dwval)); + hdr.length = sizeof(hdr) + sizeof(dwval); + hdr.message = MESSAGE_DEVICE_PAIRED; + } } else { - DEBUG(1, "%s: Unexpected message '%s' in plist!\n", __func__, message); + char *xml = NULL; + uint32_t len = 0; + plist_to_xml(plist, &xml, &len); + DEBUG(1, "%s: Unexpected message '%s' in plist:\n%s\n", __func__, message, xml); + free(xml); free(message); plist_free(plist); return -EBADMSG; |