summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2018-10-05 05:22:29 +0200
committerGravatar Nikias Bassen2018-10-05 05:22:29 +0200
commitf838cf6dc212c779562984e8a16a4cedfc1d6daf (patch)
tree6eb2fb7d2658dc7694009e3bd4b16781d9ee291f
parent49576fdf06e3a7e3ef7824f29136556005f2239d (diff)
downloadusbmuxd-f838cf6dc212c779562984e8a16a4cedfc1d6daf.tar.gz
usbmuxd-f838cf6dc212c779562984e8a16a4cedfc1d6daf.tar.bz2
usb: Add hyphen to new style UDIDs introduced with iPhone XS/XR
-rw-r--r--src/usb.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/usb.c b/src/usb.c
index 0977c24..44c33ce 100644
--- a/src/usb.c
+++ b/src/usb.c
@@ -277,12 +277,19 @@ static void get_serial_callback(struct libusb_transfer *transfer)
else
usbdev->serial[di++] = data[si];
}
- usbdev->serial[di] = 0;
+ usbdev->serial[di] = '\0';
usbmuxd_log(LL_INFO, "Got serial '%s' for device %d-%d", usbdev->serial, usbdev->bus, usbdev->address);
libusb_free_transfer(transfer);
+ /* new style UDID: add hyphen between first 8 and following 16 digits */
+ if (di == 24) {
+ memmove(&usbdev->serial[9], &usbdev->serial[8], 16);
+ usbdev->serial[8] = '-';
+ usbdev->serial[di+1] = '\0';
+ }
+
/* Finish setup now */
if(device_add(usbdev) < 0) {
usb_disconnect(usbdev);