ENABLE_LAPTOP_MODE=trueThen I started configuring the file /etc/laptop-mode/laptop-mode.conf and all the files in /etc/laptop-mode/conf.d/. There are many different options for various energy savings for various hardware, fortunately the files are well documented and everything is clear.
Enabling laptop mode when lid is closed
What I wanted in my configuration was to enable some settings when laptop lid is closed. When I close the lid I mean that the laptop is doing nothing or something not important and don't need its full power. Especially I wanted to slow down CPU in order to make it quiet even when some background tasks are being done. I found and configured correctly the file: /etc/laptop-mode/conf.d/cpufreq.conf configuring:
Then I edited again main configuration file /etc/laptop-mode/laptop-mode.conf:CONTROL_CPU_FREQUENCY=1LM_AC_CPU_GOVERNOR=powersave
To my surprise it didn't work.ENABLE_LAPTOP_MODE_WHEN_LID_CLOSED=1
Solving issue with lid closing detection
The laptop mode tools didn't react on lid close. In order to workaround this problem I edited ACPI scrpit: /etc/acpi/lid.sh adding following lines before [if [ `CheckPolicy` = 0 ]; then exit; fi] line
# pziemniak: enable laptop_modeIn the code I just enable the laptop mode when lid is closed and disable when opened. Laptop_mode shouldn't be normally (by end user) executed this way but following the documentation it is allowed to call it from some handlers and scripts.
grep -q closed /proc/acpi/button/lid/*/state
if [ $? = 0 ]
then
laptop_mode start
else
laptop_mode auto
fi
# pziemniak: enable laptop_mode end
There might be some better solution where to put this code but I didn't have time to look for it. I also wanted to distinguish it in the file in order to prevent accidental overrides.
No comments:
Post a Comment