Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
fan control using hub-ctrl
#/bin/sh
# $ sudo chown root:$USER hub-ctrl
# $ sudo chmod +s hub-ctrl
usage() {
echo "Usage: $0 (on|off)"
exit 2;
}
if [ $# -ne 1 ]; then
usage
fi
fanctrl() {
power=$1
device=0409:005a
args=$(lsusb -d $device | grep -Po '\d+' | paste -sd ' ' | cut -d ' ' -f 1,2 | xargs printf "-b %s -d %s")
~/bin/hub-ctrl $args -P 1 -p $power
}
case $1 in
on ) fanctrl 1;;
off ) fanctrl 0;;
* ) usage
exit 2;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment