Is your feature request related to a problem? Please describe.
On a new Lenovo Legion 5 15AKP10 (AMD), sometimes the laptop will report battery status every 0.5 seconds with an ACPI event (acpi_listen):
battery PNP0C0A:00 00000080 00000001
battery PNP0C0A:00 00000080 00000001
battery PNP0C0A:00 00000080 00000001
battery PNP0C0A:00 00000080 00000001
battery PNP0C0A:00 00000080 00000001
Which as a consequence, will trigger a udev kernel event (sudo udevadm monitor):
KERNEL[1296.287299] change /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:41/PNP0C09:00/PNP0C0A:00/power_supply/BAT0 (power_supply)
UDEV [1296.395084] change /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:41/PNP0C09:00/PNP0C0A:00/power_supply/BAT0 (power_supply)
KERNEL[1296.789457] change /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:41/PNP0C09:00/PNP0C0A:00/power_supply/BAT0 (power_supply)
UDEV [1296.892868] change /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:41/PNP0C09:00/PNP0C0A:00/power_supply/BAT0 (power_supply)
KERNEL[1297.355145] change /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:41/PNP0C09:00/PNP0C0A:00/power_supply/BAT0 (power_supply)
UDEV [1297.462055] change /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:41/PNP0C09:00/PNP0C0A:00/power_supply/BAT0 (power_supply)
KERNEL[1297.792233] change /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:41/PNP0C09:00/PNP0C0A:00/power_supply/BAT0 (power_supply)
UDEV [1297.892774] change /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:41/PNP0C09:00/PNP0C0A:00/power_supply/BAT0 (power_supply)
KERNEL[1298.293330] change /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:41/PNP0C09:00/PNP0C0A:00/power_supply/BAT0 (power_supply)
UDEV [1298.399272] change /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:41/PNP0C09:00/PNP0C0A:00/power_supply/BAT0 (power_supply)
I checked whether this triggers TLP, and indeed it does. Here's the output of sudo udevadm control --log-priority=debug and sudo journalctl -f
Sep 07 20:55:13 nixos systemd-udevd[7780]: No events are queued, removed /run/udev/queue.
Sep 07 20:55:13 nixos systemd-udevd[7780]: BAT0: Device is queued (SEQNUM=5073, ACTION=change)
Sep 07 20:55:13 nixos systemd-udevd[7780]: BAT0: Device ready for processing (SEQNUM=5073, ACTION=change)
Sep 07 20:55:13 nixos systemd-udevd[7780]: BAT0: sd-device-monitor(manager): Passed 798 byte to netlink monitor.
Sep 07 20:55:13 nixos (udev-worker)[44423]: BAT0: Processing device (SEQNUM=5073, ACTION=change)
Sep 07 20:55:13 nixos (udev-worker)[44423]: BAT0: sd-device: Created database file '/run/udev/data/+power_supply:BAT0' for '/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:41/PNP0C09:00/PNP0C0A:00/power_supply/BAT0'.
Sep 07 20:55:13 nixos (udev-worker)[44423]: BAT0: /nix/store/rp2xd0b2jjbc2gdhc51qsrcnf0mz2wl9-udev-rules/85-tlp.rules:7 RUN '/nix/store/dq5fdsfzs2p4ixvy204a8m8j5fkgf6zv-tlp-1.8.0/sbin/tlp auto'
Sep 07 20:55:13 nixos (udev-worker)[44423]: BAT0: sd-device: Created database file '/run/udev/data/+power_supply:BAT0' for '/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:41/PNP0C09:00/PNP0C0A:00/power_supply/BAT0'.
Sep 07 20:55:13 nixos (udev-worker)[44423]: BAT0: Running command "/nix/store/dq5fdsfzs2p4ixvy204a8m8j5fkgf6zv-tlp-1.8.0/sbin/tlp auto"
Sep 07 20:55:13 nixos (udev-worker)[44423]: BAT0: Starting '/nix/store/dq5fdsfzs2p4ixvy204a8m8j5fkgf6zv-tlp-1.8.0/sbin/tlp auto'
Sep 07 20:55:13 nixos (udev-worker)[44423]: Successfully forked off '(spawn)' as PID 46097.
Sep 07 20:55:13 nixos (udev-worker)[44423]: BAT0: Process '/nix/store/dq5fdsfzs2p4ixvy204a8m8j5fkgf6zv-tlp-1.8.0/sbin/tlp auto' succeeded.
Sep 07 20:55:13 nixos (udev-worker)[44423]: BAT0: sd-device: Created database file '/run/udev/data/+power_supply:BAT0' for '/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:41/PNP0C09:00/PNP0C0A:00/power_supply/BAT0'.
Sep 07 20:55:13 nixos (udev-worker)[44423]: BAT0: Device processed (SEQNUM=5073, ACTION=change)
Sep 07 20:55:13 nixos (udev-worker)[44423]: BAT0: sd-device-monitor(worker): Passed 917 byte to netlink monitor.
Sep 07 20:55:13 nixos systemd-udevd[7780]: No events are queued, removed /run/udev/queue.
Sep 07 20:55:14 nixos systemd-udevd[7780]: BAT0: Device is queued (SEQNUM=5074, ACTION=change)
Sep 07 20:55:14 nixos systemd-udevd[7780]: BAT0: Device ready for processing (SEQNUM=5074, ACTION=change)
Sep 07 20:55:14 nixos systemd-udevd[7780]: BAT0: sd-device-monitor(manager): Passed 798 byte to netlink monitor.
Sep 07 20:55:14 nixos (udev-worker)[44423]: BAT0: Processing device (SEQNUM=5074, ACTION=change)
Sep 07 20:55:14 nixos (udev-worker)[44423]: BAT0: sd-device: Created database file '/run/udev/data/+power_supply:BAT0' for '/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:41/PNP0C09:00/PNP0C0A:00/power_supply/BAT0'.
Sep 07 20:55:14 nixos (udev-worker)[44423]: BAT0: /nix/store/rp2xd0b2jjbc2gdhc51qsrcnf0mz2wl9-udev-rules/85-tlp.rules:7 RUN '/nix/store/dq5fdsfzs2p4ixvy204a8m8j5fkgf6zv-tlp-1.8.0/sbin/tlp auto'
Sep 07 20:55:14 nixos (udev-worker)[44423]: BAT0: sd-device: Created database file '/run/udev/data/+power_supply:BAT0' for '/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:41/PNP0C09:00/PNP0C0A:00/power_supply/BAT0'.
Sep 07 20:55:14 nixos (udev-worker)[44423]: BAT0: Running command "/nix/store/dq5fdsfzs2p4ixvy204a8m8j5fkgf6zv-tlp-1.8.0/sbin/tlp auto"
Sep 07 20:55:14 nixos (udev-worker)[44423]: BAT0: Starting '/nix/store/dq5fdsfzs2p4ixvy204a8m8j5fkgf6zv-tlp-1.8.0/sbin/tlp auto'
Sep 07 20:55:14 nixos (udev-worker)[44423]: Successfully forked off '(spawn)' as PID 46134.
Sep 07 20:55:14 nixos (udev-worker)[44423]: BAT0: Process '/nix/store/dq5fdsfzs2p4ixvy204a8m8j5fkgf6zv-tlp-1.8.0/sbin/tlp auto' succeeded.
Sep 07 20:55:14 nixos (udev-worker)[44423]: BAT0: sd-device: Created database file '/run/udev/data/+power_supply:BAT0' for '/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:41/PNP0C09:00/PNP0C0A:00/power_supply/BAT0'.
Sep 07 20:55:14 nixos (udev-worker)[44423]: BAT0: Device processed (SEQNUM=5074, ACTION=change)
Sep 07 20:55:14 nixos (udev-worker)[44423]: BAT0: sd-device-monitor(worker): Passed 917 byte to netlink monitor.
Sep 07 20:55:14 nixos systemd-udevd[7780]: No events are queued, removed /run/udev/queue.
This causes a little more CPU usage, and the power draw is 2-3 watts more.
Now I think this is a bug in the BIOS, and I already reported it here: https://forums.lenovo.com/t5/Gaming-Laptops/Legion-15AKP10-linux/m-p/10000853
But I also wonder - maybe this is not the event that TLP should rely on to switch the profile? Because there is this one:
ACTION=="change", SUBSYSTEM=="power_supply", KERNEL=="ADP*", RUN+="<command>"
Which, correct me if I am wrong, does almost the same thing. It monitors whether the power adapter is on or off instead of monitoring the battery. It would solve my issue. Would it be a viable way to monitor changes to battery/ac?
Describe the solution you'd like
Replace this:
|
ACTION=="change", SUBSYSTEM=="power_supply", KERNEL!="hidpp_battery*", RUN+="@TLP_SBIN@/tlp auto" |
with this:
ACTION=="change", SUBSYSTEM=="power_supply", KERNEL=="ADP*", RUN+="@TLP_SBIN@/tlp auto"
Describe alternatives you've considered
My specific problem is probably solvable via a BIOS update. So this is kind of a suggestion/question to potentially improve TLP code as a consequence of my investigation.
Additional context
None
Is your feature request related to a problem? Please describe.
On a new Lenovo Legion 5 15AKP10 (AMD), sometimes the laptop will report battery status every 0.5 seconds with an ACPI event (
acpi_listen):Which as a consequence, will trigger a udev kernel event (
sudo udevadm monitor):I checked whether this triggers TLP, and indeed it does. Here's the output of
sudo udevadm control --log-priority=debugandsudo journalctl -fThis causes a little more CPU usage, and the power draw is 2-3 watts more.
Now I think this is a bug in the BIOS, and I already reported it here: https://forums.lenovo.com/t5/Gaming-Laptops/Legion-15AKP10-linux/m-p/10000853
But I also wonder - maybe this is not the event that TLP should rely on to switch the profile? Because there is this one:
Which, correct me if I am wrong, does almost the same thing. It monitors whether the power adapter is on or off instead of monitoring the battery. It would solve my issue. Would it be a viable way to monitor changes to battery/ac?
Describe the solution you'd like
Replace this:
TLP/tlp.rules.in
Line 7 in 46fe058
with this:
Describe alternatives you've considered
My specific problem is probably solvable via a BIOS update. So this is kind of a suggestion/question to potentially improve TLP code as a consequence of my investigation.
Additional context
None