Add support for led_classdev_mc via sysfs

Update the LinuxLEDController to support multicolor LEDs defined by
the Linux kernel. For multicolor LEDs Linux exposes a single
brightness which allows a range of 0 (off) to 255 (max) and a multi_intensity
value that accepts multiple channels of colors. This current implementation
assumes that there are 3 multi_intensity channels between 0 and 255.

https://docs.kernel.org/leds/leds-class-multicolor.html

Note that for now in Linux the brightness value doesn't so much affect
the brightness of the LED as it does apply a coefficient to the individual
channel intensities. For now hard code the brightness to 255 and simply
adjust the intensities to alter the color.

This change should keep the existing sysfs code path as-is and only attempt
to use this new method when a led_rgb_path is present in the config file.

For reference, my OpenRGB.json has the following lines:
`    "LinuxLEDDevices" : {
        "devices": [
            {
                "name": "Fan LED 1",
                "rgb_path": "/sys/class/leds/rgb:programming-0/"
            }
        ]
    }`

Signed-off-by: Chris Morgan <[email protected]>
This commit is contained in:
Chris Morgan authored and Adam Honse committed 2025-10-20 12:13:50 -05:00
1 parent 5966632276
commit c1781bc4cb
4 files changed
+59 -17

No files matched your search

@@ -32,8 +32,8 @@ RGBController_LinuxLED::RGBController_LinuxLED(LinuxLEDController* controller_pt
location = "R: " + controller->GetRedPath() + "\r\n" +
"G: " + controller->GetGreenPath() + "\r\n" +
"B: " + controller->GetBluePath();
"B: " + controller->GetBluePath() + "\r\n" +
"M: " + controller->GetRgbPath();
mode Direct;
Direct.name = "Direct";
Direct.value = 0;