-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpowersave
More file actions
54 lines (45 loc) · 1.47 KB
/
powersave
File metadata and controls
54 lines (45 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/bash
# reduce power usage in default configuration
# load dependencies
plugin_load systemctl || return 1
plugin_load config || return 1
plugin_load run || return 1
function rpi_powersave_prerun() {
true
}
function rpi_powersave_run() {
local disable_services=(
"avahi-daemon" "avahi-daemon.socket"
"triggerhappy"
"bluetooth" "hciuart" "bluetooth.target"
"dbus"
"keyboard-setup"
"cryptsetup.target"
"nfs-client.target"
"apt-daily-upgrade.timer" "apt-daily.timer" "man-db.timer"
"wpa_supplicant"
)
# prefix disable_services with "disable "
IFS=" "
RPI_SYSTEMCTL_CMDS="disable ${disable_services[*]}" plugin_run systemctl || error "disable ${_}"
# turn off unneeded things
export RPI_CONFIG_ADD=(
"dtparam=audio=off"
"disable_auto_turbo=1"
"dtoverlay=disable-bt"
"dtparam=i2c_arm=off"
"dtparam=i2s=off"
"dtparam=spi=off"
"start_x=0"
)
plugin_run config || error "config.txt modification"
# turn off HDMI
rpi_run_on_boot "# turn off HDMI" || error "run_on_boot"
rpi_run_on_boot "/usr/bin/tvservice -o" || error "run_on_boot"
# turn on USB power saving
rpi_run_on_boot "# usb power saving" || error "run_on_boot"
rpi_run_on_boot "echo 'auto' > '/sys/bus/usb/devices/usb1/power/control'" || error "run_on_boot"
}
function rpi_powersave_description() {
echo "configure image for optimized power usage"
}