Linux mint 18 vs fan speed Xiaomi mi notebook air 13

Questions about hardware, drivers and peripherals
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
4chinaski

Linux mint 18 vs fan speed Xiaomi mi notebook air 13

Post by 4chinaski »

Hi all,
I've got Xiaomi mi notebook air 13 and installed Linux mint 18 on it.
On simple web-surfing, it is quite loud due to high fan speed. How can I tune it? I've already tried https://wiki.archlinux.org/index.php/fan_speed_control
but just got on the first steps:

alexey@till ~ $ sensors
iwlwifi-virtual-0
Adapter: Virtual device
temp1: +32.0°C

acpitz-virtual-0
Adapter: Virtual device
temp1: +45.0°C (crit = +99.0°C)
temp2: +35.0°C (crit = +92.0°C)

coretemp-isa-0000
Adapter: ISA adapter
Package id 0: +47.0°C (high = +100.0°C, crit = +100.0°C)
Core 0: +43.0°C (high = +100.0°C, crit = +100.0°C)
Core 1: +44.0°C (high = +100.0°C, crit = +100.0°C)

alexey@till ~ $ sudo sensors -s
Error: File /etc/sensors.d/fan-speed-control.conf, line 2: Unknown feature name
coretemp-isa-0000: No such subfeature known
alexey@till ~ $
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
4chinaski

Re: Linux mint 18 vs fan speed Xiaomi mi notebook air 13

Post by 4chinaski »

Solution found!
Sensors wouldn't work as FAN is not controlled through ACPI. So we need to manage it with registries of Embedded Controller.
There is a good script to do it written for Acers, just add your BIOS name to file acers3fand like it has done for Acer BIOSes. You can find it with command "sudo dmidecode -s bios-version"
Thenscript for Acer laptops is here:
https://github.com/enyone/acers3fand

Some useful links:
http://forum.notebookreview.com/threads ... st-7260497
https://toster.ru/user/pkkk
gillesbroes

Re: Linux mint 18 vs fan speed Xiaomi mi notebook air 13

Post by gillesbroes »

Hi 4chinaski!

Did you get this working yourself? For the xiaomi air 2017 model or a different one?
I can´t get it to work, but would really like to since the loud fan is killing me! :| :| :|

If you read this, could you please let me know what exactly you did to get it working?

Thanks a lot!
4chinaski

Re: Linux mint 18 vs fan speed Xiaomi mi notebook air 13

Post by 4chinaski »

Hi,
yes I got it for my Xiaomi 2017:
Below some dmidecode information of my laptop.
Handle 0x0000, DMI type 0, 24 bytes
BIOS Information
Vendor: Insyde Corp.
Version: XMAKB3M0P0907
Release Date: 10/16/2017
System Information
Manufacturer: Timi
Product Name: TM1604
Version: XMAKB3M0P0907

And I've done it with acers3fand script
gillesbroes

Re: Linux mint 18 vs fan speed Xiaomi mi notebook air 13

Post by gillesbroes »

4chinaski wrote: Sun Jun 24, 2018 2:16 pm Hi,
yes I got it for my Xiaomi 2017:
Below some dmidecode information of my laptop.
Handle 0x0000, DMI type 0, 24 bytes
BIOS Information
Vendor: Insyde Corp.
Version: XMAKB3M0P0907
Release Date: 10/16/2017
System Information
Manufacturer: Timi
Product Name: TM1604
Version: XMAKB3M0P0907

And I've done it with acers3fand script
I seem to have the exact same dmidecode information.
Would you mind sharing the modifications you made to the script to make it work?
I can't figure out what you mean by add your bios to the file.

Made you can share the modified script with me?

Thanks a lot!

Gilles
4chinaski

Re: Linux mint 18 vs fan speed Xiaomi mi notebook air 13

Post by 4chinaski »

Hi,
please find my version of the script below. I also configured run of this script at startup.

cat /usr/local/bin/acers3fand
#!/bin/bash
#
# acers3fand - Rudimentary automatic fan control for noisy Acer Aspire S3 models
#
# Orginal author Rachel Greenham (for Acer Aspire One, ported from 0.07)
# Author Juho Tykkälä from Enymind Oy (for S3)
#
ACERS3FAND_VERSION="0.04"
# version 0.04 (2013-01-16)
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the
# Enymind Oy, Ahdinkatu 26, 40700 Jyväskylä, Finland
#
# Feel free to send any confirmations of working or not with your hardware.
# mail: enyone@enymind.fi
#
# To modify the parameters, create a file /etc/acers3fand.conf and add
# these 6 lines into it:
#
# INTERVAL=5 # temperature poll interval in seconds
# STARTTEMP=50 # temperature in C to start fan
# MAXTEMP=65 # temperature in C to spin fan at max. speed
# STARTRPM=99 # value (0-99) as lowest RPM you like (0 max. vs. 99 min.)
# MAXRPM=0 # value (0-99) as highest RPM you like (0 max. vs. 99 min.)
# RAMPUP=5 # increase this much RPM per. one degree C increase
#

LOGGER=$(which logger)
if [ ! -x $LOGGER ] ; then
LOGGER="/usr/bin/logger"
fi
if [ ! -x $LOGGER ] ; then
echo "Warning, logger can't be found. Will log to stdout"
unset LOGGER
fi

LOGLEVEL="info"

log() {
if [ ! -z "$LOGGER" ] ; then
$LOGGER -p daemon.$LOGLEVEL -t acers3fand "$@"
else
echo "$@"
fi
}

info() {
LOGLEVEL="info"
log "$@"
}

notice() {
LOGLEVEL="notice"
log "$@"
}

err() {
LOGLEVEL="err"
log "$@"
}

info "acers3fand $ACERS3FAND_VERSION starting"

# if pgrep acers3fand | grep -v $$ > /dev/null; then
# info "acers3fand already running"
# exit 0
# fi

ME=$(readlink -f $0)

BIOS_VERSION_115="1.15"
BIOS_VERSION_116="1.16"
BIOS_VERSION_118="1.18"
BIOS_VERSION_121="V1.21"
BIOS_VERSION_209="V2.09"
BIOS_VERSION_XIAOMI="XMAKB3M0P0907"
BIOS_VERSION=$BIOS_VERSION_XIAOMI

BIOS_VERSION_DEFAULT=$BIOS_VERSION_XIAOMI

#getBiosVersion() {
# DMIDECODE=$(which dmidecode)
# if [ -z $DMIDECODE ] ; then
# info "Can't find dmidecode. Assuming bios $BIOS_VERSION_DEFAULT"
# BIOS_VERSION=$BIOS_VERSION_DEFAULT
# else
# BIOS_VERSION=$($DMIDECODE -s bios-version)
# info "Detected bios version $BIOS_VERSION"
# fi
#
#}

ACEREC=$(which acer_ec.pl)
if [ -z $ACEREC ] ; then
ACEREC=$(dirname $ME)/acer_ec.pl
fi

if [ ! -r $ACEREC ] ; then
err "acer_ec.pl can't be found"
exit 1
fi

INTERVAL=15
STARTTEMP=65
MAXTEMP=75
STARTRPM=99
MAXRPM=0
RAMPUP=5

#getBiosVersion

if [ -r "/etc/acers3fand.conf" ] ; then
source "/etc/acers3fand.conf"
fi

case "$BIOS_VERSION" in
"${BIOS_VERSION_XIAOMI}")
R_FAN="0x93"
R_SPEED="0x94"
R_TEMP="0xA8"
FAN_CMD_MANUAL="0x14"
FAN_CMD_AUTO="0x04"
;;
"${BIOS_VERSION_116}")
R_FAN="0x93"
R_SPEED="0x94"
R_TEMP="0xA8"
FAN_CMD_MANUAL="0x14"
FAN_CMD_AUTO="0x04"
;;
"${BIOS_VERSION_118}")
R_FAN="0x93"
R_SPEED="0x94"
R_TEMP="0xA8"
FAN_CMD_MANUAL="0x14"
FAN_CMD_AUTO="0x04"
;;
"${BIOS_VERSION_121}")
R_FAN="0x93"
R_SPEED="0x94"
R_TEMP="0xA8"
FAN_CMD_MANUAL="0x14"
FAN_CMD_AUTO="0x04"
;;
"${BIOS_VERSION_209}")
R_FAN="0x93"
R_SPEED="0x94"
R_TEMP="0xA8"
FAN_CMD_MANUAL="0x14"
FAN_CMD_AUTO="0x04"
;;
*)
err "Unsupported bios version ${BIOS_VERSION} found. Aborting."
exit 1
;;
esac

FAN_STATE_UNRECOGNIZED=0
FAN_STATE_AUTO=1
FAN_STATE_MANUAL=2
FAN_STATE_NAMES=("Unrecognized" "Auto" "Manual")
FAN_STATE_CMDS=("$FAN_CMD_MANUAL" "$FAN_CMD_AUTO" "$FAN_CMD_MANUAL")

acer_ec() {
perl $ACEREC $@
}

getTemp() {
TEMP=$[$(acer_ec ?= $R_TEMP | cut -f 3 -d' ')]
notice "temp: $TEMP"
}

getRawFanState() {
RAW_FAN_STATE=$(acer_ec ?= $R_FAN | cut -f 3 -d' ')
}

getFanState() {
FAN_STATE=$FAN_STATE_UNRECOGNIZED
getRawFanState
if [ "$RAW_FAN_STATE" == "$FAN_CMD_MANUAL" ]; then
FAN_STATE=$FAN_STATE_MANUAL
else
let A="$RAW_FAN_STATE & 0x10" || true
if [ "$A == 0" ] ; then
# ASSUMPTION: All values with nybble 1==0 denote auto
FAN_STATE=$FAN_STATE_AUTO
fi
fi
notice "read fan state ${FAN_STATE_NAMES[$FAN_STATE]}"
}

setFan() {
notice "Set fan ${FAN_STATE_NAMES[$1]}"
acer_ec := $R_FAN ${FAN_STATE_CMDS[$1]} > /dev/null
}

setSpeed() {
notice "Set speed $1"
acer_ec := $R_SPEED $1 > /dev/null
}

govern() {
trap "info exiting;setFan $FAN_STATE_AUTO; exit" INT TERM EXIT
info "Starting to govern acer fan speed. Interval: $INTERVAL, start-temp: $STARTTEMP, max-temp: $MAXTEMP, start-rpm: $STARTRPM, max-rpm: $MAXRPM, ramp-up: $RAMPUP"
setFan $FAN_STATE_MANUAL
while true; do
getTemp
setFan $FAN_STATE_MANUAL
getFanState
notice "Raw fan state: $RAW_FAN_STATE, fan state: ${FAN_STATE_NAMES[$FAN_STATE]}, temp: $TEMP"
case "$FAN_STATE" in
$FAN_STATE_AUTO)
err "Somebody (maybe kernel) set fan to mode AUTO. Not me... Not fatal, but stuppid."
setFan $FAN_STATE_MANUAL
;;
$FAN_STATE_MANUAL)
if [ "$TEMP" -le "$STARTTEMP" ] ; then
setSpeed 0xFF
else
if [ "$TEMP" -ge "$MAXTEMP" ] ; then
setSpeed $MAXRPM
else
B=$[ $STARTRPM - $[ $[ $TEMP - $STARTTEMP ] * $RAMPUP ] ]
setSpeed $B
fi
fi
;;
*)
# weird state. Let's turn it off,
# then decide next time around
info "Unexpected fan state $FAN_STATE"
setFan $FAN_STATE_AUTO
;;
esac
sleep $INTERVAL
done
}

set -e

govern &
Locked

Return to “Hardware Support”