https://bugs.winehq.org/show_bug.cgi?id=48799
Bug ID: 48799 Summary: HOTAS kit Saitek X52 Pro doesn't show all buttons Product: Wine Version: 5.4 Hardware: x86 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: joy.cpl Assignee: wine-bugs@winehq.org Reporter: patola@gmail.com Distribution: Ubuntu
Created attachment 66714 --> https://bugs.winehq.org/attachment.cgi?id=66714 Selecting a button higher than 32 and wine thinking it's button 1
The HOTAS kit Saitek X52 Pro has 9 axes and 39 buttons. Wine only shows 32 and when a button higher than the 32th is pressed, it either registers it as button 1 or 2 or crashes outright with a dialog the messages:
wine: L"C:\windows\system32\joy.cpl" is a dll, not an executable wine: Unhandled page fault on write access to 00E06DB8 at address 7D612AE0 (thread 008e), starting debugger... wine: Unhandled page fault on write access to 00E06DB8 at address 7D611AE0 (thread 0088), starting debugger... 0090:fixme:dbghelp:elf_search_auxv can't find symbol in module
Specifically, when button 35 is pressed (button 34 on jscal-gtk which counts from 0 to 38), the crash happens. The two screenshots show three applications using the joystick -- wine control panel, antimicro and jstest-gtk (which uses through linux input (js) instead of evdev but it's the same hardware).
Also, enabling the js device "Logitech X52 Professional H.O.T.A.S. (js)" leads to an inconditional crash when selecting it on the "test joystick" tab but I understand this might be another issue. I need the HOTAS in evdev mode only.
https://bugs.winehq.org/show_bug.cgi?id=48799
--- Comment #1 from Cláudio Sampaio (Patola) patola@gmail.com --- Created attachment 66715 --> https://bugs.winehq.org/attachment.cgi?id=66715 Pressing button 35 on the HOTAS makes wine crash
https://bugs.winehq.org/show_bug.cgi?id=48799
--- Comment #2 from Cláudio Sampaio (Patola) patola@gmail.com --- Also, it is to note that not all axes are detected too. In the screenshots it is clear that wine only detects 7 of the 9 axes.
https://bugs.winehq.org/show_bug.cgi?id=48799
--- Comment #3 from Cláudio Sampaio (Patola) patola@gmail.com --- Just for the record, also tested with wine-staging 5.4 and Proton 5.0-5 and the behavior/problem is exactly the same.
https://bugs.winehq.org/show_bug.cgi?id=48799
--- Comment #4 from Cláudio Sampaio (Patola) patola@gmail.com --- Changing TEST_MAX_BUTTONS from 32 to 64 and TEST_MAX_AXES from 4 to 16 on ./dlls/joy.cpl/joy.cpl and recompiling made the crash stop on the Test joystick tab, but only 32 buttons appear yet. However it might be due to the dialog only. Will have to test in-game (Elite, Star Citizen etc.) to see if the buttons and axes are correctly detected now.
https://bugs.winehq.org/show_bug.cgi?id=48799
Olivier F. R. Dierick o.dierick@piezo-forte.be changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |o.dierick@piezo-forte.be
--- Comment #5 from Olivier F. R. Dierick o.dierick@piezo-forte.be --- Hello,
I found this in git/dlls/winejoystick.drv/joystick_{linux,osx}.c:
--- code --- /* complete 95 structure */ caps->wRmin = 0; caps->wRmax = 0xFFFF; caps->wUmin = 0; caps->wUmax = 0xFFFF; caps->wVmin = 0; caps->wVmax = 0xFFFF; caps->wMaxAxes = 6; /* same as MS Joystick Driver */ caps->wNumAxes = 0; caps->wMaxButtons = 32; /* same as MS Joystick Driver */ caps->szRegKey[0] = 0; caps->szOEMVxD[0] = 0; caps->wCaps = 0; --- end code ---
I have no expertise in joystick code, but I think the default behavior is to wrap the extra buttons/axes around. I don't know what will happen if this was patched to 10 axes and 40 buttons.
Wine should not crash, though, so if it does, please attach a WINEDEBUG=+joystick,+dinput,+xinput debug trace. Instructions to get a debug trace can be found at point 10.1.2 there: https://wiki.winehq.org/FAQ#get_log
Regards.
https://bugs.winehq.org/show_bug.cgi?id=48799
--- Comment #6 from Olivier F. R. Dierick o.dierick@piezo-forte.be --- (In reply to Cláudio Sampaio (Patola) from comment #4)
Changing TEST_MAX_BUTTONS from 32 to 64 and TEST_MAX_AXES from 4 to 16 on ./dlls/joy.cpl/joy.cpl and recompiling made the crash stop on the Test
Hello,
joy.cpl/main.c has arrays of TEST_MAX_AXES size with static data in it. Changing TEST_MAX_AXES to a greater value may result in uninitialized array elements to be used. Also, TEST_MAX_AXES is actually pairs of axes, so you only need 5 for 10 axes.
Regards.
https://bugs.winehq.org/show_bug.cgi?id=48799
--- Comment #7 from Cláudio Sampaio (Patola) patola@gmail.com --- Olivier, thanks for the guidance. I made a post in the wine forums describing my needs and some questions: https://forum.winehq.org/viewtopic.php?f=2&t=33615
Based on your advice I used 8 pairs of axes instead of 16. My code is currently working, e.g, the game recognizes all buttons and likely all analog axes. I have not yet changed the control panel joystick test dialog though (it has a very limited number of buttons and axes to test). I will try to make a well-behaved patch and send it for request for comments on the wine-devel list once it's properly prepared.
https://bugs.winehq.org/show_bug.cgi?id=48799
--- Comment #8 from Cláudio Sampaio (Patola) patola@gmail.com --- Well... What is the next step? I sent the patch to the wine-devel mailing list and it returned "success":
VM Status Failures Command debiant success debiant success
You can also see the results at: https://testbot.winehq.org/JobDetails.pl?Key=71879
This is my message: https://www.winehq.org/pipermail/wine-devel/2020-May/166377.html
https://bugs.winehq.org/show_bug.cgi?id=48799
--- Comment #9 from Olivier F. R. Dierick o.dierick@piezo-forte.be --- (In reply to Cláudio Sampaio (Patola) from comment #8)
Well... What is the next step? I sent the patch to the wine-devel mailing list and it returned "success":
Hello,
You can wait for comments from the wine-devel mailing list a few days, or submit the patch right away (submitted patches are reviewed in any case).
To submit the patch, the email has to be properly formatted. You should generate a commit in GIT and send it with 'git send-email'. The complete instructions can be found there: https://wiki.winehq.org/Submitting_Patches
Note that on first look, the patch attached to the wine-devel message has indentation issues. Make sure you use spaces, not tabs.
You may also attach the patch on this bug and I'll submit it on your behalf.
Regards.
https://bugs.winehq.org/show_bug.cgi?id=48799
--- Comment #10 from Cláudio Sampaio (Patola) patola@gmail.com --- Thank you, Olivier. I will straighten up my patch and get it in a good shape. I might try and use these numbers as constants in an .h file, do you think it is worth it even if some values are hardwired in the code?
https://bugs.winehq.org/show_bug.cgi?id=48799
Daniel Lynn daniel.eric.lynn@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |daniel.eric.lynn@gmail.com