Thread (14 messages) 14 messages, 5 authors, 2022-05-05

Re: [PATCH] HID: logitech-hidpp: support Color LED feature (8071).

flat view

From: Pavel Machek <hidden>
Date: 2022-03-23 21:04:35
Also in: lkml

Hi!
The HID++ protocol allows to set multicolor (RGB) to a static color.
Multiple of such LED zones per device are supported.
This patch exports said LEDs so that they can be set from userspace.

Signed-off-by: Manuel Schönlaub <redacted>
Please cc LEDs stuff to the LED lists.
quoted hunk ↗ jump to hunk
+static int hidpp_mc_led_register(struct hidpp_device *hidpp_dev,
+				 struct led_classdev_mc *mc_dev,
+				 int zone)
+{
+	struct hid_device *hdev = hidpp_dev->hid_dev;
+	struct mc_subled *mc_led_info;
+	struct led_classdev *cdev;
+	int ret;
+
+	mc_led_info = devm_kmalloc_array(&hdev->dev, 3,
+					 sizeof(*mc_led_info),
+					 GFP_KERNEL | __GFP_ZERO);
+	if (!mc_led_info)
+		return -ENOMEM;
+
+	mc_led_info[0].color_index = LED_COLOR_ID_RED;
+	mc_led_info[1].color_index = LED_COLOR_ID_GREEN;
+	mc_led_info[2].color_index = LED_COLOR_ID_BLUE;
+
+	mc_dev->subled_info = mc_led_info;
+	mc_dev->num_colors = 3;
+
+	cdev = &mc_dev->led_cdev;
+	cdev->name = devm_kasprintf(&hdev->dev, GFP_KERNEL,
+				    "%s:rgb:indicator-%d", hdev->uniq, zone);
So this is keyboard backlight? We should add the documentation at the
very least, so that other drivers use same name.

Best regards,
								Pavel

-- 
People of Russia, stop Putin before his war on Ukraine escalates.

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help