Analyzing the DSDT DSL
By looking at the DSL file, we find the methods we are interested in:
Mutex (FAMX, 0x00)
Method (FANG, 1, NotSerialized)
{
Acquire (FAMX, 0xFFFF)
ERIB = Arg0
Local0 = ERBD /* \_SB_.PCI0.LPCB.EC0_.ERBD */
Release (FAMX)
Return (Local0)
}
Method (FANW, 2, NotSerialized)
{
Acquire (FAMX, 0xFFFF)
ERIB = Arg0
ERBD = Arg1
Release (FAMX)
Return (Arg1)
}
Finding the Arguments for the Read/Write Method
Since we already have a model that uses the FANG / FANW methods, we can reasonably assume that the argument required to read the fan speed is the same. This section does not explain how the argument for FANG / FANW was determined. Please refer to the documentation of Packard Bell EasyNote TK85 for a detailed explanation.
However, we see that sudo ec_probe acpi_call '\_SB_.PCI0.LPCB.EC0.FANG' 33026 reports the right fan speed,
but these commands do not alter the fan speed:
sudo ec_probe acpi_call '\_SB_.PCI0.LPCB.EC0.FANW' 33026 0sudo ec_probe acpi_call '\_SB_.PCI0.LPCB.EC0.FANW' 33026 100sudo ec_probe acpi_call '\_SB_.PCI0.LPCB.EC0.FANW' 33026 255
This indicates that FANW requires an additional control argument, likely enabling manual fan override mode before fan speed changes take effect.
Note: I already assumed that the needed argument is between 33000 and 34000.
This may not be the case for other models. You may change the seq 33000 34000 statement in the scripts to seq 0 65535
We create the following scripts:
- fandump.sh: For dumping the fan's state
- fanrestore.sh: For restoring the fan's state
- fansearch.sh: For searching the additional argument that sets the fan to manual mode
fandump.sh:
#!/bin/bash # This script dumps the fan state to STDOUT. # Format: <argument>=<value> # Usage: sudo ./fandump.sh > dump.txt for argument in $(seq 33000 34000); do value=$(ec_probe acpi_call '\_SB_.PCI0.LPCB.EC0.FANG' $argument) echo "$argument=$value" done
fanrestore.sh:
#!/bin/bash
# This script restores the fan state from STDIN.
# Format: <argument>=<value>
# Usage: sudo ./fanrestore.sh < dump.txt
while read -r line; do
argument="${line%=*}"
value="${line#*=}"
ec_probe acpi_call '\_SB_.PCI0.LPCB.EC0.FANW' $argument $value
echo "Restored $argument to $value"
done
fansearch.sh:
#!/bin/bash # This script searches for the argument that enables manual fan control. # For each argument the value 255 is written, then the fan speed is set to full speed (FANW 33026 255). # This script requires the user to hit enter after each try. # The old value of the argument is restored. # You may remove the read statement and replace it by sleep 1 if you don't want to hit enter each time. # If the fan speed changes, simply hit CTRL+C for argument in $(seq 33000 34000); do old_value=$(ec_probe acpi_call '\_SB_.PCI0.LPCB.EC0.FANG' $argument) echo "argument=$argument (old_value=$old_value)" ec_probe acpi_call '\_SB_.PCI0.LPCB.EC0.FANW' $argument 255 ec_probe acpi_call '\_SB_.PCI0.LPCB.EC0.FANW' 33026 255 read ec_probe acpi_call '\_SB_.PCI0.LPCB.EC0.FANW' $argument $old_value done
First, we make a dump of the fan's state: sudo ./fandump.sh > dump.txt
Then, we search for the right argument for FANW that enables manual fan control: sudo ./fansearch.sh.
The script requires the user to hit Enter after each try.
We can see that the argument 33030 enables manual fan control.
We then look up the original value of argument 33030 in dump.txt, which is 0x8. This will be used to reset the Embedded Controller on application exit to automatic fan control.
Writing the Configuration File
- \_SB_.PCI0.LPCB.EC0.FANG 33026 is the ReadAcpiMethod
- \_SB_.PCI0.LPCB.EC0.FANW 33026 $ is the WriteAcpiMethod
- \_SB_.PCI0.LPCB.EC0.FANW 33026 0xFF is the ResetAcpiMethod
- 0 is the MinSpeedValue
- 255 is the MaxSpeedValue
Because argument 33030 must be set via FANW, an additional RegisterWriteConfigurations entry is required:
- \_SB_.PCI0.LPCB.EC0.FANW 33030 0xFF is the AcpiMethod (and WriteMode has to be set to Call).
- \_SB_.PCI0.LPCB.EC0.FANW 33030 0x8 is the ResetAcpiMethod (and ResetWriteMode has to be set to Call + ResetRequired has to be set to true)
See the configuration file on GitHub