From 682167475c1930f80a68de58e522ac08dbb35fa8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=B6sz=C3=B6rm=C3=A9nyi=20Zolt=C3=A1n?= Date: Thu, 14 Nov 2019 09:29:20 +0100 Subject: [PATCH] Introduce and use BUS_USB MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- hw/xfree86/common/xf86Bus.c | 2 ++ hw/xfree86/common/xf86str.h | 2 ++ hw/xfree86/os-support/linux/lnx_platform.c | 5 +++++ 3 files changed, 9 insertions(+) diff --git a/hw/xfree86/common/xf86Bus.c b/hw/xfree86/common/xf86Bus.c index 0263e6907..5e34eab99 100644 --- a/hw/xfree86/common/xf86Bus.c +++ b/hw/xfree86/common/xf86Bus.c @@ -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; diff --git a/hw/xfree86/common/xf86str.h b/hw/xfree86/common/xf86str.h index f38f6cd68..8f8685ef2 100644 --- a/hw/xfree86/common/xf86str.h +++ b/hw/xfree86/common/xf86str.h @@ -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; diff --git a/hw/xfree86/os-support/linux/lnx_platform.c b/hw/xfree86/os-support/linux/lnx_platform.c index e62306219..fe2142182 100644 --- a/hw/xfree86/os-support/linux/lnx_platform.c +++ b/hw/xfree86/os-support/linux/lnx_platform.c @@ -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; }