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

From: Pavel Machek
Date: Wed Mar 23 2022 - 17:04:35 EST


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 <manuel.schoenlaub@xxxxxxxxx>

Please cc LEDs stuff to the LED lists.

> +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.

Attachment: signature.asc
Description: PGP signature