All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] HID: hid-input: fix stylus battery reporting
@ 2020-09-25 23:35 Dmitry Torokhov
  2020-09-26  0:55 ` Jiri Kosina
  2020-09-26  0:56 ` Kenneth Albanowski
  0 siblings, 2 replies; 3+ messages in thread
From: Dmitry Torokhov @ 2020-09-25 23:35 UTC (permalink / raw)
  To: Jiri Kosina, Benjamin Tissoires
  Cc: Kenneth Albanowski, linux-input, linux-kernel

With commit 4f3882177240 hid-input started clearing of "ignored" usages
to avoid using garbage that might have been left in them. However
"battery strength" usages should not be ignored, as we do want to
use them.

Fixes: 4f3882177240 ("HID: hid-input: clear unmapped usages")
Reported-by: Kenneth Albanowski <kenalba@google.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---

Kenneth, can you please try this one and see if it fixes your issue?

 drivers/hid/hid-input.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index dea9cc65bf80..5da631d2ec9b 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -797,7 +797,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
 		case 0x3b: /* Battery Strength */
 			hidinput_setup_battery(device, HID_INPUT_REPORT, field);
 			usage->type = EV_PWR;
-			goto ignore;
+			return;
 
 		case 0x3c: /* Invert */
 			map_key_clear(BTN_TOOL_RUBBER);
@@ -1059,7 +1059,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
 		case HID_DC_BATTERYSTRENGTH:
 			hidinput_setup_battery(device, HID_INPUT_REPORT, field);
 			usage->type = EV_PWR;
-			goto ignore;
+			return;
 		}
 		goto unknown;
 
-- 
2.28.0.681.g6f77f65b4e-goog


-- 
Dmitry

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] HID: hid-input: fix stylus battery reporting
  2020-09-25 23:35 [PATCH] HID: hid-input: fix stylus battery reporting Dmitry Torokhov
@ 2020-09-26  0:55 ` Jiri Kosina
  2020-09-26  0:56 ` Kenneth Albanowski
  1 sibling, 0 replies; 3+ messages in thread
From: Jiri Kosina @ 2020-09-26  0:55 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Benjamin Tissoires, Kenneth Albanowski, linux-input, linux-kernel

On Fri, 25 Sep 2020, Dmitry Torokhov wrote:

> With commit 4f3882177240 hid-input started clearing of "ignored" usages
> to avoid using garbage that might have been left in them. However
> "battery strength" usages should not be ignored, as we do want to
> use them.
> 
> Fixes: 4f3882177240 ("HID: hid-input: clear unmapped usages")
> Reported-by: Kenneth Albanowski <kenalba@google.com>
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

Applied, thanks Dmitry and Kenneth.

-- 
Jiri Kosina
SUSE Labs


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] HID: hid-input: fix stylus battery reporting
  2020-09-25 23:35 [PATCH] HID: hid-input: fix stylus battery reporting Dmitry Torokhov
  2020-09-26  0:55 ` Jiri Kosina
@ 2020-09-26  0:56 ` Kenneth Albanowski
  1 sibling, 0 replies; 3+ messages in thread
From: Kenneth Albanowski @ 2020-09-26  0:56 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Jiri Kosina, Benjamin Tissoires, linux-input, linux-kernel

[Re-send to appease the mail daemons]

Confirmed, I've validated this on a 4.19 derivative, this fixes the
problem and battery strength gets reported again.

- Kenneth Albanowski


On Fri, Sep 25, 2020 at 4:35 PM Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:
>
> With commit 4f3882177240 hid-input started clearing of "ignored" usages
> to avoid using garbage that might have been left in them. However
> "battery strength" usages should not be ignored, as we do want to
> use them.
>
> Fixes: 4f3882177240 ("HID: hid-input: clear unmapped usages")
> Reported-by: Kenneth Albanowski <kenalba@google.com>
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> ---
>
> Kenneth, can you please try this one and see if it fixes your issue?
>
>  drivers/hid/hid-input.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
> index dea9cc65bf80..5da631d2ec9b 100644
> --- a/drivers/hid/hid-input.c
> +++ b/drivers/hid/hid-input.c
> @@ -797,7 +797,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
>                 case 0x3b: /* Battery Strength */
>                         hidinput_setup_battery(device, HID_INPUT_REPORT, field);
>                         usage->type = EV_PWR;
> -                       goto ignore;
> +                       return;
>
>                 case 0x3c: /* Invert */
>                         map_key_clear(BTN_TOOL_RUBBER);
> @@ -1059,7 +1059,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
>                 case HID_DC_BATTERYSTRENGTH:
>                         hidinput_setup_battery(device, HID_INPUT_REPORT, field);
>                         usage->type = EV_PWR;
> -                       goto ignore;
> +                       return;
>                 }
>                 goto unknown;
>
> --
> 2.28.0.681.g6f77f65b4e-goog
>
>
> --
> Dmitry

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-09-26  0:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-25 23:35 [PATCH] HID: hid-input: fix stylus battery reporting Dmitry Torokhov
2020-09-26  0:55 ` Jiri Kosina
2020-09-26  0:56 ` Kenneth Albanowski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.