fbd-dev-leds: support for multicolor LEDs

Add support for multicolor LEDs as supported by the kernel.
Used by Qualcomm devices such as SHIFT 6mq, OnePlus 6, etc.

Documentation:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/ABI/testing/sysfs-class-led-multicolor

Co-Developed-by: Dylan Van Assche <me@dylanvanassche.be>
This commit is contained in:
Luca Weiss
2022-05-17 20:04:23 +02:00
committed by Dylan Van Assche
parent 510f1b6d6e
commit e16202eeb5
3 changed files with 78 additions and 6 deletions
+4
View File
@@ -17,6 +17,7 @@
#include <unistd.h>
#define LED_BRIGHTNESS_ATTR "brightness"
#define LED_MULTI_INTENSITY_ATTR "multi_intensity"
#define LED_PATTERN_ATTR "pattern"
#define LED_REPEAT_ATTR "repeat"
#define LED_TRIGGER_ATTR "trigger"
@@ -126,6 +127,9 @@ set_perms (const char *sysfs_path, const char *trigger, const char *gname)
if (!set_sysfs_attr_perm (sysfs_path, LED_BRIGHTNESS_ATTR, group->gr_gid))
return FALSE;
// Attribute is optional
set_sysfs_attr_perm (sysfs_path, LED_MULTI_INTENSITY_ATTR, group->gr_gid);
if (!g_strcmp0 (trigger, LED_TRIGGER_PATTERN)) {
if (!set_sysfs_attr_perm (sysfs_path, LED_PATTERN_ATTR, group->gr_gid))
success = FALSE;