Code Monkey home page Code Monkey logo

asus_rog_ryujin-hwmon's Introduction

asus_rog_ryujin-hwmon

Hwmon Linux kernel driver for monitoring Asus ROG Ryujin AIO coolers

Overview

The following device(s) are supported by this driver:

  • ASUS ROG RYUJIN II 360, since kernel v6.9

It's very likely that 240 is supported as well, but no one has tested that yet.

Being a standard hwmon driver, it provides readings via sysfs, which are easily accessible through lm-sensors as usual.

Report offsets were initially taken from here.

Installation and usage

First, clone the repository by running:

git clone https://github.com/aleksamagicka/asus_rog_ryujin-hwmon.git

Then, compile it and insert it into the running kernel, replacing the existing instance (if needed):

make dev

You can then try running sensors and your device(s) should be listed there.

Setting fan speeds

Pump, embedded/internal fan and fans connected to the controller can be controlled. Find the appropriate entry under /sys/class/hwmon (you'll need root) and echo 0-255 values to pwm1, pwm2 or pwm3, respectively. For example:

echo 200 > /sys/class/hwmon/hwmonX/pwm1

where hwmonX will be the entry for your AIO. You can check that it's the one by looking up it's name:

cat /sys/class/hwmon/hwmonX/name

which should be rog_ryujin.

asus_rog_ryujin-hwmon's People

Contributors

aleksamagicka avatar

Watchers

 avatar Florian Freudiger avatar

asus_rog_ryujin-hwmon's Issues

Upstreaming this driver

The driver seems to be in good shape for a v1, and I'd like to send it in for inclusion in the kernel.

@FlorianFreudiger, at the very least I want to credit you in the patch for helping co-develop and test. If you want to (and I'd encourage it, since you have the device), I'll gladly add you as the author & maintainer of the driver (alongside myself). The full explanation of what a maintainer is can be found here.

In short, it means that you're someone who can be contacted about the code and can test changes. That said, hwmon drivers are very low maintenance once they get merged, and in my experience of having a much bigger driver in since August 2021, pretty much nothing happens after. And if nothing else, you get to grab a nitrokey :)

Are you interested? If not, I still want to credit you in the patch.

Cached data lookup extends cache

If data is up to date priv->updated shouldn't be updated

if (!time_after(jiffies, priv->updated + msecs_to_jiffies(STATUS_VALIDITY))) {
/* Data is up to date */
goto unlock_and_return;
}

unlock_and_return:
mutex_unlock(&priv->status_report_request_mutex);
if (ret < 0)
return ret;
priv->updated = jiffies;

LCD Display

Will there be a feature to change the LCD Display video?

Outdated values in cache after write

Not a big issue but if a program requests a status (e.g. coolant temperature) and adjusts duties because of that, the values for pump/fan speeds won't be updated for another 2 seconds.

If the delay is necessary this behaviour is fine.

pwm2 influences pwm1 and can cause both to get stuck

pwm1 can initially be set without a problem. But setting pwm2 after will also set pwm1 to 99% and will cause both to remain "stuck".

Testing

  1. Starting from zero:
# python3 -m liquidctl status
ASUS ROG RYUJIN II 360
├── Liquid temperature                  30.5  °C
├── Pump duty                              0  %
├── Pump speed                           900  rpm
├── Embedded Micro Fan duty                0  %
├── Embedded Micro Fan speed               0  rpm
├── AIO Fan Controller duty                0  %
├── AIO Fan Controller speed - Fan 1       0  rpm
├── AIO Fan Controller speed - Fan 2       0  rpm
├── AIO Fan Controller speed - Fan 3       0  rpm
└── AIO Fan Controller speed - Fan 4       0  rpm
  1. Setting pwm1 works great:
# echo 200 > /sys/class/hwmon/hwmon10/pwm1
# python3 -m liquidctl status
ASUS ROG RYUJIN II 360
├── Liquid temperature                  30.5  °C
├── Pump duty                             78  %
├── Pump speed                          2370  rpm
├── Embedded Micro Fan duty                0  %
├── Embedded Micro Fan speed               0  rpm
├── AIO Fan Controller duty                0  %
├── AIO Fan Controller speed - Fan 1       0  rpm
├── AIO Fan Controller speed - Fan 2       0  rpm
├── AIO Fan Controller speed - Fan 3       0  rpm
└── AIO Fan Controller speed - Fan 4       0  rpm

# echo 100 > /sys/class/hwmon/hwmon10/pwm1
# python3 -m liquidctl status
ASUS ROG RYUJIN II 360
├── Liquid temperature                  30.2  °C
├── Pump duty                             39  %
├── Pump speed                          1440  rpm
├── Embedded Micro Fan duty                0  %
├── Embedded Micro Fan speed               0  rpm
├── AIO Fan Controller duty                0  %
├── AIO Fan Controller speed - Fan 1       0  rpm
├── AIO Fan Controller speed - Fan 2       0  rpm
├── AIO Fan Controller speed - Fan 3       0  rpm
└── AIO Fan Controller speed - Fan 4       0  rpm
  1. Setting pwm2 also sets pwm1 to 99%
# echo 200 > /sys/class/hwmon/hwmon10/pwm2
# python3 -m liquidctl status
ASUS ROG RYUJIN II 360
├── Liquid temperature                  30.3  °C
├── Pump duty                             99  %
├── Pump speed                          2790  rpm
├── Embedded Micro Fan duty               78  %
├── Embedded Micro Fan speed            4350  rpm
├── AIO Fan Controller duty                0  %
├── AIO Fan Controller speed - Fan 1       0  rpm
├── AIO Fan Controller speed - Fan 2       0  rpm
├── AIO Fan Controller speed - Fan 3       0  rpm
└── AIO Fan Controller speed - Fan 4       0  rpm
  1. pwm1 and pwm2 now stuck:
# echo 150 > /sys/class/hwmon/hwmon10/pwm2
# python3 -m liquidctl status
ASUS ROG RYUJIN II 360
├── Liquid temperature                  30.3  °C
├── Pump duty                             99  %
├── Pump speed                          2760  rpm
├── Embedded Micro Fan duty               78  %
├── Embedded Micro Fan speed            4350  rpm
├── AIO Fan Controller duty                0  %
├── AIO Fan Controller speed - Fan 1       0  rpm
├── AIO Fan Controller speed - Fan 2       0  rpm
├── AIO Fan Controller speed - Fan 3       0  rpm
└── AIO Fan Controller speed - Fan 4       0  rpm

# echo 0 > /sys/class/hwmon/hwmon10/pwm2
# python3 -m liquidctl status
ASUS ROG RYUJIN II 360
├── Liquid temperature                  30.3  °C
├── Pump duty                             99  %
├── Pump speed                          2760  rpm
├── Embedded Micro Fan duty               78  %
├── Embedded Micro Fan speed            4350  rpm
├── AIO Fan Controller duty                0  %
├── AIO Fan Controller speed - Fan 1       0  rpm
├── AIO Fan Controller speed - Fan 2       0  rpm
├── AIO Fan Controller speed - Fan 3       0  rpm
└── AIO Fan Controller speed - Fan 4       0  rpm

# echo 0 > /sys/class/hwmon/hwmon10/pwm2
# python3 -m liquidctl status
ASUS ROG RYUJIN II 360
├── Liquid temperature                  30.3  °C
├── Pump duty                             99  %
├── Pump speed                          2730  rpm
├── Embedded Micro Fan duty               78  %
├── Embedded Micro Fan speed            4350  rpm
├── AIO Fan Controller duty                0  %
├── AIO Fan Controller speed - Fan 1       0  rpm
├── AIO Fan Controller speed - Fan 2       0  rpm
├── AIO Fan Controller speed - Fan 3       0  rpm
└── AIO Fan Controller speed - Fan 4       0  rpm

# echo 0 > /sys/class/hwmon/hwmon10/pwm1
# python3 -m liquidctl status
ASUS ROG RYUJIN II 360
├── Liquid temperature                  30.3  °C
├── Pump duty                             99  %
├── Pump speed                          2730  rpm
├── Embedded Micro Fan duty               78  %
├── Embedded Micro Fan speed            4350  rpm
├── AIO Fan Controller duty                0  %
├── AIO Fan Controller speed - Fan 1       0  rpm
├── AIO Fan Controller speed - Fan 2       0  rpm
├── AIO Fan Controller speed - Fan 3       0  rpm
└── AIO Fan Controller speed - Fan 4       0  rpm
  1. pwm3 not impacted:
# echo 127 > /sys/class/hwmon/hwmon10/pwm3
# python3 -m liquidctl status
ASUS ROG RYUJIN II 360
├── Liquid temperature                  30.2  °C
├── Pump duty                             99  %
├── Pump speed                          2730  rpm
├── Embedded Micro Fan duty               78  %
├── Embedded Micro Fan speed            4320  rpm
├── AIO Fan Controller duty               50  %
├── AIO Fan Controller speed - Fan 1     990  rpm
├── AIO Fan Controller speed - Fan 2     990  rpm
├── AIO Fan Controller speed - Fan 3       0  rpm
└── AIO Fan Controller speed - Fan 4       0  rpm

# echo 64 > /sys/class/hwmon/hwmon10/pwm3
# python3 -m liquidctl status
ASUS ROG RYUJIN II 360
├── Liquid temperature                  29.9  °C
├── Pump duty                             99  %
├── Pump speed                          2700  rpm
├── Embedded Micro Fan duty               78  %
├── Embedded Micro Fan speed            4320  rpm
├── AIO Fan Controller duty               25  %
├── AIO Fan Controller speed - Fan 1     690  rpm
├── AIO Fan Controller speed - Fan 2     690  rpm
├── AIO Fan Controller speed - Fan 3       0  rpm
└── AIO Fan Controller speed - Fan 4       0  rpm

# echo 0 > /sys/class/hwmon/hwmon10/pwm3
# python3 -m liquidctl status
ASUS ROG RYUJIN II 360
├── Liquid temperature                  29.6  °C
├── Pump duty                             99  %
├── Pump speed                          2700  rpm
├── Embedded Micro Fan duty               78  %
├── Embedded Micro Fan speed            4320  rpm
├── AIO Fan Controller duty                0  %
├── AIO Fan Controller speed - Fan 1       0  rpm
├── AIO Fan Controller speed - Fan 2       0  rpm
├── AIO Fan Controller speed - Fan 3       0  rpm
└── AIO Fan Controller speed - Fan 4       0  rpm
  1. pwm1 and pwm2 still stuck, resetting them using liquidctl
# echo 0 > /sys/class/hwmon/hwmon10/pwm1
# python3 -m liquidctl status
ASUS ROG RYUJIN II 360
├── Liquid temperature                  29.3  °C
├── Pump duty                             99  %
├── Pump speed                          2700  rpm
├── Embedded Micro Fan duty               78  %
├── Embedded Micro Fan speed            4350  rpm
├── AIO Fan Controller duty                0  %
├── AIO Fan Controller speed - Fan 1       0  rpm
├── AIO Fan Controller speed - Fan 2       0  rpm
├── AIO Fan Controller speed - Fan 3       0  rpm
└── AIO Fan Controller speed - Fan 4       0  rpm

# echo 0 > /sys/class/hwmon/hwmon10/pwm2
# python3 -m liquidctl status
ASUS ROG RYUJIN II 360
├── Liquid temperature                  29.3  °C
├── Pump duty                             99  %
├── Pump speed                          2730  rpm
├── Embedded Micro Fan duty               78  %
├── Embedded Micro Fan speed            4350  rpm
├── AIO Fan Controller duty                0  %
├── AIO Fan Controller speed - Fan 1       0  rpm
├── AIO Fan Controller speed - Fan 2       0  rpm
├── AIO Fan Controller speed - Fan 3       0  rpm
└── AIO Fan Controller speed - Fan 4       0  rpm

# python3 -m liquidctl set pump speed 0
# python3 -m liquidctl status
ASUS ROG RYUJIN II 360
├── Liquid temperature                  29.0  °C
├── Pump duty                              0  %
├── Pump speed                           870  rpm
├── Embedded Micro Fan duty               78  %
├── Embedded Micro Fan speed            4380  rpm
├── AIO Fan Controller duty                0  %
├── AIO Fan Controller speed - Fan 1       0  rpm
├── AIO Fan Controller speed - Fan 2       0  rpm
├── AIO Fan Controller speed - Fan 3       0  rpm
└── AIO Fan Controller speed - Fan 4       0  rpm

# python3 -m liquidctl set fan1 speed 0
# python3 -m liquidctl status
ASUS ROG RYUJIN II 360
├── Liquid temperature                  29.2  °C
├── Pump duty                              0  %
├── Pump speed                           870  rpm
├── Embedded Micro Fan duty                0  %
├── Embedded Micro Fan speed               0  rpm
├── AIO Fan Controller duty                0  %
├── AIO Fan Controller speed - Fan 1       0  rpm
├── AIO Fan Controller speed - Fan 2       0  rpm
├── AIO Fan Controller speed - Fan 3       0  rpm
└── AIO Fan Controller speed - Fan 4       0  rpm

Side notes, probably not related to bug:


} else if (data[1] == RYUJIN_GET_COOLER_DUTY_CMD_RESPONSE) {

priv is updated everytime RYUJIN_GET_COOLER_DUTY_CMD_RESPONSE (0x1A) is received as the second byte.
Unfortunately the AIO doesn't just send 0x1A when the speeds were requested, but also as a response to updating the cooler speeds and this confirmation doesn't include any data (it's just 0xEC 0x1A 0x00 0x00 0x00...).
0x21 also behaves the same way.

I see priv is updated before anything is read, so this shouldn't really matter, I just thought this may be something to be cautious about.


Since hwmon exposes the sensors as separate files, wouldn't it make more sense to only request the required sensors and cache them separately? This could save 3/4 requests to the AIO, depending on if programs read multiple sensors at once like lm-sensors does.

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.