From c0dcadad6c18b06ddc6e349d7c58bfccb715ff55 Mon Sep 17 00:00:00 2001 From: Reza Arbab Date: Wed, 27 Mar 2019 11:45:02 -0500 Subject: [PATCH] linux: Fix udev ID_PATH parsing for udl devices The ID_PATH for a udl device looks like this: $ udevadm info /dev/dri/card2 | grep -w ID_PATH E: ID_PATH=pci-0000:00:14.0-usb-0:9.1:1.0 The parsing added in 0816e8fca6194 ("linux: Make platform device probe less fragile"), sets OdevAttributes::busid to "pci:0000:00:14.0", where drmGetBusid() would have returned "3-9.1:1.0". Identifying this as a "pci:*" device eventually causes the vendor/device id check in probeSingleDevice() to fail, because a USB controller isn't a supported device: $ udevadm info --path=/devices/pci0000:00/0000:00:14.0 | grep -e VENDOR -e ID_PCI_CLASS E: ID_PCI_CLASS_FROM_DATABASE=Serial bus controller E: ID_VENDOR_FROM_DATABASE=Intel Corporation Instead of parsing out "pci:0000:00:14.0" in this case, use "usb:0:9.1:1.0" so the device probe will succeed. Fixes: 0816e8fca6194 ("linux: Make platform device probe less fragile") Signed-off-by: Reza Arbab --- config/udev.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/config/udev.c b/config/udev.c index c51bda98a..411a459f4 100644 --- a/config/udev.c +++ b/config/udev.c @@ -517,7 +517,12 @@ config_udev_odev_setup_attribs(struct udev_device *udev_device, const char *path value = udev_device_get_property_value(udev_device, "ID_PATH"); if (value && (str = strrstr(value, "pci-"))) { - attribs->busid = XNFstrdup(str); + value = str; + + if ((str = strstr(value, "usb-"))) + value = str; + + attribs->busid = XNFstrdup(value); attribs->busid[3] = ':'; }