Skip to contentSkip to conversation

input: Add support for "Do Not Disturb"

PATCH Applied Aseda Aboagye 2 participants 2 messages Jun 4, 2024 – Jun 6, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v4 2/2 input: Add support for "Do Not Disturb"

HUTRR94 added support for a new usage titled "System Do Not Disturb" which toggles a system-wide Do Not Disturb setting. This commit simply adds a new event code for the usage.

---
Changes from v3:
- Fixed patch sending workflow to not muck with whitespace.

Changes from v2:
- Added underscores to make KEY_DO_NOT_DISTURB.

Changes from v1:
- Modified formatting to match existing code, ignoring checkpatch.pl.

 drivers/hid/hid-debug.c                | 1 +
 drivers/hid/hid-input.c                | 8 ++++++++
 include/uapi/linux/input-event-codes.h | 1 +
 3 files changed, 10 insertions(+)
drivers/hid/hid-debug.c +1 -0
index 7749c81b6227..4ccfbd860bbe 100644
@@ -975,6 +975,7 @@ static const char *keys[KEY_MAX + 1] = {
 	[KEY_CAMERA_ACCESS_DISABLE] = "CameraAccessDisable",
 	[KEY_CAMERA_ACCESS_TOGGLE] = "CameraAccessToggle",
 	[KEY_ACCESSIBILITY] = "Accessibility",
+	[KEY_DO_NOT_DISTURB] = "DoNotDisturb",
 	[KEY_DICTATE] = "Dictate",
 	[KEY_MICMUTE] = "MicrophoneMute",
 	[KEY_BRIGHTNESS_MIN] = "BrightnessMin",
drivers/hid/hid-input.c +8 -0
index 1ecc5ad57b56..31feb5e0714f 100644
@@ -826,6 +826,14 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
 			break;
 		}
 
+		if ((usage->hid & 0xf0) == 0x90) { /* SystemControl*/
+			switch (usage->hid & 0xf) {
+			case 0xb: map_key_clear(KEY_DO_NOT_DISTURB); break;
+			default: goto ignore;
+			}
+			break;
+		}
+
 		if ((usage->hid & 0xf0) == 0xa0) {	/* SystemControl */
 			switch (usage->hid & 0xf) {
 			case 0x9: map_key_clear(KEY_MICMUTE); break;
include/uapi/linux/input-event-codes.h +1 -0
index 7ff6eeef1af0..07038fd9682d 100644
@@ -618,6 +618,7 @@
 #define KEY_CAMERA_ACCESS_DISABLE	0x24c	/* Disables programmatic access to camera devices. (HUTRR72) */
 #define KEY_CAMERA_ACCESS_TOGGLE	0x24d	/* Toggles the current state of the camera access control. (HUTRR72) */
 #define KEY_ACCESSIBILITY		0x24e	/* Toggles the system bound accessibility UI/command (HUTRR116) */
+#define KEY_DO_NOT_DISTURB		0x24f	/* Toggles the system-wide "Do Not Disturb" control (HUTRR94)*/
 
 #define KEY_BRIGHTNESS_MIN		0x250	/* Set Brightness to Minimum */
 #define KEY_BRIGHTNESS_MAX		0x251	/* Set Brightness to Maximum */
Signature · 1 line
2.45.1.288.g0e0cd299f1-goog
maintainer Applied
#1 lore raw
Quoted 5 lines · Aseda Aboagye

HUTRR94 added support for a new usage titled "System Do Not Disturb" which toggles a system-wide Do Not Disturb setting. This commit simply adds a new event code for the usage.

Applied to hid/hid.git (for-6.10/upstream-fixes), thanks!

[2/2] input: Add support for "Do Not Disturb"

      https://git.kernel.org/hid/hid/c/608b62583b58

Cheers,

Signature · 1 line
Benjamin Tissoires <[email protected]>