Skip to contentSkip to conversation

HID: input: Add support for micmute LED

PATCH RESEND New Bernhard Seibold 1 participant 1 message Feb 11, 2024 HID

lore
Share & tools
lore
#0 lore raw

PATCH RESEND v2 1/1 HID: input: Add support for micmute LED

The USB HID spec describes a number of LEDs that are currently unsupported. For now, add only the micmute LED since this one is proven to exist in actual devices. Since LED support via input-leds is grandfathered, the new LED is added directly in hid-input.

---
 drivers/hid/Kconfig     | 11 +++++
 drivers/hid/hid-input.c | 92 +++++++++++++++++++++++++++++++++++++++++
 include/linux/hid.h     |  1 +
 3 files changed, 104 insertions(+)
drivers/hid/Kconfig +11 -0
index 4c682c650704..f8ed13d9740a 100644
@@ -42,6 +42,17 @@ config HID_BATTERY_STRENGTH
 	that support this feature) through power_supply class so that userspace
 	tools, such as upower, can display it.
 
+config HID_LEDS
+	bool "LED support for HID devices"
+	select LEDS_CLASS
+	default y
+	help
+	This option adds support for LEDs on HID devices. Currently, the
+	only supported LED is microphone mute. For all other LEDs,
+	enable CONFIG_INPUT_LEDS.
+
+	If unsure, say Y.
+
 config HIDRAW
 	bool "/dev/hidraw raw HID device support"
 	help
drivers/hid/hid-input.c +92 -0

128 lines not on this page · raw message

include/linux/hid.h +1 -0
index 7c26db874ff0..7c0e2789755f 100644
@@ -617,6 +617,7 @@ struct hid_device {							/* device report descriptor */
 	unsigned country;						/* HID country */
 	struct hid_report_enum report_enum[HID_REPORT_TYPES];
 	struct work_struct led_work;					/* delayed LED worker */
+	struct list_head leds;						/* List of associated LEDs */
 
 	struct semaphore driver_input_lock;				/* protects the current driver */
 	struct device dev;						/* device */
Signature · 1 line
2.43.0