Patchwork HID: hid-input: Add eraser usage to hidinput_configure_usage

login
register
mail settings
Submitter Ping Cheng
Date Sept. 21, 2017, 10:37 p.m.
Message ID <20170921223706.3289-1-ping.cheng@wacom.com>
Download mbox | patch
Permalink /patch/9964881/
State New
Headers show

Comments

Ping Cheng - Sept. 21, 2017, 10:37 p.m.
Some tablets report eraser usage to indicate the eraser tool. But,
hidinput_configure_usage doesn't support it, which led the usage
falls into default as ABS_MISC.

Signed-off-by: Ping Cheng <ping.cheng@wacom.com>
---
 drivers/hid/hid-input.c | 4 ++++
 1 file changed, 4 insertions(+)
Dmitry Torokhov - Sept. 22, 2017, 4:56 p.m.
On Thu, Sep 21, 2017 at 3:37 PM, Ping Cheng <pinglinux@gmail.com> wrote:
> Some tablets report eraser usage to indicate the eraser tool. But,
> hidinput_configure_usage doesn't support it, which led the usage
> falls into default as ABS_MISC.
>
> Signed-off-by: Ping Cheng <ping.cheng@wacom.com>
> ---
>  drivers/hid/hid-input.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
> index 199f6a01fc62..4d36b08494fd 100644
> --- a/drivers/hid/hid-input.c
> +++ b/drivers/hid/hid-input.c
> @@ -797,6 +797,10 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
>                         map_key_clear(BTN_STYLUS);
>                         break;
>
> +               case 0x45: /* ERASER */
> +                       map_key_clear(BTN_TOUCH);

Surely you mean BTN_TOOL_RUBBER?

Thanks.
Jiri Kosina - Oct. 2, 2017, 11:41 a.m.
On Fri, 22 Sep 2017, Ping Cheng wrote:

> > > Some tablets report eraser usage to indicate the eraser tool. But,
> > > hidinput_configure_usage doesn't support it, which led the usage
> > > falls into default as ABS_MISC.
> > >
> > > Signed-off-by: Ping Cheng <ping.cheng@wacom.com <javascript:;>>
> > > ---
> > >  drivers/hid/hid-input.c | 4 ++++
> > >  1 file changed, 4 insertions(+)
> > >
> > > diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
> > > index 199f6a01fc62..4d36b08494fd 100644
> > > --- a/drivers/hid/hid-input.c
> > > +++ b/drivers/hid/hid-input.c
> > > @@ -797,6 +797,10 @@ static void hidinput_configure_usage(struct
> > hid_input *hidinput, struct hid_fiel
> > >                         map_key_clear(BTN_STYLUS);
> > >                         break;
> > >
> > > +               case 0x45: /* ERASER */
> > > +                       map_key_clear(BTN_TOUCH);
> >
> > Surely you mean BTN_TOOL_RUBBER?
> 
> 
> No, I meant BTN_TOUCH since INVERT usage decides if an eraser is in
> proximity and send BTN_TOOL_RUBBER bit. Eraser usage means it is actually
> touching the device.

The reasoning makes sense, but it is indeed confusing, so I believe a 
small comment explaining it would be appropriate. Could you please add it 
and resend?

Thanks,

Patch

diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index 199f6a01fc62..4d36b08494fd 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -797,6 +797,10 @@  static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
 			map_key_clear(BTN_STYLUS);
 			break;
 
+		case 0x45: /* ERASER */
+			map_key_clear(BTN_TOUCH);
+			break;
+
 		case 0x46: /* TabletPick */
 		case 0x5a: /* SecondaryBarrelSwitch */
 			map_key_clear(BTN_STYLUS2);