* [PATCH 0/1] Do Not Disturb broke GD D-pad
@ 2024-10-11 19:58 Terry Tritton
2024-10-11 19:58 ` [PATCH 1/1] input: fix generic desktop D-Pad controls Terry Tritton
0 siblings, 1 reply; 4+ messages in thread
From: Terry Tritton @ 2024-10-11 19:58 UTC (permalink / raw)
To: Jiri Kosina, Benjamin Tissoires, Dmitry Torokhov, linux-input,
Aseda Aboagye
Cc: Peter Griffin, Terry Tritton, Terry Tritton
Hi,
We noticed a breakage in the android test: CtsHardwareTestCases_cts_tests
android.hardware.input.cts.tests.GameviceGv186Test#testAllMotions
I bisected the issue to:
commit 22d6d060ac77 ("input: Add support for "Do Not Disturb"")
The cause is pretty clear there are 2 separate checks for:
if ((usage->hid & 0xf0) == 0x90)
so the second one which handles the d-pad is getting skipped.
I've combined them both in the following patch which works for me.
Thanks
Terry Tritton (1):
input: fix generic desktop D-Pad controls
drivers/hid/hid-input.c | 37 +++++++++++++++++--------------------
include/linux/hid.h | 1 +
2 files changed, 18 insertions(+), 20 deletions(-)
--
2.39.5
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/1] input: fix generic desktop D-Pad controls
2024-10-11 19:58 [PATCH 0/1] Do Not Disturb broke GD D-pad Terry Tritton
@ 2024-10-11 19:58 ` Terry Tritton
2024-10-14 22:02 ` Aseda Aboagye
2024-11-07 23:21 ` Carlos Llamas
0 siblings, 2 replies; 4+ messages in thread
From: Terry Tritton @ 2024-10-11 19:58 UTC (permalink / raw)
To: Jiri Kosina, Benjamin Tissoires, Dmitry Torokhov, linux-input,
Aseda Aboagye
Cc: Peter Griffin, Terry Tritton, Terry Tritton
The addition of the "System Do Not Disturb" event code caused the Generic
Desktop D-Pad configuration to be skipped. This commit allows both to be
configured without conflicting with each other.
Fixes: 22d6d060ac77 ("input: Add support for "Do Not Disturb"")
Signed-off-by: Terry Tritton <terry.tritton@linaro.org>
---
drivers/hid/hid-input.c | 37 +++++++++++++++++--------------------
include/linux/hid.h | 1 +
2 files changed, 18 insertions(+), 20 deletions(-)
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index fda9dce3da99..9d80635a91eb 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -810,10 +810,23 @@ 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;
+ if ((usage->hid & 0xf0) == 0x90) { /* SystemControl & D-pad */
+ switch (usage->hid) {
+ case HID_GD_UP: usage->hat_dir = 1; break;
+ case HID_GD_DOWN: usage->hat_dir = 5; break;
+ case HID_GD_RIGHT: usage->hat_dir = 3; break;
+ case HID_GD_LEFT: usage->hat_dir = 7; break;
+ case HID_GD_DO_NOT_DISTURB:
+ map_key_clear(KEY_DO_NOT_DISTURB); break;
+ default: goto unknown;
+ }
+
+ if (usage->hid <= HID_GD_LEFT) {
+ if (field->dpad) {
+ map_abs(field->dpad);
+ goto ignore;
+ }
+ map_abs(ABS_HAT0X);
}
break;
}
@@ -844,22 +857,6 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
if (field->application == HID_GD_SYSTEM_CONTROL)
goto ignore;
- if ((usage->hid & 0xf0) == 0x90) { /* D-pad */
- switch (usage->hid) {
- case HID_GD_UP: usage->hat_dir = 1; break;
- case HID_GD_DOWN: usage->hat_dir = 5; break;
- case HID_GD_RIGHT: usage->hat_dir = 3; break;
- case HID_GD_LEFT: usage->hat_dir = 7; break;
- default: goto unknown;
- }
- if (field->dpad) {
- map_abs(field->dpad);
- goto ignore;
- }
- map_abs(ABS_HAT0X);
- break;
- }
-
switch (usage->hid) {
/* These usage IDs map directly to the usage codes. */
case HID_GD_X: case HID_GD_Y: case HID_GD_Z:
diff --git a/include/linux/hid.h b/include/linux/hid.h
index 121d5b8bc867..80433ee3e5ae 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -218,6 +218,7 @@ struct hid_item {
#define HID_GD_DOWN 0x00010091
#define HID_GD_RIGHT 0x00010092
#define HID_GD_LEFT 0x00010093
+#define HID_GD_DO_NOT_DISTURB 0x0001009b
/* Microsoft Win8 Wireless Radio Controls CA usage codes */
#define HID_GD_RFKILL_BTN 0x000100c6
#define HID_GD_RFKILL_LED 0x000100c7
--
2.39.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] input: fix generic desktop D-Pad controls
2024-10-11 19:58 ` [PATCH 1/1] input: fix generic desktop D-Pad controls Terry Tritton
@ 2024-10-14 22:02 ` Aseda Aboagye
2024-11-07 23:21 ` Carlos Llamas
1 sibling, 0 replies; 4+ messages in thread
From: Aseda Aboagye @ 2024-10-14 22:02 UTC (permalink / raw)
To: Terry Tritton
Cc: Jiri Kosina, Benjamin Tissoires, Dmitry Torokhov, linux-input,
Peter Griffin, Terry Tritton
Hi Terry,
Thanks so much for the fix! My apologies; I completely missed the D-pad
section.
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Thanks,
--
Aseda Aboagye
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] input: fix generic desktop D-Pad controls
2024-10-11 19:58 ` [PATCH 1/1] input: fix generic desktop D-Pad controls Terry Tritton
2024-10-14 22:02 ` Aseda Aboagye
@ 2024-11-07 23:21 ` Carlos Llamas
1 sibling, 0 replies; 4+ messages in thread
From: Carlos Llamas @ 2024-11-07 23:21 UTC (permalink / raw)
To: Terry Tritton
Cc: Jiri Kosina, Benjamin Tissoires, Dmitry Torokhov, linux-input,
Aseda Aboagye, Peter Griffin, Terry Tritton
On Fri, Oct 11, 2024 at 08:58:08PM +0100, Terry Tritton wrote:
> The addition of the "System Do Not Disturb" event code caused the Generic
> Desktop D-Pad configuration to be skipped. This commit allows both to be
> configured without conflicting with each other.
>
> Fixes: 22d6d060ac77 ("input: Add support for "Do Not Disturb"")
> Signed-off-by: Terry Tritton <terry.tritton@linaro.org>
This patch LGTM, is it getting picked up?
Reviewed-by: Carlos Llamas <cmllamas@google.com>
Cheers,
--
Carlos Llamas
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-11-07 23:21 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-11 19:58 [PATCH 0/1] Do Not Disturb broke GD D-pad Terry Tritton
2024-10-11 19:58 ` [PATCH 1/1] input: fix generic desktop D-Pad controls Terry Tritton
2024-10-14 22:02 ` Aseda Aboagye
2024-11-07 23:21 ` Carlos Llamas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).