https://bugs.winehq.org/show_bug.cgi?id=50510
Bug ID: 50510 Summary: user32-rawinput-hid patches sending bogus HID data Product: Wine-staging Version: unspecified Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: -unknown Assignee: wine-bugs@winehq.org Reporter: lunarlambda@gmail.com CC: leslie_alistair@hotmail.com, z.figura12@gmail.com Distribution: ---
I'm using RawInput and HidP APIs to parse joystick input. My controller has 6 axis and 14 buttons, and shows up fine in `wine control joy.cpl.`
However, the data I get from HidP_GetCaps and HidP_GetUsages / HidP_GetUsageValue seems to be nonsense, as it's telling me my controller has only 11 buttons, and also my window is being completely spammed with WM_INPUT messages, with HidP_GetUsages returning usages like 191 or 551, and HidP_GetUsageValue returning seemingly random values too, even when the controller is *completely* still.
I tried using the test apps listed on the wiki but they don't seem to be of much use (one of them crashes because of unimplemented _vcswprintf or something)
I'm afraid that's all the info I can provide without further instructions. I am confident I am using the HID APIs correctly.
https://bugs.winehq.org/show_bug.cgi?id=50510
Alistair Leslie-Hughes leslie_alistair@hotmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |rbernon@codeweavers.com
https://bugs.winehq.org/show_bug.cgi?id=50510
--- Comment #1 from Rémi Bernon rbernon@codeweavers.com --- I suppose this is following https://bugs.winehq.org/show_bug.cgi?id=50506, and the gamepad is a Nintendo Switch Pro Controller?
https://bugs.winehq.org/show_bug.cgi?id=50510
--- Comment #2 from lunarlambda@gmail.com --- (In reply to Rémi Bernon from comment #1)
I suppose this is following https://bugs.winehq.org/show_bug.cgi?id=50506, and the gamepad is a Nintendo Switch Pro Controller?
Indeed. The HID reports are 16 bytes in size, which *seems* to be correct. However some bytes (relating to axis values) jump around wildly, far beyond what could be explained with drift (and again, it shows up perfectly normal in joy.cpl)
bytes 1, 3, 5 just seem to be noise bytes 2, 4, 6, and 8 change consistently with axis movement (X, Y, RX, RY) bytes 9 and 10 are left trigger (either 00 or FF 7F) bytes 11 and 12 are right trigger (same values as above) byte 13 is buttons (as bitflags, one button don't seem to show up though) byte 14 is hat axis value, 0x80 for cardinals, 1,2,3,4 for corners bytes 15 and 16 never change, 98 5C
https://bugs.winehq.org/show_bug.cgi?id=50510
--- Comment #3 from Rémi Bernon rbernon@codeweavers.com --- So I currently only have Wiimote and Joycon Nintendo controllers, and a Dualshock 4, which I used when writing the patches for some Steam game running with Proton, I don't know if that'll be enough.
It would also be awesome if you could record some of your controller input using hid-recorder [1] and / or evemu [2] (depending on which subsystem the controller is using), check if you can replay the data and see the same result in Wine, and post the recording here so anyone (if not me) can try debugging the issue.
[1] [2] From your Linux distribution if it has it, or from https://gitlab.freedesktop.org/libevdev/hid-tools and https://gitlab.freedesktop.org/libevdev/evemu respectively.
Note that I never actually used hid-recorder but it seems you only need the output file to replay, while evemu requires first evemu-describe output to create a virtual device, then evemu-record / evemu-replay on it.
https://bugs.winehq.org/show_bug.cgi?id=50510
--- Comment #4 from lunarlambda@gmail.com --- Will try that. I also wrote a quick C program that uses GetRawInputDeviceList to enumerate all HID devices, pick out my controller, open it with CreateFile, and try to read HID reports from it using ReadFile, but ReadFile always returns ERROR_ACCESS_DENIED, so I'm not sure whatg I'm doing wrong there. MSDN is of little help in that regard.
I'm not sure which subsystem the controller is using, since joy.cpl lists both (event) and (js) versions, but GetRawInputDeviceList only shows one un-suffixed device name.
the reported device path is \?\HID#VID_057E&PID_2009&IG_00#528&030000007E0500000920000010026800&0&0#{4D1E55B2-F16F-11CF-88CB-001111000030}
https://bugs.winehq.org/show_bug.cgi?id=50510
--- Comment #5 from lunarlambda@gmail.com --- Created attachment 69186 --> https://bugs.winehq.org/attachment.cgi?id=69186 hid-recorder log
https://bugs.winehq.org/show_bug.cgi?id=50510
--- Comment #6 from lunarlambda@gmail.com --- (In reply to lunarlambda from comment #5)
Created attachment 69186 [details] hid-recorder log
The data reported by hid-recorder even when the controller was resting completely was similarly nonsensical to that I encountered in my windows code. I tried updating my drivers (hid-nintendo 3.0.2), but that did not fix things.
One thing I noticed is that some reports are 48 bytes, some are 33 bytes, which does seem odd to me.
https://bugs.winehq.org/show_bug.cgi?id=50510
--- Comment #7 from lunarlambda@gmail.com --- I'm wondering if this is to do with the controller's IMU, which, among other things, contains an accelerometer, and this data may be getting mushed together with the joystick values?
https://bugs.winehq.org/show_bug.cgi?id=50510
Julian Rüger jr98@gmx.net changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |jr98@gmx.net