system settings
git clone https://git.lucas.co/cce-system-interface.git
cce-power-apply-sleep.service (1.1K)
1 [Unit]
2 Description=Lower PCIe power management to its deepest before sleeping
3 Documentation=file:/etc/cce/power.kdl
4 # The mode a suspend begins under stays in force until the machine wakes:
5 # user space is frozen, so an unplug while asleep reaches no udev rule and
6 # no cce-power-apply run. A suspend begun on AC therefore slept under the
7 # AC mode's `aspm "performance"`, which keeps the PCIe links out of L1
8 # substates and the package out of S0ix -- this machine has only s2idle --
9 # and on 2026-10-03 a full battery was empty within 34 hours of closing the
10 # lid. `cce-power-apply sleep` drops ASPM to powersupersave first;
11 # cce-power-apply-resume.service puts the running mode's value back.
12 #
13 # Wanted by and ordered before sleep.target, which every sleep verb pulls in
14 # ahead of its systemd-*.service, so the oneshot finishes before user space
15 # is frozen. Like the resume unit it does nothing until enabled, which
16 # X-CceEnable tells `ccebuild install-system` to do (systemd ignores X- keys).
17 Before=sleep.target
18 ConditionPathExists=/etc/cce/power.kdl
19
20 [Service]
21 Type=oneshot
22 ExecStart=/usr/bin/cce-power-apply sleep
23
24 [Install]
25 WantedBy=sleep.target
26 X-CceEnable=yes