usr/lib/byobu/fan_speed: add support for /proc/i8k for some other

systems' fan speeds (e.g. Dell Inspiron), LP: #700204
This commit is contained in:
Dustin Kirkland 2011-01-27 09:55:33 -06:00
commit 1c9db76c01
2 changed files with 20 additions and 1 deletions

2
debian/changelog vendored
View file

@ -15,6 +15,8 @@ byobu (3.26) unreleased; urgency=low
[ Dustin Kirkland + swalker <sdwalker@myrealbox.com> ] [ Dustin Kirkland + swalker <sdwalker@myrealbox.com> ]
* usr/lib/byobu/wifi_quality: avoid potential divide by zero error * usr/lib/byobu/wifi_quality: avoid potential divide by zero error
* usr/lib/byobu/fan_speed: add support for /proc/i8k for some other
systems' fan speeds (e.g. Dell Inspiron), LP: #700204
-- Dustin Kirkland <kirkland@ubuntu.com> Sun, 23 Jan 2011 16:28:45 -0600 -- Dustin Kirkland <kirkland@ubuntu.com> Sun, 23 Jan 2011 16:28:45 -0600

View file

@ -23,13 +23,16 @@ color 2>/dev/null || color() { true; }
DIR="/sys/class/hwmon" DIR="/sys/class/hwmon"
if [ "$1" = "--detail" ]; then if [ "$1" = "--detail" ]; then
for i in $DIR/*; do for i in $DIR/* /proc/i8k; do
echo "$i:" echo "$i:"
cat "$DIR/$i"/* 2>/dev/null cat "$DIR/$i"/* 2>/dev/null
done done
exit 0 exit 0
fi fi
# Let's check a few different probes for fan speed
# This seems to cover most of them:
for i in $(find $DIR/*/*/ -type f -name "fan1_input"); do for i in $(find $DIR/*/*/ -type f -name "fan1_input"); do
speed=$(cat "$i") speed=$(cat "$i")
if [ "$speed" -gt 0 ]; then if [ "$speed" -gt 0 ]; then
@ -37,3 +40,17 @@ for i in $(find $DIR/*/*/ -type f -name "fan1_input"); do
exit 0 exit 0
fi fi
done done
# But others (e.g. Dell Inspirons) seem to be here:
if [ -r /proc/i8k ]; then
for speed in $(awk '{ print $7, $8 }' /proc/i8k); do
if [ "$speed" -gt 0 ]; then
# I8K_FAN_MULT defaults to 30 (buggy BIOS workaround?),
# use `modprobe i8k fan_mult=1` to disable if unneeded,
# resulting in nonsensical speeds
[ "$speed" -gt 10000 ] && speed=$((${speed} / 30))
printf "$(color bold1)%s$(color -)$(color none)%s$(color -) " "$speed" "rpm"
exit 0
fi
done
fi