diff options
author | Nikias Bassen | 2016-07-14 03:09:44 +0200 |
---|---|---|
committer | Nikias Bassen | 2016-07-14 03:09:44 +0200 |
commit | 75c6f68dde6ddaa7b7e0579d5f62eaf0d661511b (patch) | |
tree | 6bb1b3e1e48b8a075485ba810fb79dbc8e04b002 /src | |
parent | 7f36c93678f001abb2fc69e2cce048468af620d1 (diff) | |
download | libusbmuxd-75c6f68dde6ddaa7b7e0579d5f62eaf0d661511b.tar.gz libusbmuxd-75c6f68dde6ddaa7b7e0579d5f62eaf0d661511b.tar.bz2 |
Handle 'Paired' message and pass event to client through callback
Diffstat (limited to 'src')
-rw-r--r-- | src/libusbmuxd.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/libusbmuxd.c b/src/libusbmuxd.c index 90ae6e6..327746b 100644 --- a/src/libusbmuxd.c +++ b/src/libusbmuxd.c @@ -711,6 +711,18 @@ static int get_next_event(int sfd, usbmuxd_event_cb_t callback, void *user_data) collection_remove(&devices, devinfo); free(devinfo); } + } else if (hdr.message == MESSAGE_DEVICE_PAIRED) { + uint32_t handle; + usbmuxd_device_info_t *devinfo; + + memcpy(&handle, payload, sizeof(uint32_t)); + + devinfo = devices_find(handle); + if (!devinfo) { + DEBUG(1, "%s: WARNING: got paired message for device handle %d, but couldn't find the corresponding handle in the device list. This event will be ignored.\n", __func__, handle); + } else { + generate_event(callback, devinfo, UE_DEVICE_PAIRED, user_data); + } } else if (hdr.length > 0) { DEBUG(1, "%s: Unexpected message type %d length %d received!\n", __func__, hdr.message, hdr.length); } |