RetroArch
RetroArch copied to clipboard
Set All Controls: Analog L2/R2 issues for udev and linuxraw, but not sdl2
Description
This bug is specific to controllers featuring analog (pressure-sensitive) L2/R2 triggers.
When mapping the L2/R2 buttons at a standard speed, the system erroneously registers them as double inputs. This malfunction appears to be related to the pressure sensitivity feature, causing a single press to be interpreted as two separate inputs.
Expected behavior
- Gradual L2 press: Should register as a single L2 input
- Gradual R2 press: Should register as a single R2 input
The current behavior deviates from this expected outcome, resulting in unintended double inputs for these trigger buttons.
Actual behavior
Flatpak 1.19.1 uses udev as controller driver by default, which is used in this example.
Fast pressing
When L2 and R2 are activated with extreme speed (using a quick finger-slapping motion), the system does not register double-clicking. This contrasts with the problematic behavior observed during normal-speed activation. However, the L2/R2 variables are set to digital (input_l2_btn, input_r2_btn) instead of analog (input_l2_axis, input_r2_axis) which is incorrect.
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_axis = "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"
Issue: Pressing L2/R2 extremely quickly generates:
input_l2_btn = "6"
input_r2_btn = "7"
Expectation: Pressing L2/R2 extremely quickly should generate:
input_l2_axis = "+2"
input_r2_axis = "+5"
Normal pressing
Normal pressing speed is registered as slow pressing.
- Normal speed pressing L2:
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_axis = "+2"
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"
Issue: Pressing L2 ("slowly") generates:
input_l2_btn = "6"
input_r2_axis = "+2"
Expectation: Pressing L2 ("slowly") should only generate:
input_l2_axis = "+2"
- Normal speed pressing L2:
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_axis = "+5"
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"
Issue: Pressing R2 ("slowly") generates:
input_r2_btn = "7"
input_l3_axis = "+5"
Expectation: Pressing R2 ("slowly") should only generate:
input_r2_axis = "+5"
Steps to reproduce the bug
Settings -> Input -> RetroPad Binds -> Port 1 Controls -> Set All Controls
Version/Commit
- RetroArch: 1.19.1 Flatpak
Test case to reproduce this issue for DualSense with Remote RetroPad:
- Follow https://github.com/libretro/docs/blob/master/docs/guides/controller-autoconfiguration.md
- Create retroarch/autoconfig/udev/ directory (otherwise the autoconfig will be placed in retroarch/autoconfig/ in the next steps)
- Open appimage 1.19.1 (flatpak cannot generate linuxraw yet)
- Set the controller driver:
Settings -> Drivers -> Controller. Close RetroArch and open it again for the controller driver setting to take effect. - Run
Settings -> Input -> User 1 Binds -> User 1 Bind All - Run
Settings -> Input -> RetroPad Binds -> Port 1 Controls -> Save Controller Profile Main -> Load Core -> Start Remote RetroPadand test pressure sensitivity for L2 and R2.
Correct controller driver
SDL2 (correct L2/R2)
Note: I've evaluated SDL2 in Flatpak, but not in Appimage (sdl2 does not work https://github.com/hizzlekizzle/RetroArch-AppImage/issues/9)
retroarch/autoconfig/sdl2/PS5 Controller.cfg
input_driver = "sdl2"
input_device = "PS5 Controller"
input_vendor_id = "1356"
input_product_id = "3302"
input_b_btn = "0"
input_y_btn = "2"
input_select_btn = "4"
input_start_btn = "6"
input_up_btn = "11"
input_down_btn = "12"
input_left_btn = "13"
input_right_btn = "14"
input_a_btn = "1"
input_x_btn = "3"
input_l_btn = "9"
input_r_btn = "10"
input_l2_axis = "+4"
input_r2_axis = "+5"
input_l3_btn = "7"
input_r3_btn = "8"
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 = "+2"
input_r_x_minus_axis = "-2"
input_r_y_plus_axis = "+3"
input_r_y_minus_axis = "-3"
Incorrect controller drivers
linuxraw
linuxraw/Sony Interactive Entertainment DualSense Wireless Controller.cfg:
input_driver = "linuxraw"
input_device = "Sony Interactive Entertainment DualSense Wireless Controller"
input_b_btn = "0"
input_y_btn = "3"
input_select_btn = "8"
input_start_btn = "9"
input_up_axis = "-7"
input_down_axis = "+7"
input_left_axis = "-6"
input_right_axis = "+6"
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"
Manually replaced and variables commented in https://github.com/libretro/retroarch-joypad-autoconfig/pull/1141
input_l2_axis = "+2"
input_r2_axis = "+5"
udev
retroarch/autoconfig/udev/Sony Interactive Entertainment DualSense Wireless Controller.cfg
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"
Manually replaced and variables commented in https://github.com/libretro/retroarch-joypad-autoconfig/pull/1135
input_l2_axis = "+2"
input_r2_axis = "+5"
I'm surprised you only saw a problem. Lots of hardware is buggy as hell and depends on "driver fixes" to fix their nonsensical cost saving measures.
Linux likes to have two levels of hardware access. Linuxraw as implied is the "raw" inputs the hardware reports. Udev I can't recall what it does.
But things like kde, gnome or sdl got the short end of the stick and maintain a input library of "quirks" that sits between the kernel output and the user that has all the hardware specific hacks (this library is libinput). I found this out when using kms RetroArch - RetroArch running without a desktop environment - and realized my portable touch input was making the cursor jump, not drag.
Tl;Dr: using Linuxraw with certain hardware (especially common in portables and tablets but not only) is a good way to get fucked input and there is little to be done because this is the hardware doing it. I don't know the situation with udev now.
I'm surprised you only saw a problem.
There's a link to this issue above if you want to read related issues:
- https://github.com/libretro/retroarch-joypad-autoconfig/issues/1143