Skip to contentSkip to conversation

HID: input: map System Microphone Mute LED

PATCH New ait 4 participants 4 messages Sep 4 – Sep 11

Subsystems (3)
lore
Share & tools
lore

ait

author
#0 lore raw

PATCH 1/1 HID: input: map System Microphone Mute LED

From: Jonathan Jansen <[email protected]>

HUTRR110 (approved 2022, part of HID Usage Tables since v1.4) defines:

  Generic Desktop (0x01)  0xa9  System Microphone Mute  OOC (input)
  LED Page (0x08)         0x57  System Microphone Mute  OOC (output)

The input usage already maps to KEY_MICMUTE, so the button works on HUTRR110 devices. The LED output usage is ignored, though, so the indicator stays dark and userspace depends on per-vendor hacks (hid-lenovo, hid-lg-g15, hid-playstation, hid-plantronics) or platform drivers instead.

Map LED page usage 0x57 to a new LED_MICMUTE input LED. It shows up as /sys/class/leds/inputN::micmute with the "audio-micmute" trigger that snd-ctl-led registers, so the LED tracks the audio stack's system-wide microphone mute state, like the existing "Mute" (LED page 0x09) mapping does for speaker mute.

LED_MICMUTE takes the next free input LED code (0x0b, below LED_MAX 0x0f), so nothing existing breaks.

---
 drivers/hid/hid-debug.c                | 2 +-
 drivers/hid/hid-input.c                | 1 +
 drivers/input/input-leds.c             | 1 +
 include/uapi/linux/input-event-codes.h | 1 +
 4 files changed, 4 insertions(+), 1 deletion(-)
drivers/hid/hid-debug.c +1 -1
index f44e6e708..92a950105 100644
@@ -3550,7 +3550,7 @@ static const char *leds[LED_MAX + 1] = {
 	[LED_KANA] = "Kana",		[LED_SLEEP] = "Sleep",
 	[LED_SUSPEND] = "Suspend",	[LED_MUTE] = "Mute",
 	[LED_MISC] = "Misc",		[LED_MAIL] = "Mail",
-	[LED_CHARGING] = "Charging",
+	[LED_CHARGING] = "Charging",	[LED_MICMUTE] = "Mic Mute",
 };
 
 static const char *repeats[REP_MAX + 1] = {
drivers/hid/hid-input.c +1 -0
index edd6bbf83..727374dd5 100644
@@ -990,6 +990,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
 		case 0x27:  map_led (LED_SLEEP);    break;    /*   "Stand-By"                 */
 		case 0x4c:  map_led (LED_SUSPEND);  break;    /*   "System Suspend"           */
 		case 0x09:  map_led (LED_MUTE);     break;    /*   "Mute"                     */
+		case 0x57:  map_led (LED_MICMUTE);  break;    /*   "System Microphone Mute"   */
 		case 0x4b:  map_led (LED_MISC);     break;    /*   "Generic Indicator"        */
 		case 0x19:  map_led (LED_MAIL);     break;    /*   "Message Waiting"          */
 		case 0x4d:  map_led (LED_CHARGING); break;    /*   "External Power Connected" */
drivers/input/input-leds.c +1 -0
index b08d1d08d..6522079a4 100644
@@ -36,6 +36,7 @@ static const struct {
 	[LED_SLEEP]	= { "sleep" } ,
 	[LED_SUSPEND]	= { "suspend" },
 	[LED_MUTE]	= { "mute", AUDIO_TRIGGER("audio-mute") },
+	[LED_MICMUTE]	= { "micmute", AUDIO_TRIGGER("audio-micmute") },
 	[LED_MISC]	= { "misc" },
 	[LED_MAIL]	= { "mail" },
 	[LED_CHARGING]	= { "charging" },
include/uapi/linux/input-event-codes.h +1 -0
index 3528168f7..bc374821c 100644
@@ -983,6 +983,7 @@
 #define LED_MISC		0x08
 #define LED_MAIL		0x09
 #define LED_CHARGING		0x0a
+#define LED_MICMUTE		0x0b
 #define LED_MAX			0x0f
 #define LED_CNT			(LED_MAX+1)
 
Signature · 1 line
2.51.0
#1 lore raw

PATCH v2 1/1 HID: input: map System Microphone Mute LED

HUTRR110 defines LED page usage 0x57 as System Microphone Mute.

The usage is currently ignored, so the indicator stays dark and userspace falls back to per-vendor code in hid-lenovo, hid-playstation, hid-plantronics.

Map it to a new LED_MICMUTE. It appears as /sys/class/leds/inputN::micmute and uses the "audio-micmute" trigger from snd-ctl-led, so the LED follows the system-wide mic mute state the same way LED_MUTE (page 0x09) already does for speaker mute.

LED_MICMUTE takes the next free code (0x0b).

---

Notes:
Changes since v1: rewrote the commit message; no functional changes.

 drivers/hid/hid-debug.c                | 2 +-
 drivers/hid/hid-input.c                | 1 +
 drivers/input/input-leds.c             | 1 +
 include/uapi/linux/input-event-codes.h | 1 +
 4 files changed, 4 insertions(+), 1 deletion(-)
drivers/hid/hid-debug.c +1 -1
index f44e6e708..92a950105 100644
@@ -3550,7 +3550,7 @@ static const char *leds[LED_MAX + 1] = {
 	[LED_KANA] = "Kana",		[LED_SLEEP] = "Sleep",
 	[LED_SUSPEND] = "Suspend",	[LED_MUTE] = "Mute",
 	[LED_MISC] = "Misc",		[LED_MAIL] = "Mail",
-	[LED_CHARGING] = "Charging",
+	[LED_CHARGING] = "Charging",	[LED_MICMUTE] = "Mic Mute",
 };
 
 static const char *repeats[REP_MAX + 1] = {
drivers/hid/hid-input.c +1 -0
index edd6bbf83..727374dd5 100644
@@ -990,6 +990,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
 		case 0x27:  map_led (LED_SLEEP);    break;    /*   "Stand-By"                 */
 		case 0x4c:  map_led (LED_SUSPEND);  break;    /*   "System Suspend"           */
 		case 0x09:  map_led (LED_MUTE);     break;    /*   "Mute"                     */
+		case 0x57:  map_led (LED_MICMUTE);  break;    /*   "System Microphone Mute"   */
 		case 0x4b:  map_led (LED_MISC);     break;    /*   "Generic Indicator"        */
 		case 0x19:  map_led (LED_MAIL);     break;    /*   "Message Waiting"          */
 		case 0x4d:  map_led (LED_CHARGING); break;    /*   "External Power Connected" */
drivers/input/input-leds.c +1 -0
index b08d1d08d..6522079a4 100644
@@ -36,6 +36,7 @@ static const struct {
 	[LED_SLEEP]	= { "sleep" } ,
 	[LED_SUSPEND]	= { "suspend" },
 	[LED_MUTE]	= { "mute", AUDIO_TRIGGER("audio-mute") },
+	[LED_MICMUTE]	= { "micmute", AUDIO_TRIGGER("audio-micmute") },
 	[LED_MISC]	= { "misc" },
 	[LED_MAIL]	= { "mail" },
 	[LED_CHARGING]	= { "charging" },
include/uapi/linux/input-event-codes.h +1 -0
index 3528168f7..bc374821c 100644
@@ -983,6 +983,7 @@
 #define LED_MISC		0x08
 #define LED_MAIL		0x09
 #define LED_CHARGING		0x0a
+#define LED_MICMUTE		0x0b
 #define LED_MAX			0x0f
 #define LED_CNT			(LED_MAX+1)
 
Signature · 1 line
2.55.0
maintainer Acked-by on v2 1/1
#2 lore raw
Quoted 16 lines · Jonathan Jansen

HUTRR110 defines LED page usage 0x57 as System Microphone Mute.

The usage is currently ignored, so the indicator stays dark and userspace falls back to per-vendor code in hid-lenovo, hid-playstation, hid-plantronics.

Map it to a new LED_MICMUTE. It appears as /sys/class/leds/inputN::micmute and uses the "audio-micmute" trigger from snd-ctl-led, so the LED follows the system-wide mic mute state the same way LED_MUTE (page 0x09) already does for speaker mute.

LED_MICMUTE takes the next free code (0x0b).

Quoted 8 lines

---

Notes:
Changes since v1: rewrote the commit message; no functional changes.

 drivers/hid/hid-debug.c                | 2 +-
 drivers/hid/hid-input.c                | 1 +

for the drivers/hid changes.

Dmitry, will you take this through your tree, please?

Thanks,

Signature · 2 lines
Jiri Kosina
SUSE Labs
maintainer
#3 lore raw
Quoted 24 lines · Jiri Kosina
Quoted 22 lines · Jonathan Jansen

HUTRR110 defines LED page usage 0x57 as System Microphone Mute.

The usage is currently ignored, so the indicator stays dark and userspace falls back to per-vendor code in hid-lenovo, hid-playstation, hid-plantronics.

Map it to a new LED_MICMUTE. It appears as /sys/class/leds/inputN::micmute and uses the "audio-micmute" trigger from snd-ctl-led, so the LED follows the system-wide mic mute state the same way LED_MUTE (page 0x09) already does for speaker mute.

LED_MICMUTE takes the next free code (0x0b).

---

Notes:
Changes since v1: rewrote the commit message; no functional changes.

Quoted 8 lines
Quoted 2 lines
 drivers/hid/hid-debug.c                | 2 +-
 drivers/hid/hid-input.c                | 1 +

for the drivers/hid changes.

Dmitry, will you take this through your tree, please?

Hi Jiri, Jonathan,

Sorry but we should not add any new LED definitions to input since we have proper LED subsystem now. The existing LED definitions are strictly legacy now and input core has a bridge to LEDs (in input-leds.c).

I see we had similar submissions in '23 and '24 at the very least. I should add a comment to that effect to input-event-codes.h.

Thanks.

Signature · 1 line
Dmitry