From a3fdc4852be4d9525a0b396acbed5df04ee808d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guido=20G=C3=BCnther?= Date: Sun, 27 Apr 2025 14:03:26 +0200 Subject: [PATCH] fbd-dev-led-multicolor: Ignore LEDs that don't have three values MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We assume that multicolor LEDs are RGB so reject those that don't have three components. E.g. the Framework Laptop exposes a power button LED as multicolor that only has a white component. This way it gets treated as single color LED. Signed-off-by: Guido Günther --- src/fbd-dev-led-multicolor.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/fbd-dev-led-multicolor.c b/src/fbd-dev-led-multicolor.c index 287f200..47a55fb 100644 --- a/src/fbd-dev-led-multicolor.c +++ b/src/fbd-dev-led-multicolor.c @@ -57,6 +57,13 @@ fbd_dev_led_multicolor_probe (FbdDevLed *led, GError **error) return FALSE; } + if (g_strv_length ((GStrv)index) != 3) { + g_set_error (error, + G_FILE_ERROR, G_FILE_ERROR_FAILED, + "%s is no multicolor RGB LED", name); + return FALSE; + } + max_brightness = g_udev_device_get_sysfs_attr_as_int (dev, LED_MAX_BRIGHTNESS_ATTR); if (!max_brightness) { g_set_error (error,