This is a preparation for a patch that changes setupapi to return lowercased device paths, which is the source of RawInput device names. On Windows RawInput returns mostly uppercase names. This patch tries to keep Wine's old behavior in this regards as SDL 2.0.14+ looks for uppercase IG_ to match xinput devices to their RawInput counterparts.
Signed-off-by: Arkadiusz Hiler ahiler@codeweavers.com --- dlls/user32/rawinput.c | 2 ++ dlls/user32/tests/input.c | 17 +++++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/dlls/user32/rawinput.c b/dlls/user32/rawinput.c index ba11a121bc5..823ddf6f61d 100644 --- a/dlls/user32/rawinput.c +++ b/dlls/user32/rawinput.c @@ -121,6 +121,8 @@ static struct device *add_device(HDEVINFO set, SP_DEVICE_INTERFACE_DATA *iface) } heap_free(detail);
+ wcsupr(path); /* SDL does case-sensitive search for IG_ */ + file = CreateFileW(path, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, 0); if (file == INVALID_HANDLE_VALUE) diff --git a/dlls/user32/tests/input.c b/dlls/user32/tests/input.c index 9d75daa0bd5..63ea80a4625 100644 --- a/dlls/user32/tests/input.c +++ b/dlls/user32/tests/input.c @@ -1802,7 +1802,7 @@ static void test_GetRawInputDeviceList(void) RAWINPUTDEVICELIST devices[32]; UINT ret, oret, devcount, odevcount, i; DWORD err; - BOOLEAN br; + BOOLEAN br, xinput_tested = FALSE;
SetLastError(0xdeadbeef); ret = pGetRawInputDeviceList(NULL, NULL, 0); @@ -1835,7 +1835,7 @@ static void test_GetRawInputDeviceList(void)
for(i = 0; i < devcount; ++i) { - WCHAR name[128]; + WCHAR name[128], name_cpy[128]; char nameA[128]; UINT sz, len; RID_DEVICE_INFO info; @@ -1855,6 +1855,15 @@ static void test_GetRawInputDeviceList(void) len = lstrlenW(name); ok(len + 1 == ret, "GetRawInputDeviceInfo returned wrong length (name: %u, ret: %u)\n", len + 1, ret);
+ /* requires xinput device to be connected, SDL 2.0.14+ looks for uppercase IG_ */ + lstrcpyW(name_cpy, name); + wcsupr(name_cpy); + if (wcsstr(name_cpy, L"IG_")) + { + xinput_tested = TRUE; + ok(wcsstr(name, L"IG_") != NULL, "Expected xinput device path to contain uppercase &IG_.\n", debugstr_w(name)); + } + /* test A variant with same size */ ret = pGetRawInputDeviceInfoA(devices[i].hDevice, RIDI_DEVICENAME, nameA, &sz); ok(ret == sz, "GetRawInputDeviceInfoA gave wrong return: %d\n", err); @@ -1927,6 +1936,10 @@ static void test_GetRawInputDeviceList(void) CloseHandle(file); }
+ if (!xinput_tested) + skip("No xinput device. Ignoring xinput / RawInput device path tests.\n"); + + /* check if variable changes from larger to smaller value */ devcount = odevcount = ARRAY_SIZE(devices); oret = ret = pGetRawInputDeviceList(devices, &odevcount, sizeof(devices[0]));
This prepares xinput for the upcoming change in setupapi path casing.
Signed-off-by: Arkadiusz Hiler ahiler@codeweavers.com --- dlls/xinput1_3/hid.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/dlls/xinput1_3/hid.c b/dlls/xinput1_3/hid.c index 8aea638a8d7..c3b3a4831a7 100644 --- a/dlls/xinput1_3/hid.c +++ b/dlls/xinput1_3/hid.c @@ -247,7 +247,8 @@ void HID_find_gamepads(xinput_controller *devices) &interface_data, data, sizeof(*data) + detail_size, NULL, NULL)) continue;
- if (!wcsstr(data->DevicePath, L"IG_")) + wcslwr(data->DevicePath); + if (!wcsstr(data->DevicePath, L"ig_")) continue;
open_device_idx = -1;
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=86116
Your paranoid android.
=== debiant2 (32 bit report) ===
user32: win.c:3079: Test succeeded inside todo block: Focus should be on child 000800FE, not 000800FE win.c:10767: Test failed: 000D012E: expected prev 0041013C, got 00000000 win.c:10781: Test failed: hwnd should NOT be topmost win.c:10783: Test failed: 000D012E: expected NOT topmost win.c:10727: Test failed: 1: hwnd 000D012E is still topmost
=== debiant2 (32 bit Chinese:China report) ===
user32: win.c:3079: Test succeeded inside todo block: Focus should be on child 000800FE, not 000800FE
Some games are doing case sensitive matches on the device paths obtained from setupapi and expect them to be lowercase.
This fixes Virginia (and possibly other games using Rewired) not being able to discover DualShock 4 over bus_udev.
Signed-off-by: Arkadiusz Hiler ahiler@codeweavers.com --- dlls/setupapi/devinst.c | 3 +++ dlls/setupapi/tests/devinst.c | 13 +++++++++++++ 2 files changed, 16 insertions(+)
diff --git a/dlls/setupapi/devinst.c b/dlls/setupapi/devinst.c index de0413e74f5..d5ddd3a6b41 100644 --- a/dlls/setupapi/devinst.c +++ b/dlls/setupapi/devinst.c @@ -403,6 +403,9 @@ static LPWSTR SETUPDI_CreateSymbolicLinkPath(LPCWSTR instanceId, lstrcpyW(ret + printed + 1, ReferenceString); } } + + CharLowerW(ret); + return ret; }
diff --git a/dlls/setupapi/tests/devinst.c b/dlls/setupapi/tests/devinst.c index 48b84c21e84..ea8d9b5a682 100644 --- a/dlls/setupapi/tests/devinst.c +++ b/dlls/setupapi/tests/devinst.c @@ -1025,6 +1025,18 @@ static void test_register_device_info(void) SetupDiDestroyDeviceInfoList(set); }
+static void check_all_lower_case(int line, const char* str) +{ + const char *cur; + + for (cur = str; *cur; cur++) + { + BOOL is_lower = (tolower(*cur) == *cur); + ok_(__FILE__, line)(is_lower, "Expected device path to be all lowercase but got %s.\n", str); + if (!is_lower) break; + } +} + static void check_device_iface_(int line, HDEVINFO set, SP_DEVINFO_DATA *device, const GUID *class, int index, DWORD flags, const char *path) { @@ -1046,6 +1058,7 @@ static void check_device_iface_(int line, HDEVINFO set, SP_DEVINFO_DATA *device, ret = SetupDiGetDeviceInterfaceDetailA(set, &iface, detail, sizeof(buffer), NULL, NULL); ok_(__FILE__, line)(ret, "Failed to get interface detail, error %#x.\n", GetLastError()); ok_(__FILE__, line)(!strcasecmp(detail->DevicePath, path), "Got unexpected path %s.\n", detail->DevicePath); + check_all_lower_case(line, detail->DevicePath); } else {
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=86117
Your paranoid android.
=== debiant2 (32 bit report) ===
user32: win.c:3079: Test succeeded inside todo block: Focus should be on child 000800FE, not 000800FE
=== debiant2 (32 bit Chinese:China report) ===
user32: win.c:3079: Test succeeded inside todo block: Focus should be on child 000800FE, not 000800FE
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=86115
Your paranoid android.
=== w1064v1809 (32 bit report) ===
user32: input.c:2760: Test failed: 0: expected WM_MOUSEMOVE message input.c:2760: Test failed: 1: expected WM_MOUSEMOVE message input.c:2760: Test failed: 2: expected WM_MOUSEMOVE message
=== debiant2 (32 bit report) ===
user32: win.c:3079: Test succeeded inside todo block: Focus should be on child 000800FE, not 000800FE
=== debiant2 (32 bit Chinese:China report) ===
user32: win.c:3079: Test succeeded inside todo block: Focus should be on child 000800FE, not 000800FE win.c:10097: Test failed: Expected foreground window 0, got 00E10102 win.c:10103: Test failed: Expected foreground window 000E013E, got 00E10102 win.c:10120: Test failed: Expected foreground window 000E013E, got 00E10102 win.c:10122: Test failed: GetActiveWindow() = 00000000 win.c:10122: Test failed: GetFocus() = 00000000 win.c:10124: Test failed: Received WM_ACTIVATEAPP(0), did not expect it. win.c:10132: Test failed: Expected foreground window 000E013E, got 00000000 win.c:10134: Test failed: GetActiveWindow() = 00000000 win.c:10134: Test failed: GetFocus() = 00000000 win.c:10142: Test failed: Received WM_ACTIVATEAPP(1), did not expect it.