libretro / retroarch-joypad-autoconfig

RetroArch joypad autoconfig files
MIT License
288 stars 364 forks source link

[udev] Fix Sony DualSense L2/R2 axises #1135

Closed barbudreadmon closed 3 months ago

barbudreadmon commented 4 months ago

input_l2_axis and input_r2_axis expect axises, hence should be using the analog indexes +2 & +5 instead of the digital indexes 6 & 7 Fix regression from https://github.com/libretro/retroarch-joypad-autoconfig/commit/815072328d5d5ca469e30bb0a7d52896733b15e7

davidhedlund commented 4 months ago

input_l2_axis and input_r2_axis expect axises, hence should be using the analog indexes +2 & +5 instead of the digital indexes 6 & 7 Fix regression from 8150723

Fix regression from https://github.com/libretro/retroarch-joypad-autoconfig/commit/815072328d5d5ca469e30bb0a7d52896733b15e7

I changed it from _btn:

input_l2_btn = "6"
input_r2_btn = "7"

to _axis:

input_l2_axis = "6"
input_r2_axis = "7"

you don't solve a regression by adding the new values like you did:

input_l2_axis = "+2"
input_r2_axis = "+5"

However, there's a reason why I uploaded my autoconfig. Your autoconfig will cause a regression for my controller.

Here's a summary from the current autoconfig that I uploaded:

# Required Linux kernel version for both USB and Bluetooth: 5.15
#   Source: https://linuxiac.com/linux-kernel-5-12-released-with-many-essential-additions/
# 
# Successful evaluation of DualSense firmware versions + Tested GNU/Linux distribution (and kernel):
# * DualSense (Model number: CFI-ZCT1W A. DualSense firmware: 0402) + Trisquel GNU/Linux 11 in live mode ($ uname -a: Linux trisquel 5.15.0-67-generic #74+11.0trisquel18 SMP Sun Mar 5 03:14:11 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux)

Please copy/paste/modify/reply your data:

barbudreadmon commented 4 months ago

At https://github.com/libretro/retroarch-joypad-autoconfig/commit/815072328d5d5ca469e30bb0a7d52896733b15e7#diff-c1c9ed65f7bce6977c157ddff0576e61fc138bed4f67af333413810100235a93L19-L20, it used to be

input_l2_axis = "+2"
input_r2_axis = "+5"

Afaik, that syntax you used is not correct : input_xx_axis in libretro autoconfigs is for axises and axises start with either a + or -. Retroarch allowing a mix of input_xx_axis and digital indexes seems too lax and a bug to me.

With your changes, L2 and R2 won't act like analog axises, this is 100% a regression.

This is the model i'm using, i think that's the same model you are using :

IMG20240531083218

I'm on Gentoo Linux with a kernel 6.6.21, using a recent nightly of retroarch.

I don't know how you check dualsense firmware version, fwiw my kernel is saying this :

playstation 0003:054C:0CE6.0009: Registered DualSense controller hw_version=0x00000413 fw_version=0x010c000a

And this is the output of jstest, which is the most reliable tool for creating udev autoconfigs :

jstest /dev/input/js0
Driver version is 2.1.0.
Joystick (Sony Interactive Entertainment DualSense Wireless Controller) has 8 axes (X, Y, Z, Rx, Ry, Rz, Hat0X, Hat0Y)
and 13 buttons (BtnA, BtnB, BtnX, BtnY, BtnTL, BtnTR, BtnTL2, BtnTR2, BtnSelect, BtnStart, BtnMode, BtnThumbL, BtnThumbR).
Testing ... (interrupt to exit)
Axes:  0:   258  1:   258  2:-32767  3:  1032  4:  -517  5:-32767  6:     0  7:     0 Buttons:  0:off  1:off  2:off  3:off  4:off  5:off  6:off  7:off  8:off  9:off 10:off 11:off 12:off
barbudreadmon commented 4 months ago

On a sidenote, the reason why you must use jstest is because using the in-app feature of retroarch is unreliable for triggers on sony controllers (and maybe other brands). This is due to the digital indexes (6 & 7) and the analog indexes (+2 and +5) being both reported and retroarch apparently not knowing which ones it should prioritize for its config.

davidhedlund commented 4 months ago

At 8150723#diff-c1c9ed65f7bce6977c157ddff0576e61fc138bed4f67af333413810100235a93L19-L20, it used to be

input_l2_axis = "+2"
input_r2_axis = "+5"

You are right, sorry.

Afaik, that syntax you used is not correct : input_xx_axis in libretro autoconfigs is for axises and axises start with either a + or -. Retroarch allowing a mix of input_xx_axis and digital indexes seems too lax and a bug to me.

Thank you, can you please document this in https://github.com/libretro/docs/blob/master/docs/guides/controller-autoconfiguration.md ?

With your changes, L2 and R2 won't act like analog axises, this is 100% a regression.

This is the model i'm using, i think that's the same model you are using :

IMG20240531083218

I'm on Gentoo Linux with a kernel 6.6.21, using a recent nightly of retroarch.

I don't know how you check dualsense firmware version, fwiw my kernel is saying this :

playstation 0003:054C:0CE6.0009: Registered DualSense controller hw_version=0x00000413 fw_version=0x010c000a

And this is the output of jstest, which is the most reliable tool for creating udev autoconfigs :

jstest /dev/input/js0
Driver version is 2.1.0.
Joystick (Sony Interactive Entertainment DualSense Wireless Controller) has 8 axes (X, Y, Z, Rx, Ry, Rz, Hat0X, Hat0Y)
and 13 buttons (BtnA, BtnB, BtnX, BtnY, BtnTL, BtnTR, BtnTL2, BtnTR2, BtnSelect, BtnStart, BtnMode, BtnThumbL, BtnThumbR).
Testing ... (interrupt to exit)
Axes:  0:   258  1:   258  2:-32767  3:  1032  4:  -517  5:-32767  6:     0  7:     0 Buttons:  0:off  1:off  2:off  3:off  4:off  5:off  6:off  7:off  8:off  9:off 10:off 11:off 12:off

I have overlooked this issue so many tims.

With this the https://github.com/libretro/retroarch-joypad-autoconfig/commit/815072328d5d5ca469e30bb0a7d52896733b15e7 regression should be fixed by replacing _axis with _btn (because that is what RA generates). Can you modify it?:

input_l2_btn = "6"
input_r2_btn = "7"
barbudreadmon commented 4 months ago

There is nothing to modify.

We need

input_l2_axis = "+2"
input_r2_axis = "+5"

for proper trigger analog behavior.

Note that pressing an analog trigger in retroarch will automatically press its digital counterpart at the same time, so there is no reason to ever have

input_l2_btn = "6"
input_r2_btn = "7"
davidhedlund commented 4 months ago

Thank you very much for taking your time, I appreciate it!

Issue 1

Afaik, that syntax you used is not correct : input_xx_axis in libretro autoconfigs is for axises and axises start with either a + or -. Retroarch allowing a mix of input_xx_axis and digital indexes seems too lax and a bug to me.

Thank you, can you please document this in https://github.com/libretro/docs/blob/master/docs/guides/controller-autoconfiguration.md ?

Issue 2

On a sidenote, the reason why you must use jstest is because using the in-app feature of retroarch is unreliable for triggers on sony controllers (and maybe other brands). This is due to the digital indexes (6 & 7) and the analog indexes (+2 and +5) being both reported and retroarch apparently not knowing which ones it should prioritize for its config.

Issue 3

You need to comment why you modified these variables in the autoconfig file, for us to understand why the uploaded file looks differently than the autoconfig generated by RA. Otherwise, people will re-upload a new autoconfig file again in the future because they think it's "outdated".

Also, include the GitHub issue link (see Issue 2) in the comment.

barbudreadmon commented 4 months ago

I added some comments about this in the fixed autoconfig file. If it's not enough then i don't intend to pursue this issue further, i have already written enough libretro documentations/issues/code for a lifetime, but i don't have that kind of free time anymore.

davidhedlund commented 4 months ago

Thank you very much for taking your time, I appreciate it!

Issue 1

Afaik, that syntax you used is not correct : input_xx_axis in libretro autoconfigs is for axises and axises start with either a + or -. Retroarch allowing a mix of input_xx_axis and digital indexes seems too lax and a bug to me.

Thank you, can you please document this in https://github.com/libretro/docs/blob/master/docs/guides/controller-autoconfiguration.md ?

I'll take care of it.

Issue 2

I found an active bug report on this issue

On a sidenote, the reason why you must use jstest is because using the in-app feature of retroarch is unreliable for triggers on sony controllers (and maybe other brands). This is due to the digital indexes (6 & 7) and the analog indexes (+2 and +5) being both reported and retroarch apparently not knowing which ones it should prioritize for its config.

* Can you please file a bug report and link it here? It's important.

Issue 3

You need to comment why you modified these variables in the autoconfig file, for us to understand why the uploaded file looks differently than the autoconfig generated by RA. Otherwise, people will re-upload a new autoconfig file again in the future because they think it's "outdated".

Also, include the GitHub issue link (see Issue 2) in the comment.

Thank you for solving this. Can you please add this link as references in your comments in the autoconfig file:

barbudreadmon commented 4 months ago

Done

davidhedlund commented 3 months ago

Thank you very much for taking your time, I appreciate it!

Issue 1

Afaik, that syntax you used is not correct : input_xx_axis in libretro autoconfigs is for axises and axises start with either a + or -. Retroarch allowing a mix of input_xx_axis and digital indexes seems too lax and a bug to me.

Thank you, can you please document this in https://github.com/libretro/docs/blob/master/docs/guides/controller-autoconfiguration.md ?

I'll take care of it.

Done:

davidhedlund commented 2 months ago
davidhedlund commented 2 months ago

Thank you very much for taking your time, I appreciate it!

Issue 1

Afaik, that syntax you used is not correct : input_xx_axis in libretro autoconfigs is for axises and axises start with either a + or -. Retroarch allowing a mix of input_xx_axis and digital indexes seems too lax and a bug to me.

Thank you, can you please document this in https://github.com/libretro/docs/blob/master/docs/guides/controller-autoconfiguration.md ?

I'll take care of it.

Done:

* [Update controller-autoconfiguration.md -- Mapping sub-sections docs#951](https://github.com/libretro/docs/pull/951)

Here's the new guide how to use jstest: