From ac30cf5d62ee75ad7186fe402ebcbb40640e4a81 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Fri, 23 Apr 2021 20:33:04 -0500 Subject: [PATCH] user32-rawinput-hid: Fix rebase. --- ...-mouse-rawinput-device-before-HID-de.patch | 75 +++++++++++++++---- 1 file changed, 61 insertions(+), 14 deletions(-) diff --git a/patches/user32-rawinput-hid/0018-user32-Enumerate-mouse-rawinput-device-before-HID-de.patch b/patches/user32-rawinput-hid/0018-user32-Enumerate-mouse-rawinput-device-before-HID-de.patch index 8ffd6d20..e9503396 100644 --- a/patches/user32-rawinput-hid/0018-user32-Enumerate-mouse-rawinput-device-before-HID-de.patch +++ b/patches/user32-rawinput-hid/0018-user32-Enumerate-mouse-rawinput-device-before-HID-de.patch @@ -1,39 +1,86 @@ -From 18328523b2e186f1f6f6d1ecb199ddc8db61b33e Mon Sep 17 00:00:00 2001 +From 40f1c71a5b47e21741a5b8f33e98eea0c5e2d9f6 Mon Sep 17 00:00:00 2001 From: Arkadiusz Hiler Date: Mon, 22 Feb 2021 15:41:46 +0200 Subject: [PATCH] user32: Enumerate mouse rawinput device before HID devices. --- - dlls/user32/rawinput.c | 16 ++++++++++++++++ - 1 file changed, 16 insertions(+) + dlls/user32/rawinput.c | 56 ++++++++++++++++++++++-------------------- + 1 file changed, 29 insertions(+), 27 deletions(-) diff --git a/dlls/user32/rawinput.c b/dlls/user32/rawinput.c -index 9ca00504e5c..566a5844ad5 100644 +index 9ca00504e5c..b05761cb326 100644 --- a/dlls/user32/rawinput.c +++ b/dlls/user32/rawinput.c -@@ -169,6 +169,22 @@ static void find_devices(void) +@@ -169,33 +169,7 @@ static void find_devices(void) } rawinput_devices_count = 0; -+ set = SetupDiGetClassDevsW(&GUID_DEVINTERFACE_MOUSE, NULL, NULL, DIGCF_DEVICEINTERFACE | DIGCF_PRESENT); +- set = SetupDiGetClassDevsW(&hid_guid, NULL, NULL, DIGCF_DEVICEINTERFACE | DIGCF_PRESENT); +- +- for (idx = 0; SetupDiEnumDeviceInterfaces(set, NULL, &hid_guid, idx, &iface); ++idx) +- { +- if (!(device = add_device(set, &iface))) +- continue; +- +- attr.Size = sizeof(HIDD_ATTRIBUTES); +- if (!HidD_GetAttributes(device->file, &attr)) +- WARN("Failed to get attributes.\n"); +- +- device->info.dwType = RIM_TYPEHID; +- device->info.u.hid.dwVendorId = attr.VendorID; +- device->info.u.hid.dwProductId = attr.ProductID; +- device->info.u.hid.dwVersionNumber = attr.VersionNumber; +- +- if (!HidD_GetPreparsedData(device->file, &device->data)) +- WARN("Failed to get preparsed data.\n"); +- +- if (!HidP_GetCaps(device->data, &caps)) +- WARN("Failed to get caps.\n"); +- +- device->info.u.hid.usUsagePage = caps.UsagePage; +- device->info.u.hid.usUsage = caps.Usage; +- } +- +- SetupDiDestroyDeviceInfoList(set); ++ /* add mice and keyboards first so we won't add the duplicated HID devices */ + + set = SetupDiGetClassDevsW(&GUID_DEVINTERFACE_MOUSE, NULL, NULL, DIGCF_DEVICEINTERFACE | DIGCF_PRESENT); + +@@ -227,6 +201,34 @@ static void find_devices(void) + + SetupDiDestroyDeviceInfoList(set); + ++ set = SetupDiGetClassDevsW(&hid_guid, NULL, NULL, DIGCF_DEVICEINTERFACE | DIGCF_PRESENT); + -+ /* add mice first so we won't add the duplicated HID devices */ -+ for (idx = 0; SetupDiEnumDeviceInterfaces(set, NULL, &GUID_DEVINTERFACE_MOUSE, idx, &iface); ++idx) ++ for (idx = 0; SetupDiEnumDeviceInterfaces(set, NULL, &hid_guid, idx, &iface); ++idx) + { -+ static const RID_DEVICE_INFO_MOUSE mouse_info = {1, 5, 0, FALSE}; -+ + if (!(device = add_device(set, &iface))) + continue; + -+ device->info.dwType = RIM_TYPEMOUSE; -+ device->info.u.mouse = mouse_info; ++ attr.Size = sizeof(HIDD_ATTRIBUTES); ++ if (!HidD_GetAttributes(device->file, &attr)) ++ WARN("Failed to get attributes.\n"); ++ ++ device->info.dwType = RIM_TYPEHID; ++ device->info.u.hid.dwVendorId = attr.VendorID; ++ device->info.u.hid.dwProductId = attr.ProductID; ++ device->info.u.hid.dwVersionNumber = attr.VersionNumber; ++ ++ if (!HidD_GetPreparsedData(device->file, &device->data)) ++ WARN("Failed to get preparsed data.\n"); ++ ++ if (!HidP_GetCaps(device->data, &caps)) ++ WARN("Failed to get caps.\n"); ++ ++ device->info.u.hid.usUsagePage = caps.UsagePage; ++ device->info.u.hid.usUsage = caps.Usage; + } + + SetupDiDestroyDeviceInfoList(set); + - set = SetupDiGetClassDevsW(&hid_guid, NULL, NULL, DIGCF_DEVICEINTERFACE | DIGCF_PRESENT); + LeaveCriticalSection(&rawinput_devices_cs); + } - for (idx = 0; SetupDiEnumDeviceInterfaces(set, NULL, &hid_guid, idx, &iface); ++idx) -- 2.30.2