Bug 2300988 - activating powertop.service results in usb mouse being off after bootup
Summary: activating powertop.service results in usb mouse being off after bootup
Keywords:
Status: ASSIGNED
Alias: None
Product: Fedora
Classification: Fedora
Component: powertop
Version: 41
Hardware: Unspecified
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Jaroslav Škarvada
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2024-07-29 19:42 UTC by M. Schlegel
Modified: 2024-11-08 19:07 UTC (History)
3 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed:
Type: ---
Embargoed:


Attachments (Terms of Use)
powertop -C results before running powertop service (27.03 KB, text/plain)
2024-11-05 17:10 UTC, M. Schlegel
no flags Details
powertop -C results after running powertop service (24.48 KB, text/plain)
2024-11-05 17:11 UTC, M. Schlegel
no flags Details

Description M. Schlegel 2024-07-29 19:42:09 UTC
The powertop service automatically runs "powertop --auto-tune" for the user.  This is very useful but the powertop default ends up setting the USB mouse to power control of "auto". That's inappropriate for the USB mouse since if it ever turns off it's not possible to wake back up without unplugging and plugging it back in.

Reproducible: Always

Steps to Reproduce:
1. install powertop package on Fedora 40
2. set "sudo systemctl --now enable powertop"
3. reboot
4. USB mouse is off until unplugged and plugged back in
Actual Results:  
USB mouse ends up off by default when powertop service is used

Expected Results:  
USB mouse should always be "on" regardless of using powertop or not, a powered off USB device by definition can't tell it's trying to be used. It has to be plug cycled which is annoying.

version of powertop related to bug:  powertop-2.15-8.fc40.x86_64

The reporter of this bug used an override file /etc/systemd/system/powertop.service.d/override.conf as a hack workaround for this.

------------------- start override.conf -------------
[Unit]
After=tuned.service

[Service]
ExecStartPost=/bin/bash -c "echo 'on' > /sys/bus/usb/devices/3-2/power/control"

--------------- end of override.conf -------------------

This mostly works but fails if the user moves the mouse for any reason to a different port, users shouldn't have to use hacks like this so I'd recommend fixing powertop so it defaults to leaving certain USB devices as power/control value of "on"

Comment 1 M. Schlegel 2024-11-03 03:23:23 UTC
Promoted this to Fedora 41 since it's still a problem there.

Comment 2 Jaroslav Škarvada 2024-11-05 13:25:08 UTC
Could you provide output files created by "powertop -C" (or powertop -r) before the service is activated and after the service is activated, i.e. either two html files or two csv files? I suspect the problem is because the service enabled "all" tunables including USB suspend which is quite problematic with some USB implementations. If confirmed I will forward it to upstream, because I think with the auto mode it shouldn't enable potentially problematic tuning.

You could also try TuneD, run powertop2tuned (from the tuned-utils package) which will create TuneD profile where you can fine tune tunables you need enabled. TuneD is now by default installed on f41 and up, so it shouldn't be much overhead from the default installation.

Comment 3 M. Schlegel 2024-11-05 16:14:32 UTC
I'm already running with tuned service set to 'balanced-battery' profile, the reason I was also running powertop service is that I was running tuned but running the powertop command showed many many things were still "Bad" on the Tunables page.
I'll look into the powertop2tuned

Comment 4 M. Schlegel 2024-11-05 17:10:06 UTC
Created attachment 2055804 [details]
powertop -C results before running powertop service

This is the "before" powertop service output

The powertop override was removed by using systemctl edit powertop so powertop was back to the default.  Then powertop service as disabled and system was rebooted.
After reboot  "powertop -C" was run as root, then "systemctl --now enable powertop" so that powertop service ran in the default way. then "powertop -C" again.

Comment 5 M. Schlegel 2024-11-05 17:11:38 UTC
Created attachment 2055805 [details]
powertop -C results after running powertop service

This is the "after" powertop service runs "powertop -C" output

Comment 6 M. Schlegel 2024-11-05 17:26:05 UTC
This is the "inxi -JSMa" output on the system

System:
  Host: msi Kernel: 6.11.6-300.fc41.x86_64 arch: x86_64 bits: 64 compiler: gcc
    v: 2.43.1-2.fc41 clocksource: hpet avail: acpi_pm
    parameters: BOOT_IMAGE=(hd0,gpt2)/vmlinuz-6.11.6-300.fc41.x86_64
    root=UUID=d1a0e4be-7988-40f6-9011-f563266a6571 ro preempt=full
  Desktop: KDE Plasma v: 6.2.2 tk: Qt v: N/A info: frameworks v: 6.7.0
    wm: kwin_wayland tools: avail: xfce4-screensaver vt: 2 dm: 1: LightDM
    v: 1.32.0 note: stopped 2: SDDM Distro: Fedora Linux 41 (KDE Plasma)
Machine:
  Type: Laptop System: Micro-Star product: Bravo 15 A4DDR v: REV:1.0
    serial: <superuser required> Chassis: type: 10 serial: <superuser required>
  Mobo: Micro-Star model: MS-16WK v: REV:1.0 serial: <superuser required>
    part-nu: 16WK.1 uuid: <superuser required> UEFI: American Megatrends
    v: E16WKAMS.110 date: 10/29/2020
USB:
  Hub-1: 1-0:1 info: hi-speed hub with single TT ports: 4 rev: 2.0
    speed: 480 Mb/s (57.2 MiB/s) lanes: 1 mode: 2.0 chip-ID: 1d6b:0002
    class-ID: 0900
  Hub-2: 2-0:1 info: super-speed hub ports: 2 rev: 3.1
    speed: 10 Gb/s (1.16 GiB/s) lanes: 1 mode: 3.2 gen-2x1 chip-ID: 1d6b:0003
    class-ID: 0900
  Hub-3: 3-0:1 info: hi-speed hub with single TT ports: 4 rev: 2.0
    speed: 480 Mb/s (57.2 MiB/s) lanes: 1 mode: 2.0 chip-ID: 1d6b:0002
    class-ID: 0900
  Device-1: 3-1:5 info: SAVITECH C5D Amp DAC type: HID,audio
    driver: hid-generic,snd-usb-audio,usbhid interfaces: 3 rev: 1.1
    speed: 12 Mb/s (1.4 MiB/s) lanes: 1 mode: 1.1 power: 4mA
    chip-ID: 262a:1120 class-ID: 0102
  Device-2: 3-2:4 info: Microsoft Compact Optical Mouse 500 type: mouse
    driver: hid-generic,usbhid interfaces: 1 rev: 1.1
    speed: 1.5 Mb/s (183 KiB/s) lanes: 1 mode: 1.0 power: 100mA
    chip-ID: 045e:0737 class-ID: 0301
  Device-3: 3-3:3 info: Intel AX200 Bluetooth type: bluetooth driver: btusb
    interfaces: 2 rev: 2.0 speed: 12 Mb/s (1.4 MiB/s) lanes: 1 mode: 1.1
    power: 100mA chip-ID: 8087:0029 class-ID: e001
  Hub-4: 4-0:1 info: super-speed hub ports: 2 rev: 3.1
    speed: 10 Gb/s (1.16 GiB/s) lanes: 1 mode: 3.2 gen-2x1 chip-ID: 1d6b:0003
    class-ID: 0900

Comment 7 Jaroslav Škarvada 2024-11-07 17:16:20 UTC
(In reply to M. Schlegel from comment #3)
> I'm already running with tuned service set to 'balanced-battery' profile,
> the reason I was also running powertop service is that I was running tuned
> but running the powertop command showed many many things were still "Bad" on
> the Tunables page.
> I'll look into the powertop2tuned

powertop2tuned will create custom profile which loads the previous profile (balanced-battery in this case) and adds powertop tuning over it. IMHO you could name the resulting profile also balanced-battery and put it into /etc/tuned/profiles and it should be loaded instead of the system balanced-battery profile.

Comment 8 Jaroslav Škarvada 2024-11-08 19:07:19 UTC
I PR patch upstream. If approved by upstream, I will use it in Fedora downstream:
https://github.com/fenrus75/powertop/pull/164


Note You need to log in before you can comment on or make changes to this bug.