summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2012-04-06 01:01:09 +0200
committerGravatar Nikias Bassen2012-04-06 01:01:09 +0200
commit4113b710122aeb213a872c467a9616e303188e04 (patch)
tree9a3c52ed166259117d7e475bc75ef67737a11967
parentcd07d72075739d6b59238d16fde6d02a1b97dbb9 (diff)
downloadusbmuxd-4113b710122aeb213a872c467a9616e303188e04.tar.gz
usbmuxd-4113b710122aeb213a872c467a9616e303188e04.tar.bz2
libusbmuxd: make ffff* restore mode udid unique
Devices in restore mode may have an all-f UDID if a previous restore procedure wasn't completed successfully. To be able to differentiate multiple of these devices we add the usbmuxd device handle to make the UDID unique.
-rw-r--r--libusbmuxd/libusbmuxd.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/libusbmuxd/libusbmuxd.c b/libusbmuxd/libusbmuxd.c
index 02aa750..4c94dc2 100644
--- a/libusbmuxd/libusbmuxd.c
+++ b/libusbmuxd/libusbmuxd.c
@@ -551,6 +551,10 @@ int get_next_event(int sfd, usbmuxd_event_cb_t callback, void *user_data)
memset(devinfo->uuid, '\0', sizeof(devinfo->uuid));
memcpy(devinfo->uuid, dev->serial_number, sizeof(devinfo->uuid));
+ if (strcasecmp(devinfo->uuid, "ffffffffffffffffffffffffffffffffffffffff") == 0) {
+ sprintf(devinfo->uuid + 32, "%08x", devinfo->handle);
+ }
+
collection_add(&devices, devinfo);
generate_event(callback, devinfo, UE_DEVICE_ADD, user_data);
} else if (hdr.message == MESSAGE_DEVICE_REMOVE) {
@@ -720,6 +724,10 @@ retry:
memset(devinfo->uuid, '\0', sizeof(devinfo->uuid));
memcpy(devinfo->uuid, dev->serial_number, sizeof(devinfo->uuid));
+ if (strcasecmp(devinfo->uuid, "ffffffffffffffffffffffffffffffffffffffff") == 0) {
+ sprintf(devinfo->uuid + 32, "%08x", devinfo->handle);
+ }
+
collection_add(&tmpdevs, devinfo);
} else if (hdr.message == MESSAGE_DEVICE_REMOVE) {