Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 3 commits into from
Jun 10, 2024
Merged

Conversation

barbudreadmon
Copy link
Contributor

@barbudreadmon barbudreadmon commented May 29, 2024

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

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
@davidhedlund
Copy link
Contributor

davidhedlund commented May 30, 2024

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 8150723

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:

  • DualSense Model number (don't forget to include " A" if applicable):
  • DualSense firmware:
  • OS/kernel:
  • RetroArch version:

@barbudreadmon
Copy link
Contributor Author

barbudreadmon commented May 31, 2024

At 8150723#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
Copy link
Contributor Author

barbudreadmon commented May 31, 2024

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
Copy link
Contributor

davidhedlund commented Jun 1, 2024

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.

input_l2_btn = "6"
input_r2_btn = "7"
  • Delete the retroarch directory for the appimage to start all over with the default settings
  • Create retroarch/autoconfig/udev/ directory (otherwise the autoconfig will be placed in retroarch/autoconfig/ in the next steps)
  • Open appimage 1.18.0
  • Run Settings->Input->User 1 Binds->User 1 Bind All
  • Run Settings -> Input -> RetroPad Binds -> Port 1 Controls -> Save Controller Profile
  • retroarch/autoconfig/udev/Sony Interactive Entertainment DualSense Wireless Controller.cfg generated:
input_driver = "udev"
input_device = "Sony Interactive Entertainment DualSense Wireless Controller"
input_vendor_id = "1356"
input_product_id = "3302"
input_b_btn = "0"
input_y_btn = "3"
input_select_btn = "8"
input_start_btn = "9"
input_up_btn = "h0up"
input_down_btn = "h0down"
input_left_btn = "h0left"
input_right_btn = "h0right"
input_a_btn = "1"
input_x_btn = "2"
input_l_btn = "4"
input_r_btn = "5"
input_l2_btn = "6"
input_r2_btn = "7"
input_l3_btn = "11"
input_r3_btn = "12"
input_l_x_plus_axis = "+0"
input_l_x_minus_axis = "-0"
input_l_y_plus_axis = "+1"
input_l_y_minus_axis = "-1"
input_r_x_plus_axis = "+3"
input_r_x_minus_axis = "-3"
input_r_y_plus_axis = "+4"
input_r_y_minus_axis = "-4"
  • I assigned hotkeys to L2 and R2 with fast-forward and rewind respectively, and tested them in a SNES game. They are working!
  • I closed RA. and edited udev/Sony Interactive Entertainment DualSense Wireless Controller.cfg by adding
input_l2_axis = "+2"
input_r2_axis = "+5"
  • I opened RA and tested L2 and R2 again in a SNES game. They are working!

With this the 8150723 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
Copy link
Contributor Author

barbudreadmon commented Jun 3, 2024

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
Copy link
Contributor

davidhedlund commented Jun 4, 2024

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.

  • 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.

@barbudreadmon
Copy link
Contributor Author

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
Copy link
Contributor

davidhedlund commented Jun 4, 2024

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
Copy link
Contributor Author

Done

@RobLoach RobLoach changed the title update Sony Interactive Entertainment DualSense Wireless Controller.cfg [udev] Fix Sony DualSense L2/R2 axises Jun 10, 2024
@RobLoach RobLoach merged commit 01aea0c into libretro:master Jun 10, 2024
1 check passed
@barbudreadmon barbudreadmon deleted the patch-4 branch June 13, 2024 12:47
@davidhedlund
Copy link
Contributor

davidhedlund commented Jun 13, 2024

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 added a commit to davidhedlund/retroarch-joypad-autoconfig that referenced this pull request Jul 8, 2024
…cfg to Sony Interactive Entertainment DualSense Wireless Controller.cfg

# Renamed the file
`Settings -> Input -> RetroPad Binds -> Port 1 Controls -> Save Controller Profile` generates:
* `linuxraw/Sony Interactive Entertainment DualSense Wireless Controller.cfg` not `linuxraw/Sony Interactive Entertainment Wireless Controller.cfg`

# Added pressure sensitivity key bindings to L2/R2
Replaced L2/R2 digital buttons with analog axes (pressure sensitivity) since RetroArch does not generate them correctly for these buttons due to a bug (see also libretro#1135).
@davidhedlund
Copy link
Contributor

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:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants