Git Product home page Git Product logo

asus-ec-sensors's Introduction

asus-ec-sensors

Linux HWMON sensors driver for ASUS motherboards to read sensor data from the embedded controller

Many ASUS motherboards do not publish all the available sensors via the Super I/O chip but the missing ones are available through the embedded controller (EC) registers.

This driver (unlike the wmi-based one) reads sensor values directly from the EC using the ec kernel module. However, to ensure no race between this driver and the firmware, it locks the same mutex used by the WMI functions when accessing EC. This mutex has the same name (\AMW0.ASMX) for all ASUS boards author seen DSDT code from (a bit more then 10 models).

The EC registers do not provide critical values for the sensors and as such they are not published to the HWMON.

Supported motherboards

  1. Pro WS X570-ACE
  2. ROG CROSSHAIR VIII HERO
  3. ROG CROSSHAIR VIII HERO (WI-FI)
  4. ROG CROSSHAIR VIII DARK HERO
  5. ROG CROSSHAIR VIII FORMULA
  6. ROG STRIX B550-E GAMING
  7. ROG STRIX B550-I GAMING
  8. ROG STRIX X570-E GAMING
  9. ROG STRIX X570-F GAMING
  10. ROG STRIX X570-I GAMING

Adding a new motherboard

First, you need to obtain ACPI DSDT source for your board. You can get it from /sys/firmware/acpi/tables/DSDT in the binary form and decompile using the iasl tool from the acpica package:

$ sudo cat /sys/firmware/acpi/tables/DSDT > dsdt.dat
$ iasl dsdt.dat

This will produce decompiled file dsdt.dsl which you need to read and gather some information from it. Find a function named BREC. Its declaration starts with Method (BREC, 1. This is the WMI function to read EC registers ("Block Read EC" or something). If the function is a dummy one, like this:

Method (BREC, 1, Serialized)
{
       Return (Ones)
}

your motherboard probably does not publish any sensors in the EC. If the function contains meaningful code, read through it a bit. Not far from the beginning it should contain a command to lock a mutex. The command in the AML (the language of the ACPI code) is named Acquire and the instructions should look like If ((Acquire (ASMX, 0xFFFF) == Zero)). You need the name of the mutex, here it is "ASMX". Now find its declaration (Mutex (ASMX, 0x00)). It will be declared inside a scope, with the scope declaration looking as Device (<Device name>), find the closest one to the mutex declaration towards the top of the file. Now compose the full name of the mutex, which starts from the '' and then consists of device name(s) and the mutex name. In the example above the name is \AMW0.ASMX. If you get another name, write it down as you will need it later.

Now find out which EC registers to read (although they are pretty typical). If you have no idea is there any, you can try the hwinfo software under Windows that will show the EC node and known sensors for it. When you have the data (or decided to probe the default set), the following changes to the source code need to be made:

  1. Add your board vendor and name to the asus_ec_dmi_table array and a new enum value to the board enum. You can find the board vendor and the board name in /sys/class/dmi/id/board_vendor and /sys/class/dmi/id/board_name or using dmidecode.

  2. Add new entry to the known_boards array where list sensors for the board and the path for the ACPI mutex which is used by the firmware to lock access to the EC. You can find this path in the BREC function, look for Acquire() call near the top of the function.

Example: If ((Acquire (ASMX, 0xFFFF) == Zero)). The mutex name is ASMX, and since the BREC method is inside the AMW0 object, the mutex path is \AMW0.ASMX.

  1. If you discover new sensors, modify the known_ec_sensor enum and add it to the known_ec_sensors array. For each sensor you need to provide its size in bytes (for example, RPM counters span two single-byte registers), its bank index and register index within the bank. If the sensor spans two or more registers, provide the first one (the smaller number).

Compile and it should work.

asus-ec-sensors's People

Contributors

zeule avatar nickhu avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.