Bug 494913 - Game controller KCM does not show accurate status of analog triggers nor right joystick
Summary: Game controller KCM does not show accurate status of analog triggers nor righ...
Status: RESOLVED FIXED
Alias: None
Product: systemsettings
Classification: Applications
Component: kcm_joystick (show other bugs)
Version: 6.2.1
Platform: Fedora RPMs Linux
: NOR normal
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2024-10-17 07:48 UTC by ppaanncchhoo507
Modified: 2024-12-14 15:54 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In: 6.3.0
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description ppaanncchhoo507 2024-10-17 07:48:08 UTC
***
If you're not sure this is actually a bug, instead post about it at https://discuss.kde.org

If you're reporting a crash, attach a backtrace with debug symbols; see https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports

Please remove this comment after reading and before submitting - thanks!
***

SUMMARY
Game controller menu does not show status of analog triggers nor right joystick. These features work flawlessly on plasma 5.27.

STEPS TO REPRODUCE
1. Open the system settings app and go to game controller
2. Use a gamepad with xinput support. I am using the Logitech gamepad f310 connected via cable to a USB port
3. Try to move the left and right triggers and the right joystick

OBSERVED RESULT
The app only shows the current status of the right joystick when the joystick is in a position that's not parallel to either the x or the y axes. The values of the analog trigger buttons of the gamepad are not updated on screen.



EXPECTED RESULT
The app shows the current status of the right joystick when the joystick is in any position even if it is parallel to either the x or the y axes. The values of the analog trigger buttons of the gamepad are  updated on screen continuously.

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
(available in the Info Center app, or by running `kinfo` in a terminal window)
Linux/KDE Plasma: 6.11.3-200.fc40.x86_64
KDE Plasma Version: 6.2.1
KDE Frameworks Version: 6.6.0
Qt Version: 6.7.2

ADDITIONAL INFORMATION
Comment 1 ppaanncchhoo507 2024-10-17 07:50:44 UTC
I have to admit, fedora 40 as used to run KDE plasma 6.2 and Ubuntu 24.04 was used to run KDE plasma 5.27. I haven't tested running fedora 40 with an older version of KDE or Ubuntu with a newer version of kde
Comment 2 ppaanncchhoo507 2024-11-04 16:58:53 UTC
(In reply to ppaanncchhoo507 from comment #1)
> I have to admit, fedora 40 as used to run KDE plasma 6.2 and Ubuntu 24.04
> was used to run KDE plasma 5.27. I haven't tested running fedora 40 with an
> older version of KDE or Ubuntu with a newer version of kde

I have now tested Ubuntu 24.10 with KDE plasma 6.1 in a virtualbox VM and the issue is still present. Before this I ran all my tests on a Lenovo 15ach6h laptop
Comment 3 Joshua Goins 2024-12-14 15:54:55 UTC
Git commit 9c0c319d635f2758d1d310a2a413b7af335c4005 by Joshua Goins, on behalf of Arthur Kasimov.
Committed on 14/12/2024 at 15:43.
Pushed by redstrate into branch 'master'.

kcms/gamecontroller: Replace SDL Game Controller API with Joystick API

Currently the KCM uses a mix of higher-level SDL "Game Controller" API
and lower-level "Joystick" API. Unfortunately, this results in numerous
bugs. The state of some buttons/axes, such as D-pad or right trigger,
is not displayed properly. This happens due to the mismatch between Game
Controller API and Joystick API that report different number and order
of buttons/axes. Another issue is that some non-standard devices like
racing wheels or handbrakes and not detected at all. The Game Controller
API seems to be limited to standard gamepads only.

This commit introduces new Device class that encapsulates SDL_Joystick
object. Both ButtonModel and AxesModel now use Device object to report
raw values from buttons and axes. DeviceModel now manages Device objects
and shows them in the combo box. This ensures SDL Joystick API is used
consistently across all code and avoids API mismatch issues. This should
also properly detect joysticks, wheels and handbrakes. Unfortunately I
don't have any of these devices and can't really test them.

The Gamepad class encapsulates SDL_GameController object and provides
higher-level access to gamepads. For now it is only used to display the
coordinate of left stick in PositionWidget. In future it can be used to
revamp the UI and show the symbolic view of standard gamepads.
Related: bug 484046, bug 487694, bug 494705

M  +1    -0    kcms/gamecontroller/CMakeLists.txt
M  +33   -14   kcms/gamecontroller/axesmodel.cpp
M  +10   -7    kcms/gamecontroller/axesmodel.h
M  +27   -28   kcms/gamecontroller/buttonmodel.cpp
M  +10   -12   kcms/gamecontroller/buttonmodel.h
A  +90   -0    kcms/gamecontroller/device.cpp     [License: GPL(v2.0+)]
A  +49   -0    kcms/gamecontroller/device.h     [License: GPL(v2.0+)]
M  +71   -30   kcms/gamecontroller/devicemodel.cpp
M  +16   -5    kcms/gamecontroller/devicemodel.h
M  +23   -32   kcms/gamecontroller/gamepad.cpp
M  +7    -20   kcms/gamecontroller/gamepad.h
M  +8    -3    kcms/gamecontroller/ui/main.qml

https://invent.kde.org/plasma/plasma-desktop/-/commit/9c0c319d635f2758d1d310a2a413b7af335c4005