Generate fan level ranges
This commit is contained in:
parent
570b35fa02
commit
3e4477a333
@ -5,25 +5,41 @@ set -o pipefail
|
|||||||
main() {
|
main() {
|
||||||
if [[ -f "${1}" ]]; then
|
if [[ -f "${1}" ]]; then
|
||||||
exec 1>"${1}"
|
exec 1>"${1}"
|
||||||
|
shift
|
||||||
fi
|
fi
|
||||||
|
|
||||||
printf "# thinkfan-confgen created %s\n" "$(date -u)"
|
: "${THINKFAN_LOWER_BOUND:=30}"
|
||||||
|
: "${THINKFAN_STEP:=4}"
|
||||||
|
|
||||||
|
printf '# thinkfan-confgen created %s\n' "$(date -u)"
|
||||||
|
printf '# THINKFAN_LOWER_BOUND=%s\n' "${THINKFAN_LOWER_BOUND}"
|
||||||
|
printf '# THINKFAN_STEP=%s\n\n' "${THINKFAN_STEP}"
|
||||||
|
|
||||||
find /sys -type f -name 'temp*_input' | while read -r line; do
|
find /sys -type f -name 'temp*_input' | while read -r line; do
|
||||||
echo "hwmon ${line}"
|
printf 'hwmon %s\n' "${line}"
|
||||||
done
|
done
|
||||||
cat <<'EOF'
|
|
||||||
|
|
||||||
tp_fan /proc/acpi/ibm/fan
|
printf '\ntp_fan /proc/acpi/ibm/fan\n\n'
|
||||||
|
|
||||||
(0, 0, 43)
|
local halfstep="$((THINKFAN_STEP / 2))"
|
||||||
(1, 41, 46)
|
local cur="${THINKFAN_LOWER_BOUND}"
|
||||||
(2, 44, 49)
|
|
||||||
(3, 47, 52)
|
for level in 0 1 2 3 4 5 6 7; do
|
||||||
(4, 50, 55)
|
if [[ "${level}" == 0 ]]; then
|
||||||
(5, 53, 58)
|
printf '(0, 0, %s)\n' "${cur}"
|
||||||
(7, 56, 32767)
|
continue
|
||||||
EOF
|
fi
|
||||||
|
|
||||||
|
if [[ "${level}" == 7 ]]; then
|
||||||
|
printf '(7, %s, 32767)\n' "$((cur - halfstep))"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
printf '(%s, %s, %s)\n' \
|
||||||
|
"${level}" "$((cur - halfstep))" "$((cur + THINKFAN_STEP))"
|
||||||
|
|
||||||
|
cur="$((cur + THINKFAN_STEP))"
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
main "${@}"
|
main "${@}"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user