D-pad not detected under Linux
Describe the bug In v5 prerelease all functions work except d-pad. On v4.8 the d-pad is detected normally.
To Reproduce Steps to reproduce the behavior: set up as usual, see that d-pad does not work
Expected behavior D-pad works
Additional information:
- Plugin version: 5.0.0rc1
- Full OBS Studio log: https://pastebin.com/raw/pryXkQjA
Additional context Problem seems to have been introduced post-4.8
I should note I am using the presets from the 5.0.0rc1 release. Is there any way to check what codes should be used for my D-pad?
https://github.com/univrsal/libgamepad/blob/793cf5cc39d0af84c973310309d1762788ac9717/src/binding-default.cpp#L131
Maybe the issue is here? For me, the d-pad for my Series X controller shows up as axes 6 and 7, but there's no entry addressing axes 6 and 7. Is there a is_hat or is_dpad option?
output of jstest:
Joystick (Microsoft Xbox One X pad) has 8 axes (X, Y, Z, Rx, Ry, Rz, Hat0X, Hat0Y)
and 11 buttons (BtnA, BtnB, BtnX, BtnY, BtnTL, BtnTR, BtnSelect, BtnStart, BtnMode, BtnThumbL, BtnThumbR).
https://github.com/univrsal/input-overlay/pull/154/commits/cfb4b5b265b0de08fdd50994f1eceb067a1f0b60 perhaps these changes didn't make it to v5 yet?
Those fixes are for the 4.8 version, which doesn't use the new gamepad library. Did you try and rebind your dpad in the settings dialog (Tools > input-overlay settings in the OBS main window)?

Problem is it's looking for four buttons, not two axes. D-pad for Series X uses 2 axes labeled 6 and 7, so Dpad left registers as "6", but so does Dpad right, because it's the same axis. Same with up and down, both get assigned "7". In fact I could probably register the Dpad as an analog stick and it would work, but then I'd lose usage of that stick.
I'm pretty sure that yes, it's trying to use the two axes as buttons. Included is a video (I'm using a DS4 controller), and you can see that while the io-cct config page sees everything (and they all default absolutely correctly, I had to make changes for the plugin via the gamepad bindings, also visible, configured by pressing every button to be as safe as possible), but the overlay itself gets confused when it comes to the back triggers and the directional pad's right and down, and doesn't see the actual dpad presses at all.
https://user-images.githubusercontent.com/766446/170803149-0168b2dd-e088-4092-bdba-b7c05771280f.mp4
I'm also attaching the log that was visible -- which only includes the items seemingly affected by this issue. The issuing command was ./libgamepad_tests | grep -E 'Controller|Hook|button event: Native id: 6|button event: Native id: 7|axis event: Native id: 2|axis event: Native id: 5|axis event: Native id: 6|axis event: Native id: 7', based on output I got from running ./libgamepad_tests previously without pressing any of the other buttons.
The key here seems to be that pressing down the left trigger starts with a button event: Native id: 6, Virtual id: 0xEC07 (60423) val: 1.000000, val: 0.000000 on release. (There are multiple axis events for the amount of pressure on the trigger, but the Native id is 2 and doesn't match up.) Pressing the right DPad button returns an axis event: Native id: 6, Virtual id: 0x0 (0) val: 0.999992 on push, , val: 0.500000 on release. The right trigger's button event: Native id: 7, Virtual id: 0xEC06 (60422), down (1) and up (0) are axis event: Native id: 7, Virtual id: 0x0 (0), with everything else being the same.
DPadIssue.txt
I can make a new log of whatever might be helpful to diagnose / resolve the issue.
Edit: The overlay and io-cct were both using an unmodified dualsense.json file.
So I never anticipated that gamepads would use an axis for buttons, which at the time seemed like a fairly sane assumption. So if I get this correctly not pressing left or right will result in a virtual value of 0, pressing left will result in 0.5 and pressing right returns 1 and the same for up/down just with a different axis id?
Sorry, not quite. For absolute clarity: pressing left will result in a value of zero*, pressing right will result in a value of 1*. Releasing them results in a value of 0.5, making that the neutral / resting value. Left/right was identified as native id 6 for the axis, up/down was identified as native id 7. Up was 0*, down was 1*, middle was again .5.
(*) The actual 'zero' value for me appears to always be 0.000008, the 'one' value is always 0.999992, for both directions. I don't think that's incredibly relevant, but I'm trying to provide you all information. Apologies if I'm just confusing the matter.
For a more visual representation of the above:
0
| Axis 6
|
0 ---- .5 ---- 1 Axis 7
|
|
1
Ok, now I just somehow need to modify libgamepad in a way where a button can also be an axis.
Hello ! I'have same problem here, both on Linux or windows. ( input-overlay.v5.0.0rc1-8d04a98 )
So i tried to remap as seen in vidéo @HereInPlainSight 's video, like this :
cliking in the Dpad Left box, move the gamepad cross left (that write 0)
cliking in the Dpad Right box, move the gamepad cross right, and so on.
(that write 0 for both left and right | that write 1 for both up and down)
Then i clicking Save and OK.
But Dpad not working at all, so i return to the binding config, and see that the remap values (left and up) are not stored…

here is the jstest result :
And on windows :

And finaly i've tested another gamepad, and had same bad résult.
What does the log file look like after you tried rebinding? The bindings should also be saved to ~/.config/input-overlay so you might want to check what the json file looks like
Thanks for theses suggestions. Here the OBS log file https://pastebin.com/f4YrAQmm
Unfortunately there is no binding file in the ~/.config/input-overlay directory, neither childs directory. Maybe in another location ? Or the problem is that this file is not created ?
Well it should be created once you click save and apply, if it can't it'll log an error
Ok. Sorry, but when i click save, nothing happened and no apply button appeared.
Yeah I meant Ok, not Apply. If you just open the dialog and click save without doing any binding and then close obs it should save the config file. If that doesn't work I don't know what the issue is.
Sorry, my bad, i'm tired it's late for me at 1h03 AM. I have looking in .config/obs-studio/plugins/input-overlay instead of .config/input-overlay
S0 the file gamepad_bindings.json exist, it contain :
{"bindings": [{"binds": [{"from": 0, "is_axis": true, "to": 60431}, {"from": 1, "is_axis": true, "to": 60432}, {"from": 2, "is_axis": true, "to": 60433}, {"from": 3, "is_axis": true, "to": 60434}, {"from": 4, "is_axis": true, "to": 60435}, {"from": 5, "is_axis": true, "to": 60436}, {"from": 0, "is_axis": false, "to": 60428}, {"from": 1, "is_axis": false, "to": 60430}, {"from": 2, "is_axis": false, "to": 60418}, {"from": 3, "is_axis": false, "to": 60419}, {"from": 4, "is_axis": false, "to": 60420}, {"from": 5, "is_axis": false, "to": 60421}, {"from": 6, "is_axis": false, "to": 60423}, {"from": 7, "is_axis": false, "to": 60422}, {"from": 8, "is_axis": false, "to": 60424}, {"from": 9, "is_axis": false, "to": 60425}, {"from": 10, "is_axis": false, "to": 60426}, {"from": 11, "is_axis": false, "to": 60427}, {"from": 12, "is_axis": false, "to": 60428}, {"from": 13, "is_axis": false, "to": 60429}, {"from": 14, "is_axis": false, "to": 60430}], "name": "test"}], "bindings_map": [{"binding_id": "test", "device_id": "(js0) Paul Qureshi Arcade Joystick v1.1"}]}
I try to replace 11 by 0
And 13 by 1
But not better result, nothing move and the field are empty when reload OBS

And at next OBS starting, 11 and 13 are back…
Well I just checked myself and using xboxdrv my dpad now is also an axis. This is just great...
See #297 for further tracking