Bug 469845 - Too much CPU resources when a controller is disconnected
Summary: Too much CPU resources when a controller is disconnected
Status: RESOLVED FIXED
Alias: None
Product: Plasma Bigscreen
Classification: Plasma
Component: Remote Controllers (show other bugs)
Version: unspecified
Platform: Manjaro Linux
: NOR normal
Target Milestone: ---
Assignee: Aditya Mehra
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-05-16 11:50 UTC by machaquiro
Modified: 2023-09-17 06:46 UTC (History)
1 user (show)

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


Attachments
Screenshot of the crime (220.03 KB, image/png)
2023-05-16 11:50 UTC, machaquiro
Details

Note You need to log in before you can comment on or make changes to this bug.
Description machaquiro 2023-05-16 11:50:40 UTC
Created attachment 158995 [details]
Screenshot of the crime

SUMMARY
***
NOTE: If you are reporting a crash, please try to attach a backtrace with debug symbols.
See https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***

When the service is launched and the controller connected CPU usage is close to 0, but when the controller is disconnected it jumps to 25% CPU usage on my laptop (I5-3320M and 15% on my desktop (AMD FX6100) and i can hear the fans ramping up until i have to kill it and restart to get back to normal.

STEPS TO REPRODUCE
1. Connect a remote, PS4 or PS5 gamepad in this case
2. Disconnect from bluetooth or shutdown controller

OBSERVED RESULT
CPU jumps from 0 to whatever depending on your CPU

EXPECTED RESULT
Stay close to 0

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Manjaro KDE
(available in About System)
KDE Plasma Version: 5.27.5
KDE Frameworks Version: 5.106.0
Qt Version: 5.15.9

ADDITIONAL INFORMATION
Comment 1 machaquiro 2023-05-16 15:52:30 UTC
No CEC devices found
No CEC devices found
No CEC devices found
org.kde.plasma.remotecontrollers.evdev: Trying device on evdev: "" "/dev/input/js0"
trying "/org/kde/solid/udev/sys/devices/pci0000:00/0000:00:02.0/usb2/2-1/2-1:1.0/bluetooth/hci0/hci0:71/0005:054C:0CE6.000B/input/input42/js0" "" "/dev/input/js0"
org.kde.plasma.remotecontrollers.evdev: Failed to init libevdev "/dev/input/js0" Argumento inválido 19
No CEC devices found
org.kde.plasma.remotecontrollers.evdev: Trying device on evdev: "" "/dev/input/mouse2"
No CEC devices found
org.kde.plasma.remotecontrollers.evdev: Trying device on evdev: "" "/dev/input/event24"
trying "/org/kde/solid/udev/sys/devices/pci0000:00/0000:00:02.0/usb2/2-1/2-1:1.0/bluetooth/hci0/hci0:71/0005:054C:0CE6.000B/input/input42/event24" "" "/dev/input/event24"
org.kde.plasma.remotecontrollers.evdev: Added evdev device: "/org/kde/solid/udev/sys/devices/pci0000:00/0000:00:02.0/usb2/2-1/2-1:1.0/bluetooth/hci0/hci0:71/0005:054C:0CE6.000B/input/input42/event24"
New device connected: "Wireless Controller"
No CEC devices found
org.kde.plasma.remotecontrollers.evdev: Trying device on evdev: "" "/dev/input/event26"
No CEC devices found
No CEC devices found
Error while reading Device doesn't exist
Device disconnected: "Wireless Controller"

This is what i see when i launch plasma-remotecontrollers from the terminal, last 2 lines are weird since it seems to fail to find the device before it's disconnected.
Comment 2 machaquiro 2023-09-17 06:46:13 UTC
Can't reproduce this bug anymore since Plasma 5.27.8 and KDE Gear 23.08.1.

Commit: https://invent.kde.org/plasma-bigscreen/plasma-remotecontrollers/-/commit/12052062a8b3f7ca53189a96b12742e1445d3201

Everything works fine and CPU usage never gets past 0.2% with only 24.5 MB RAM memory used.

Thanks and keep up the good work, ;)