#!/bin/sh # # Script to control the fans on the xtm5. # The W83792G is accessed via the smbus @0x5e. # # SteveW 20/11/2019 # # Variables smb_dev="/dev/null" #fan_speed=0 #start_speed=96 minimum_speed=0x85 #maximum_speed=255 interval=2 hysteresis=1 ramp_rate=2 target_temp=0x32 verbose=true #coretemp=0 # Load required modules if they are not loaded for mod in ichsmb smb coretemp; do kldstat | grep " $mod.ko" > /dev/null if [ $? -eq 1 ] then kldload $mod $verbose && echo "$mod loaded" else $verbose && echo "$mod already loaded" fi done # Test we can "see" the fan controller on the smbus if [ "$(smbmsg -f /dev/smb0 -s 0x5e -c 0x58 -i 1)" = 0x7a ] then smb_dev="/dev/smb0" $verbose && echo "Found W83792G on $smb_dev" else if [ "$(smbmsg -f /dev/smb1 -s 0x5e -c 0x58 -i 1)" = 0x7a ] then smb_dev="/dev/smb1" $verbose && echo "Found W83792G on $smb_dev" else echo "W83792G not found" exit 1 fi fi # Set minimum fan speed smbmsg -f $smb_dev -s 0x5e -c 0x88 -o 1 $minimum_speed $verbose && echo "Minimum fan speed set to $minimum_speed" # Set target temperature smbmsg -f $smb_dev -s 0x5e -c 0x85 -o 1 $target_temp $verbose && echo "Target temperature set to $target_temp" # Set step_down and step_up values smbmsg -f $smb_dev -s 0x5e -c 0x8e -o 1 0x1e smbmsg -f $smb_dev -s 0x5e -c 0x8f -o 1 0x14 $verbose && echo "Ser ramp rates" # Set system fan to 68 /root/WGXepc64 -f2 68