User Tools

Site Tools


linux:notes:laptop_power_udev

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
linux:notes:laptop_power_udev [2024/08/13 18:45] – external edit 127.0.0.1linux:notes:laptop_power_udev [2024/10/06 17:54] (current) – removed Sean Rhone
Line 1: Line 1:
-====== Laptop Power Management ====== 
- 
-===== Testing ===== 
- 
-  * The following commands can be ran to see if they work on specific hardware 
- 
-  watch -n 0.5 grep \'cpu MHz\' '/proc/cpuinfo' 
- 
-  sudo x86_energy_perf_policy --all 'performance' --turbo-enable '1' --force 
- 
-  sudo x86_energy_perf_policy --all 'power' --turbo-enable '0' --force 
- 
-====== Dependencies ====== 
- 
-**** 
- 
-  sudo dnf install 'kernel-tools' 
- 
-====== Scripts ====== 
- 
-===== AC ===== 
- 
-  * Change the ''backlight'' sysfs as-needed (see [[#backlight1|backlight notes]]) or remove altogether 
- 
-  sudo mkdir -p '/etc/udev/scripts.d' && sudo -e '/etc/udev/scripts.d/ac-power.sh' && sudo chmod +x '/etc/udev/scripts.d/ac-power.sh' 
- 
-<code> 
-#!/bin/bash 
-# AC 
-echo "$(cat '/sys/class/backlight/'*'/max_brightness')" | tee '/sys/class/backlight/'*'/brightness' > '/dev/null' 
-x86_energy_perf_policy --all 'performance' --turbo-enable '1' --force 
-# End</code> 
- 
-===== Battery ===== 
- 
-  * Change the ''backlight'' sysfs as-needed (see [[distros:fedora_workstation_gnome#backlight|Backlight notes]]) or remove altogether 
- 
-  sudo mkdir -p '/etc/udev/scripts.d' && sudo -e '/etc/udev/scripts.d/battery-power.sh' && sudo chmod +x '/etc/udev/scripts.d/battery-power.sh' 
- 
-<code> 
-#!/bin/bash 
-# Battery 
-echo '60600' | tee '/sys/class/backlight/'*'/brightness' > '/dev/null' 
-x86_energy_perf_policy --all 'balance-power' --turbo-enable '0' --force 
-# End</code> 
- 
-===== udev Rule ===== 
- 
-  * Requires the above AC and Battery scripts 
- 
-  sudo -e '/etc/udev/rules.d/99-power.rules' && sudo udevadm control --reload 
- 
-<code> 
-SUBSYSTEM=="power_supply", ATTR{online}=="1", RUN+="/etc/udev/scripts.d/ac-power.sh" 
-SUBSYSTEM=="power_supply", ATTR{online}=="0", RUN+="/etc/udev/scripts.d/battery-power.sh"</code> 
  
/srv/www/wiki/data/attic/linux/notes/laptop_power_udev.1723589126.txt.gz · Last modified: by 127.0.0.1