95.15. tlp-1.10.2
Laptop power saving — pure shell over /sys, no daemon
1.10.2-2 · GPL-2.0-or-later AND GPL-3.0-only · 0.1 SBU · 769.7 KiB, 89 files · 41_system, 655 of 1047 · ports/core/hardware/tlp
Homepage: https://linrunner.de/tlp
Why it is in KDOS. The comment above it in script/phases/41_system/packages.d/hardware.txt:
Laptop power saving: pure shell over /sys, no daemon, no compile. Conflicts with power-profiles-daemon (both write the same knobs) — KDOS picks TLP.
TLP is laptop power management written in shell: at boot, on every change between mains and battery, and around suspend, it writes the settings in /etc/tlp.conf and /etc/tlp.d/ into /sys — CPU and platform profiles, disk and PCIe power management, USB autosuspend, radio switching and battery charge thresholds. It is not a daemon; 55_tlp.sh runs it once at boot and its udev rules run it on every power-source change. tlp-rdw switches radios when a cable or dock is connected, through a NetworkManager dispatcher script.
The power profiles Plasma shows are served by tlp-pd, a second build of this source that maps each profile to tlp power-saver, tlp balanced or tlp performance.
Depends on: bash, perl, elogind, networkmanager, ethtool, hdparm, iw, pciutils, usbutils.
Required by (1): tlp-pd.
Sources: tlp-1.10.2.tar.gz (213.5 KiB). Every step kpkg takes applies to this port.
Install: script/chroot/exec.sh bash -c 'source script/phases/41_system/phase.env && kpkg install tlp'
build.sh:
make TLP_WITH_SYSTEMD=0 TLP_WITH_ELOGIND=1 TLP_SBIN=/usr/sbin TLP_BIN=/usr/bin \
TLP_TLIB=/usr/share/tlp TLP_ULIB=/usr/lib/udev TLP_CONFDIR=/etc/tlp.d \
TLP_CONFDEF=/usr/share/tlp/defaults.conf TLP_ELOD=/usr/lib/elogind/system-sleep
make TLP_WITH_SYSTEMD=0 TLP_WITH_ELOGIND=1 TLP_SBIN=/usr/sbin TLP_BIN=/usr/bin \
TLP_TLIB=/usr/share/tlp TLP_ULIB=/usr/lib/udev TLP_CONFDIR=/etc/tlp.d \
TLP_CONFDEF=/usr/share/tlp/defaults.conf TLP_ELOD=/usr/lib/elogind/system-sleep TLP_NO_INIT=1 \
DESTDIR=$PKG install-tlp install-man-tlp install-rdw install-man-rdw
TLP_WITH_SYSTEMD=0— Install no systemd unit and no systemd sleep hook.TLP_WITH_ELOGIND=1— Install49-tlp-sleepintoTLP_ELOD, the directory of hooks elogind runs before and after a suspend. It runstlp suspendandtlp resume, which save and restore the radios’ state and reapply the settings for the power source the machine wakes on. Without it, a resume on the other power source keeps the profile it went to sleep with.TLP_ELOD=/usr/lib/elogind/system-sleep— elogind’s hook directory,system-sleepunder thelibexecdirits recipe sets. Named although it is TLP’s default, so the two recipes are seen to agree.TLP_NO_INIT=1— Install no SysV/etc/init.d/tlp; KDOS’s own55_tlp.shruns TLP at boot.TLP_SBIN=/usr/sbin— WithTLP_BIN,TLP_TLIB,TLP_ULIB,TLP_CONFDIRandTLP_CONFDEF: TLP’s install paths, given on bothmakelines because the first substitutes them into the scripts and the second installs to them.
Programs: bluetooth, nfc, run-on-ac, run-on-bat, tlp, tlp-rdw, tlp-stat, wifi, wwan.
Directories: /etc/tlp.d, /usr/share/licenses/tlp, /usr/share/tlp, /var/lib/tlp.
The targets install-tlp and install-rdw with their manual pages are the whole package. install-pd is left to tlp-pd, which needs Python’s GObject bindings from a later phase; both recipes carry group = tlp, so the version checker offers them as one bump.
The sleep hook runs after NetworkManager has taken its devices down and before it brings them back: elogind emits PrepareForSleep(true), waits for the delay inhibitor NetworkManager holds (it is built -Dsuspend_resume=elogind), runs the pre hooks and suspends, then runs the post hooks before PrepareForSleep(false) wakes NetworkManager, so the radios TLP restores are back before NetworkManager rescans. A hook cannot stop a suspend; one that fails is a hook that did not run.
Charge thresholds have two possible owners on a Plasma desktop, TLP and PowerDevil’s battery page; on KDOS TLP owns them. /etc/polkit-1/rules.d/50-kdos.rules refuses PowerDevil’s two threshold writes to everyone, because TLP sets the thresholds from /etc/tlp.d at boot and on every profile change and would overwrite a limit set on the battery page. To change a threshold, set it in /etc/tlp.d.