fbd-dev-led-multicolor: Ignore LEDs that don't have three values

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 <agx@sigxcpu.org>
This commit is contained in:
Guido Günther
2025-04-30 08:50:14 +00:00
parent 3cb34ce43f
commit a3fdc4852b
+7
View File
@@ -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,