Introduce and use BUS_USB

With !155, the device bus ID received via udev is constructed
properly with the "usb:" prefix. But, it is not enough to
make the following line to work in Section "Device":

    BusID  "usb:0:1.2:1.0"

Introduce BUS_USB, so the prefix can be distinguished from BUS_PCI
and check the supplied BusID value against device->attribs->busid
in xf86PlatformDeviceCheckBusID().

Signed-off-by: Böszörményi Zoltán <zboszor@pr.hu>
This commit is contained in:
Böszörményi Zoltán 2019-11-14 09:29:20 +01:00 committed by Peter Hutterer
parent c0dcadad6c
commit 682167475c
3 changed files with 9 additions and 0 deletions

View File

@ -268,6 +268,8 @@ StringToBusType(const char *busID, const char **retID)
ret = BUS_SBUS;
if (!xf86NameCmp(p, "platform"))
ret = BUS_PLATFORM;
if (!xf86NameCmp(p, "usb"))
ret = BUS_USB;
if (ret != BUS_NONE)
if (retID)
*retID = busID + strlen(p) + 1;

View File

@ -254,6 +254,7 @@ typedef struct _DriverRec {
#undef BUS_PCI
#undef BUS_SBUS
#undef BUS_PLATFORM
#undef BUS_USB
#undef BUS_last
#endif
@ -262,6 +263,7 @@ typedef enum {
BUS_PCI,
BUS_SBUS,
BUS_PLATFORM,
BUS_USB,
BUS_last /* Keep last */
} BusType;

View File

@ -103,6 +103,11 @@ xf86PlatformDeviceCheckBusID(struct xf86_platform_device *device, const char *bu
return FALSE;
return TRUE;
}
else if (bustype == BUS_USB) {
if (strcasecmp(busid, device->attribs->busid))
return FALSE;
return TRUE;
}
return FALSE;
}