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 0816e8fca6 ("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: 0816e8fca6 ("linux: Make platform device probe less fragile")
Signed-off-by: Reza Arbab <arbab@linux.ibm.com>
This commit is contained in:
Reza Arbab 2019-03-27 11:45:02 -05:00 committed by Peter Hutterer
parent af4622d3f9
commit c0dcadad6c
1 changed files with 6 additions and 1 deletions

View File

@ -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] = ':';
}