From 8aa7213327857383c91ac5b28747e206c5c3f1a5 Mon Sep 17 00:00:00 2001 From: "Sicelo A. Mhlongo" Date: Sat, 28 Jun 2025 16:53:22 +0200 Subject: [PATCH] fbd-dev-led: Support LEDs with legacy naming As noted in include/dt-bindings/leds/common.h in the Linux kernel, the Nokia N900 has leds that use legacy naming. Until this naming scheme is removed from the kernel, support it through the use of an additional FEEDBACKD_LED_COLOR udev property, which must be set to the color corresponding to the LED. Signed-off-by: Sicelo A. Mhlongo --- src/fbd-dev-led.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/fbd-dev-led.c b/src/fbd-dev-led.c index 2008e97..0b57466 100644 --- a/src/fbd-dev-led.c +++ b/src/fbd-dev-led.c @@ -51,11 +51,12 @@ static gboolean fbd_dev_led_probe_default (FbdDevLed *led, GError **error) { FbdDevLedPrivate *priv = fbd_dev_led_get_instance_private (led); - const gchar *name, *path; + const gchar *name, *path, *hint; gboolean success = FALSE; const char *pattern; name = g_udev_device_get_name (priv->dev); + hint = g_udev_device_get_property (priv->dev, "FEEDBACKD_LED_COLOR"); pattern = g_udev_device_get_sysfs_attr (priv->dev, LED_PATTERN_ATTR); if (!pattern) { g_set_error (error, @@ -72,7 +73,7 @@ fbd_dev_led_probe_default (FbdDevLed *led, GError **error) enum_name = g_enum_to_string (FBD_TYPE_FEEDBACK_LED_COLOR, i); c = strrchr (enum_name, '_'); color = g_ascii_strdown (c+1, -1); - if (g_strstr_len (name, -1, color)) { + if (g_strstr_len (name, -1, color) || !g_strcmp0 (hint, color)) { guint brightness = g_udev_device_get_sysfs_attr_as_int (priv->dev, LED_MAX_BRIGHTNESS_ATTR); if (!brightness)