Message ID | Zk7csk3RHEqCruWU@google.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | [1/2] input: Add event code for accessibility key | expand |
On Thu, May 23, 2024 at 01:05:38AM -0500, Aseda Aboagye wrote: > 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. > > Signed-off-by: Aseda Aboagye <aaboagye@chromium.org> > --- > drivers/hid/hid-debug.c | 1 + > drivers/hid/hid-input.c | 11 +++++++++++ > include/uapi/linux/input-event-codes.h | 2 ++ > 3 files changed, 14 insertions(+) > > diff --git a/drivers/hid/hid-debug.c b/drivers/hid/hid-debug.c > index 7749c81b6227..78b2dd10cba2 100644 > --- a/drivers/hid/hid-debug.c > +++ b/drivers/hid/hid-debug.c > @@ -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_DONOTDISTURB] = "DoNotDisturb", > [KEY_DICTATE] = "Dictate", > [KEY_MICMUTE] = "MicrophoneMute", > [KEY_BRIGHTNESS_MIN] = "BrightnessMin", > diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c > index 6d2dbb75ba65..7fda66f7b437 100644 > --- a/drivers/hid/hid-input.c > +++ b/drivers/hid/hid-input.c > @@ -826,6 +826,17 @@ 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_DONOTDISTURB); > + break; > + default: > + goto ignore; > + } > + break; > + } > + > if ((usage->hid & 0xf0) == 0xa0) { /* SystemControl */ > switch (usage->hid & 0xf) { > case 0x9: map_key_clear(KEY_MICMUTE); break; > diff --git a/include/uapi/linux/input-event-codes.h b/include/uapi/linux/input-event-codes.h > index 980ef7fefd2b..b8abc239d660 100644 > --- a/include/uapi/linux/input-event-codes.h > +++ b/include/uapi/linux/input-event-codes.h > @@ -619,6 +619,8 @@ > #define KEY_CAMERA_ACCESS_TOGGLE 0x24d /* Toggles the current state of the camera access control. (HUTRR72) */ > /* Toggles the system bound accessibility UI/command (HUTRR116) */ > #define KEY_ACCESSIBILITY 0x24e > +/* Toggles the system-wide "Do Not Disturb" control (HUTRR94)*/ > +#define KEY_DONOTDISTURB 0x24f Could we have this as KEY_DO_NOT_DISTURB? Also the same comments as on the previous patch. Thanks.
diff --git a/drivers/hid/hid-debug.c b/drivers/hid/hid-debug.c index 7749c81b6227..78b2dd10cba2 100644 --- a/drivers/hid/hid-debug.c +++ b/drivers/hid/hid-debug.c @@ -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_DONOTDISTURB] = "DoNotDisturb", [KEY_DICTATE] = "Dictate", [KEY_MICMUTE] = "MicrophoneMute", [KEY_BRIGHTNESS_MIN] = "BrightnessMin", diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c index 6d2dbb75ba65..7fda66f7b437 100644 --- a/drivers/hid/hid-input.c +++ b/drivers/hid/hid-input.c @@ -826,6 +826,17 @@ 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_DONOTDISTURB); + break; + default: + goto ignore; + } + break; + } + if ((usage->hid & 0xf0) == 0xa0) { /* SystemControl */ switch (usage->hid & 0xf) { case 0x9: map_key_clear(KEY_MICMUTE); break; diff --git a/include/uapi/linux/input-event-codes.h b/include/uapi/linux/input-event-codes.h index 980ef7fefd2b..b8abc239d660 100644 --- a/include/uapi/linux/input-event-codes.h +++ b/include/uapi/linux/input-event-codes.h @@ -619,6 +619,8 @@ #define KEY_CAMERA_ACCESS_TOGGLE 0x24d /* Toggles the current state of the camera access control. (HUTRR72) */ /* Toggles the system bound accessibility UI/command (HUTRR116) */ #define KEY_ACCESSIBILITY 0x24e +/* Toggles the system-wide "Do Not Disturb" control (HUTRR94)*/ +#define KEY_DONOTDISTURB 0x24f #define KEY_BRIGHTNESS_MIN 0x250 /* Set Brightness to Minimum */ #define KEY_BRIGHTNESS_MAX 0x251 /* Set Brightness to Maximum */
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. Signed-off-by: Aseda Aboagye <aaboagye@chromium.org> --- drivers/hid/hid-debug.c | 1 + drivers/hid/hid-input.c | 11 +++++++++++ include/uapi/linux/input-event-codes.h | 2 ++ 3 files changed, 14 insertions(+)