Path: blob/next/external/cache/sources/raspi-config/debian/raspi-config.init
13271 views
#!/bin/sh1### BEGIN INIT INFO2# Provides: raspi-config3# Required-Start: udev mountkernfs $remote_fs4# Required-Stop:5# Default-Start: S 2 3 4 56# Default-Stop:7# Short-Description: Switch to ondemand cpu governor (unless shift key is pressed)8# Description:9### END INIT INFO1011. /lib/lsb/init-functions1213if [ -f /etc/default/cpu_governor ]; then14. /etc/default/cpu_governor15fi1617CPU_DEFAULT_GOVERNOR="${CPU_DEFAULT_GOVERNOR:-ondemand}"18CPU_ONDEMAND_UP_THRESHOLD="${CPU_ONDEMAND_UP_THRESHOLD:-50}"19CPU_ONDEMAND_SAMPLING_RATE="${CPU_ONDEMAND_SAMPLING_RATE:-100000}"20CPU_ONDEMAND_DOWN_SAMPLING_FACTOR="${CPU_ONDEMAND_DOWN_SAMPLING_FACTOR:-50}"21CPU_ONDEMAND_INCLUDE_IO_CALC="${CPU_ONDEMAND_INCLUDE_IO_CALC:-0}"2223case "$1" in24start)25log_daemon_msg "Checking if shift key is held down"26if [ -x /usr/sbin/thd ] && timeout 1 thd --dump /dev/input/event* | grep -q "LEFTSHIFT\|RIGHTSHIFT"; then27printf " Yes. Not enabling $CPU_DEFAULT_GOVERNOR scaling governor"28log_end_msg 029else30printf " No. Switching to $CPU_DEFAULT_GOVERNOR scaling governor"31SYS_CPUFREQ_GOVERNOR=/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor32if [ -e $SYS_CPUFREQ_GOVERNOR ]; then33for cpu_core in /sys/devices/system/cpu/cpu?/cpufreq/scaling_governor ; do34echo "$CPU_DEFAULT_GOVERNOR" > $cpu_core35done36if [ "$CPU_DEFAULT_GOVERNOR" = "ondemand" ]; then37echo "$CPU_ONDEMAND_UP_THRESHOLD" > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold38echo "$CPU_ONDEMAND_SAMPLING_RATE" > /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate39echo "$CPU_ONDEMAND_DOWN_SAMPLING_FACTOR" > /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor40echo "$CPU_ONDEMAND_INCLUDE_IO_CALC" > /sys/devices/system/cpu/cpufreq/ondemand/io_is_busy41fi42fi43log_end_msg 044fi45;;46stop)47;;48restart)49;;50force-reload)51;;52*)53echo "Usage: $0 start" >&254exit 355;;56esac575859