ACPILID(4)
π ACPILID(4) β the Kernel Interfaces Manual girlies' edition π
okay so this page lives in the Kernel Interfaces Manual section, and it's all about acpilid β the ACPI Lid Switch driver, aka the little guy who knows when you close your laptop π
β¨ NAME β¨
acpilid β ACPI Lid Switch. that's it, that's the name, she's literally the lid-switch driver π
πΈ SYNOPSIS πΈ
acpilid* at acpi?
yes bestie, that's the whole config line. she attaches at acpi?, periodt β¨
π¦ DESCRIPTION π¦
okay so the acpilid driver is the one that supports ACPI "lid switches" β like, the physical lid of your laptop, the thing you flip open and shut fifty times a day without thinking about it π
you can hook the powerd(8) daemon up to it so it does stuff when the lid opens or closes. the script it runs is /etc/powerd/scripts/lid_switch, and the events it can fire are:
pressedβ the lid was closed π«₯releasedβ the lid was opened π«Ά
that's the whole vibe check. two events, one script, infinite dramatic potential π
π EXAMPLES π
the following example modifies the mentioned script in order to put the system into (S3) sleep when the lid is closed β truly the main character move of power management π
...
case "${2}" in
pressed)
logger -p info "${0}: suspending..."
# As in sleep_button, kill some daemons.
#
/etc/rc.d/dhcpcd stop
/etc/rc.d/network stop
/etc/rc.d/wpa_supplicant stop
# Suspend.
#
if /sbin/sysctl hw.acpi.sleep.state >/dev/null 2>&1; then
/sbin/sysctl -w hw.acpi.sleep.state=3
fi
# Waking up.
#
/etc/rc.d/wpa_supplicant start
/etc/rc.d/network start
/etc/rc.d/dhcpcd start
...
ngl this snippet ate π
it kills the daemons, checks hw.acpi.sleep.state exists with /sbin/sysctl hw.acpi.sleep.state >/dev/null 2>&1, sets /sbin/sysctl -w hw.acpi.sleep.state=3, then brings everything back up on the way out π₯
π₯ SEE ALSO π₯
go read those too bestie, iykyk πβ¨
π HISTORY π
the acpilid driver appeared in NetBSD 1.6 β she's been iconic since day one, no cap π
π and that's the page! sourced from Debian, dated January 9, 2011 β go close your lid, she's got it from here π«Άπ¦π
π¦ where this page comes from
- nixpkgs unstable: netbsd-source 11.0
- Copyright (c) 2002, 2004 The NetBSD Foundation, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms