summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/usbmuxd.h3
-rw-r--r--src/libusbmuxd.c12
2 files changed, 14 insertions, 1 deletions
diff --git a/include/usbmuxd.h b/include/usbmuxd.h
index d413eab..f345be2 100644
--- a/include/usbmuxd.h
+++ b/include/usbmuxd.h
@@ -45,7 +45,8 @@ typedef struct {
*/
enum usbmuxd_event_type {
UE_DEVICE_ADD = 1,
- UE_DEVICE_REMOVE
+ UE_DEVICE_REMOVE,
+ UE_DEVICE_PAIRED
};
/**
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);
}