TongFang EC and WMI Stuff 298187ff605a4d20a09658bec918cbf9 - lhl/linuxlaptops GitHub Wiki
tonfang_wmi.h
https://github.com/tuxedocomputers/tuxedo-cc-wmi/blob/master/src/tongfang_wmi.h
#define UNIWILL_WMI_MGMT_GUID_BA "ABBC0F6D-8EA1-11D1-00A0-C90629100000"
#define UNIWILL_WMI_MGMT_GUID_BB "ABBC0F6E-8EA1-11D1-00A0-C90629100000"
#define UNIWILL_WMI_MGMT_GUID_BC "ABBC0F6F-8EA1-11D1-00A0-C90629100000"
#define UNIWILL_WMI_EVENT_GUID_0 "ABBC0F70-8EA1-11D1-00A0-C90629100000"
#define UNIWILL_WMI_EVENT_GUID_1 "ABBC0F71-8EA1-11D1-00A0-C90629100000"
#define UNIWILL_WMI_EVENT_GUID_2 "ABBC0F72-8EA1-11D1-00A0-C90629100000"
https://github.com/tuxedocomputers/tuxedo-cc-wmi/blob/master/src/tuxedo_cc_wmi_ioctl.h
#define IOCTL_MAGIC 0xEC
#define MAGIC_READ_UW IOCTL_MAGIC + 2
#define MAGIC_WRITE_UW IOCTL_MAGIC + 3
// General
#define R_MOD_VERSION _IOR(IOCTL_MAGIC, 0x00, char*)
#define R_HWCHECK_CL _IOR(IOCTL_MAGIC, 0x05, char*)
#define R_HWCHECK_UW _IOR(IOCTL_MAGIC, 0x06, char*)
// Read
#define R_UW_FANSPEED _IOR(MAGIC_READ_UW, 0x10, int32_t*)
#define R_UW_FAN_TEMP _IOR(MAGIC_READ_UW, 0x11, int32_t*)
#define R_UW_MODE _IOR(MAGIC_READ_UW, 0x12, int32_t*)
#define R_UW_MODE_ENABLE _IOR(MAGIC_READ_UW, 0x13, int32_t*)
// Write
#define W_UW_FANSPEED _IOW(MAGIC_WRITE_UW, 0x10, int32_t*)
#define W_UW_MODE _IOW(MAGIC_WRITE_UW, 0x11, int32_t*)
#define W_UW_MODE_ENABLE _IOW(MAGIC_WRITE_UW, 0x12, int32_t*)
Install the tuxedo-cc-wmi kernel module (if you haven't done so through the script) and make sure it's the latest version (0.1.4) which should expose a new /dev/tuxedo_cc_wmi device. To issue a ioctl from the command line you can use this tool (need to build yourself): https://github.com/jerome-pouiller/ioctl
Then run sudo ./ioctl /dev/tuxedo_cc_wmi 0x8008ee10|hexdump -C to query fan speed, use 0x8008ee11 for fan temperature. The constants come from https://github.com/tuxedocomputers/tuxedo-cc-wmi/blob/master/src/tuxedo_cc_wmi_ioctl.h, R_UW_FANSPEED and R_UW_FAN_TEMP. You will have to find out the interpretation of the resulting hex values yourself.
I don't have a Tongfang (yet), so it's somewhat of a wild guess but I just recently found out that I can fix the broken BIOS fan behavior of my super old Tuxedo/Clevo using Tuxedo Control Center after bearing with the noise (and inflicting it on coworkers) for almost 8 years... (I tried the other constants for the Clevo which gave some reasonable output, i.e. the first byte seems to be fan speed with 0 being off and 255 being full speed).
https://github.com/tuxedocomputers/tuxedo-cc-wmi/blob/master/src/tuxedo_cc_wmi.c
From control center:
https://github.com/tuxedocomputers/tuxedo-control-center/tree/master/src/native-lib
See also
https://github.com/tuxedocomputers/tuxedo-fan-control/blob/master/native/ec_access.cc
https://github.com/tuxedocomputers/tuxedo-fan-control/blob/master/src/common/ec_access.ts
https://github.com/tuxedocomputers/tuxedo-fan-control/blob/master/src/common/daemonworker.ts
https://github.com/tuxedocomputers/tuxedo-fan-control/blob/master/src/common/fanTable.ts
Writing a WMI driver (2010)
https://lwn.net/Articles/391230/
- Decompile DSDT from ACPI https://lwn.net/Articles/367630/
ACPI EC modes for Lenovo:
https://github.com/rizsotto/acpi_call
https://wiki.archlinux.org/index.php/Lenovo_IdeaPad_S540_13ARE#Tips_and_tricks
yay -S acpi_call-dkms
sudo modprobe acpi_call
Set it to Intelligent Cooling mode:
$ echo '\_SB.PCI0.LPC0.EC0.VPC0.DYTC 0x000FB001' | sudo tee /proc/acpi/call
Set it to Extreme Performance mode:
$ echo '\_SB.PCI0.LPC0.EC0.VPC0.DYTC 0x0012B001' | sudo tee /proc/acpi/call
Set it to Battery Saving mode:
$ echo '\_SB.PCI0.LPC0.EC0.VPC0.DYTC 0x0013B001' | sudo tee /proc/acpi/call
To verify your setting:
$ echo '\_SB.PCI0.LPC0.EC0.FCMO' | sudo tee /proc/acpi/call
$ sudo cat /proc/acpi/call | cut -d '' -f1
where 0x0 stands for Intelligent Cooling, 0x1 stands for Extreme Performance and 0x2 stands for Battery Saving.
https://github.com/hirschmann/nbfc/
http://forum.notebookreview.com/threads/fan-control-on-asus-prime-ux31-ux31a-ux32a-ux32vd.705656/
https://github.com/hirschmann/nbfc/wiki/EC-probing-tool
https://www.reddit.com/r/linux/comments/1yulkk/fancontrol_project_linux_on_asus_zenbooks_needs/
https://wiki.ubuntu.com/Kernel/Reference/WMI
https://github.com/iksaif/thinkpad-wmi
https://aps2.toshiba-tro.de/kb0/TSB3803HR0000R01_TOSHIBA_BIOS_WMI_Interface_Guide_-_13_Rev_1.1.pdf
https://wiki.archlinux.org/index.php/ACPI_modules
https://maidavale.org/projects/asus-wmi-sensors-driver-for-linux/