[PATCH v3 1/4] winebus.sys: Report WINEBUS\WINE_COMP_HID compatible id.
Rémi Bernon
rbernon at codeweavers.com
Mon Aug 30 04:06:14 CDT 2021
And match it in winehid.sys instead of individual bus ids.
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
v3: * Use memcpy whenever possible, fix the missing NULL terminators.
* Renamed everything. I kept the "gamepad" naming, as I think it'll
be eventually quite accurate. Later patches will use "xinput" for
the device to be used by xinput.
* Create new devices on a WINEXINPUT\ bus, instead of re-using the
underlying bus. This helps with the transitions from old devices
to new ones, as setupapi keeps a cache of compatible ids.
The internal device would use an "&XI_" suffix for hidclass.sys to
distinguish it from the "&IG_" one.
Otherwise we would have to change the patch ordering so that the
cache don't mess up the driver matching (the old &IG_00 device
would retain its COMP_XINPUT id, which would make winexinput
device match with itself recursively).
I'm just sending the first patches for now, but I also rewritten the
next ones to store what was "device_state" directly on the func_device,
initializing it on the fdo creation instead of the gamepad, as well as
to use a completion instead of a synchronous call to the lower driver.
dlls/winebus.sys/main.c | 22 ++++++++++++++++++++--
dlls/winehid.sys/winehid.inf | 7 +------
2 files changed, 21 insertions(+), 8 deletions(-)
diff --git a/dlls/winebus.sys/main.c b/dlls/winebus.sys/main.c
index e9c85deb846..49385576d62 100644
--- a/dlls/winebus.sys/main.c
+++ b/dlls/winebus.sys/main.c
@@ -226,7 +226,7 @@ static WCHAR *get_device_id(DEVICE_OBJECT *device)
return dst;
}
-static WCHAR *get_compatible_ids(DEVICE_OBJECT *device)
+static WCHAR *get_hardware_ids(DEVICE_OBJECT *device)
{
struct device_extension *ext = (struct device_extension *)device->DeviceExtension;
WCHAR *dst;
@@ -240,6 +240,24 @@ static WCHAR *get_compatible_ids(DEVICE_OBJECT *device)
return dst;
}
+static WCHAR *get_compatible_ids(DEVICE_OBJECT *device)
+{
+ static const WCHAR hid_compat[] =
+ {
+ 'W','I','N','E','B','U','S','\\','W','I','N','E','_','C','O','M','P','_','H','I','D',0
+ };
+ DWORD size = sizeof(hid_compat);
+ WCHAR *dst;
+
+ if ((dst = ExAllocatePool(PagedPool, size + sizeof(WCHAR))))
+ {
+ memcpy(dst, hid_compat, sizeof(hid_compat));
+ dst[size / sizeof(WCHAR)] = 0;
+ }
+
+ return dst;
+}
+
static void remove_pending_irps(DEVICE_OBJECT *device)
{
struct device_extension *ext = device->DeviceExtension;
@@ -444,7 +462,7 @@ static NTSTATUS handle_IRP_MN_QUERY_ID(DEVICE_OBJECT *device, IRP *irp)
{
case BusQueryHardwareIDs:
TRACE("BusQueryHardwareIDs\n");
- irp->IoStatus.Information = (ULONG_PTR)get_compatible_ids(device);
+ irp->IoStatus.Information = (ULONG_PTR)get_hardware_ids(device);
break;
case BusQueryCompatibleIDs:
TRACE("BusQueryCompatibleIDs\n");
diff --git a/dlls/winehid.sys/winehid.inf b/dlls/winehid.sys/winehid.inf
index f9ed4091217..c1d8a1cf999 100644
--- a/dlls/winehid.sys/winehid.inf
+++ b/dlls/winehid.sys/winehid.inf
@@ -7,12 +7,7 @@ Class=HIDClass
Wine=mfg_section
[mfg_section]
-Wine hidraw device=device_section,HIDRAW
-Wine IOHID device=device_section,IOHID
-Wine libevent device=device_section,LNXEV
-Wine SDL HID device=device_section,SDLJOY
-Wine mouse device=device_section,WINEMOUSE
-Wine keyboard device=device_section,WINEKEYBOARD
+Wine HID compatible device=device_section,WINEBUS\WINE_COMP_HID
[device_section.Services]
AddService = winehid,0x2,svc_section
--
2.33.0
More information about the wine-devel
mailing list