diff mbox series

[PATCHv4,2/5] HID: hid-input: Add suffix also for HID_DG_PEN

Message ID 20211210111138.1248187-3-tero.kristo@linux.intel.com
State New
Headers show
Series HID: initial USI support patches | expand

Commit Message

Tero Kristo Dec. 10, 2021, 11:11 a.m. UTC
From: Mika Westerberg <mika.westerberg@linux.intel.com>

This and HID_DG_STYLUS are pretty much the same thing so add suffix for
HID_DG_PEN too. This makes the input device name look better.

While doing this, remove the suffix override from hid-multitouch, as it
is now handled by hid-input. Also, the suffix override done by
hid-multitouch was wrong, as it mapped HID_DG_PEN => "Stylus" and
HID_DG_STYLUS => "Pen".

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Tero Kristo <tero.kristo@linux.intel.com>
---
 drivers/hid/hid-input.c      | 1 +
 drivers/hid/hid-multitouch.c | 3 ---
 2 files changed, 1 insertion(+), 3 deletions(-)

Comments

Tero Kristo Dec. 10, 2021, 5:51 p.m. UTC | #1
On 10/12/2021 18:21, Benjamin Tissoires wrote:
>
>
> On Fri, Dec 10, 2021 at 12:12 PM Tero Kristo 
> <tero.kristo@linux.intel.com> wrote:
>>
>> From: Mika Westerberg <mika.westerberg@linux.intel.com>
>>
>> This and HID_DG_STYLUS are pretty much the same thing so add suffix for
>> HID_DG_PEN too. This makes the input device name look better.
>>
>> While doing this, remove the suffix override from hid-multitouch, as it
>> is now handled by hid-input. Also, the suffix override done by
>> hid-multitouch was wrong, as it mapped HID_DG_PEN => "Stylus" and
>> HID_DG_STYLUS => "Pen".
>
> FWIW, I was thinking at the following:
> ---
> diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
> index 837585f4e673..fe0da7bf24a9 100644
> --- a/drivers/hid/hid-input.c
> +++ b/drivers/hid/hid-input.c
> @@ -1775,6 +1775,15 @@ static struct hid_input 
> *hidinput_allocate(struct hid_device *hid,
>                         suffix = "Mouse";
>                         break;
>                 case HID_DG_PEN:
> +                       /*
> +                        * yes, there is an issue here:
> +                        *  DG_PEN -> "Stylus"
> +                        *  DG_STYLUS -> "Pen"
> +                        * But changing this now means users with 
> config snippets
> +                        * will have to change it and the test suite 
> will not be happy.
> +                        */
> +                       suffix = "Stylus";
> +                       break;
>                 case HID_DG_STYLUS:
>                         suffix = "Pen";
>                         break;
> ---
>
> Because the current patch breaks the test suite.

Ah I see, do you want me to re-post in this form?

-Tero

>
> Cheers,
> Benjamin
>
>>
>> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
>> Signed-off-by: Tero Kristo <tero.kristo@linux.intel.com>
>> ---
>>  drivers/hid/hid-input.c      | 1 +
>>  drivers/hid/hid-multitouch.c | 3 ---
>>  2 files changed, 1 insertion(+), 3 deletions(-)
>>
>> diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
>> index ad718ceb8af3..78205e445652 100644
>> --- a/drivers/hid/hid-input.c
>> +++ b/drivers/hid/hid-input.c
>> @@ -1741,6 +1741,7 @@ static struct hid_input 
>> *hidinput_allocate(struct hid_device *hid,
>>                 case HID_GD_MOUSE:
>>                         suffix = "Mouse";
>>                         break;
>> +               case HID_DG_PEN:
>>                 case HID_DG_STYLUS:
>>                         suffix = "Pen";
>>                         break;
>> diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
>> index 082376a6cb3d..99eabfb4145b 100644
>> --- a/drivers/hid/hid-multitouch.c
>> +++ b/drivers/hid/hid-multitouch.c
>> @@ -1606,9 +1606,6 @@ static int mt_input_configured(struct 
>> hid_device *hdev, struct hid_input *hi)
>>         case HID_DG_STYLUS:
>>                 /* force BTN_STYLUS to allow tablet matching in udev */
>>                 __set_bit(BTN_STYLUS, hi->input->keybit);
>> -               fallthrough;
>> -       case HID_DG_PEN:
>> -               suffix = "Stylus";
>>                 break;
>>         default:
>>                 suffix = "UNKNOWN";
>> -- 
>> 2.25.1
>>
>
Benjamin Tissoires Dec. 14, 2021, 12:35 p.m. UTC | #2
On Fri, Dec 10, 2021 at 6:51 PM Tero Kristo <tero.kristo@linux.intel.com> wrote:
>
>
> On 10/12/2021 18:21, Benjamin Tissoires wrote:
> >
> >
> > On Fri, Dec 10, 2021 at 12:12 PM Tero Kristo
> > <tero.kristo@linux.intel.com> wrote:
> >>
> >> From: Mika Westerberg <mika.westerberg@linux.intel.com>
> >>
> >> This and HID_DG_STYLUS are pretty much the same thing so add suffix for
> >> HID_DG_PEN too. This makes the input device name look better.
> >>
> >> While doing this, remove the suffix override from hid-multitouch, as it
> >> is now handled by hid-input. Also, the suffix override done by
> >> hid-multitouch was wrong, as it mapped HID_DG_PEN => "Stylus" and
> >> HID_DG_STYLUS => "Pen".
> >
> > FWIW, I was thinking at the following:
> > ---
> > diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
> > index 837585f4e673..fe0da7bf24a9 100644
> > --- a/drivers/hid/hid-input.c
> > +++ b/drivers/hid/hid-input.c
> > @@ -1775,6 +1775,15 @@ static struct hid_input
> > *hidinput_allocate(struct hid_device *hid,
> >                         suffix = "Mouse";
> >                         break;
> >                 case HID_DG_PEN:
> > +                       /*
> > +                        * yes, there is an issue here:
> > +                        *  DG_PEN -> "Stylus"
> > +                        *  DG_STYLUS -> "Pen"
> > +                        * But changing this now means users with
> > config snippets
> > +                        * will have to change it and the test suite
> > will not be happy.
> > +                        */
> > +                       suffix = "Stylus";
> > +                       break;
> >                 case HID_DG_STYLUS:
> >                         suffix = "Pen";
> >                         break;
> > ---
> >
> > Because the current patch breaks the test suite.
>
> Ah I see, do you want me to re-post in this form?

Nah, no need for a repost. I fixed the patch locally and pushed to
for-5.17/core.

Cheers,
Benjamin

>
> -Tero
>
> >
> > Cheers,
> > Benjamin
> >
> >>
> >> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
> >> Signed-off-by: Tero Kristo <tero.kristo@linux.intel.com>
> >> ---
> >>  drivers/hid/hid-input.c      | 1 +
> >>  drivers/hid/hid-multitouch.c | 3 ---
> >>  2 files changed, 1 insertion(+), 3 deletions(-)
> >>
> >> diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
> >> index ad718ceb8af3..78205e445652 100644
> >> --- a/drivers/hid/hid-input.c
> >> +++ b/drivers/hid/hid-input.c
> >> @@ -1741,6 +1741,7 @@ static struct hid_input
> >> *hidinput_allocate(struct hid_device *hid,
> >>                 case HID_GD_MOUSE:
> >>                         suffix = "Mouse";
> >>                         break;
> >> +               case HID_DG_PEN:
> >>                 case HID_DG_STYLUS:
> >>                         suffix = "Pen";
> >>                         break;
> >> diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
> >> index 082376a6cb3d..99eabfb4145b 100644
> >> --- a/drivers/hid/hid-multitouch.c
> >> +++ b/drivers/hid/hid-multitouch.c
> >> @@ -1606,9 +1606,6 @@ static int mt_input_configured(struct
> >> hid_device *hdev, struct hid_input *hi)
> >>         case HID_DG_STYLUS:
> >>                 /* force BTN_STYLUS to allow tablet matching in udev */
> >>                 __set_bit(BTN_STYLUS, hi->input->keybit);
> >> -               fallthrough;
> >> -       case HID_DG_PEN:
> >> -               suffix = "Stylus";
> >>                 break;
> >>         default:
> >>                 suffix = "UNKNOWN";
> >> --
> >> 2.25.1
> >>
> >
>
Tero Kristo Dec. 14, 2021, 12:50 p.m. UTC | #3
On 14/12/2021 14:35, Benjamin Tissoires wrote:
> On Fri, Dec 10, 2021 at 6:51 PM Tero Kristo <tero.kristo@linux.intel.com> wrote:
>>
>> On 10/12/2021 18:21, Benjamin Tissoires wrote:
>>>
>>> On Fri, Dec 10, 2021 at 12:12 PM Tero Kristo
>>> <tero.kristo@linux.intel.com> wrote:
>>>> From: Mika Westerberg <mika.westerberg@linux.intel.com>
>>>>
>>>> This and HID_DG_STYLUS are pretty much the same thing so add suffix for
>>>> HID_DG_PEN too. This makes the input device name look better.
>>>>
>>>> While doing this, remove the suffix override from hid-multitouch, as it
>>>> is now handled by hid-input. Also, the suffix override done by
>>>> hid-multitouch was wrong, as it mapped HID_DG_PEN => "Stylus" and
>>>> HID_DG_STYLUS => "Pen".
>>> FWIW, I was thinking at the following:
>>> ---
>>> diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
>>> index 837585f4e673..fe0da7bf24a9 100644
>>> --- a/drivers/hid/hid-input.c
>>> +++ b/drivers/hid/hid-input.c
>>> @@ -1775,6 +1775,15 @@ static struct hid_input
>>> *hidinput_allocate(struct hid_device *hid,
>>>                          suffix = "Mouse";
>>>                          break;
>>>                  case HID_DG_PEN:
>>> +                       /*
>>> +                        * yes, there is an issue here:
>>> +                        *  DG_PEN -> "Stylus"
>>> +                        *  DG_STYLUS -> "Pen"
>>> +                        * But changing this now means users with
>>> config snippets
>>> +                        * will have to change it and the test suite
>>> will not be happy.
>>> +                        */
>>> +                       suffix = "Stylus";
>>> +                       break;
>>>                  case HID_DG_STYLUS:
>>>                          suffix = "Pen";
>>>                          break;
>>> ---
>>>
>>> Because the current patch breaks the test suite.
>> Ah I see, do you want me to re-post in this form?
> Nah, no need for a repost. I fixed the patch locally and pushed to
> for-5.17/core.

Thanks a lot!

-Tero


> Cheers,
> Benjamin
>
>> -Tero
>>
>>> Cheers,
>>> Benjamin
>>>
>>>> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
>>>> Signed-off-by: Tero Kristo <tero.kristo@linux.intel.com>
>>>> ---
>>>>   drivers/hid/hid-input.c      | 1 +
>>>>   drivers/hid/hid-multitouch.c | 3 ---
>>>>   2 files changed, 1 insertion(+), 3 deletions(-)
>>>>
>>>> diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
>>>> index ad718ceb8af3..78205e445652 100644
>>>> --- a/drivers/hid/hid-input.c
>>>> +++ b/drivers/hid/hid-input.c
>>>> @@ -1741,6 +1741,7 @@ static struct hid_input
>>>> *hidinput_allocate(struct hid_device *hid,
>>>>                  case HID_GD_MOUSE:
>>>>                          suffix = "Mouse";
>>>>                          break;
>>>> +               case HID_DG_PEN:
>>>>                  case HID_DG_STYLUS:
>>>>                          suffix = "Pen";
>>>>                          break;
>>>> diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
>>>> index 082376a6cb3d..99eabfb4145b 100644
>>>> --- a/drivers/hid/hid-multitouch.c
>>>> +++ b/drivers/hid/hid-multitouch.c
>>>> @@ -1606,9 +1606,6 @@ static int mt_input_configured(struct
>>>> hid_device *hdev, struct hid_input *hi)
>>>>          case HID_DG_STYLUS:
>>>>                  /* force BTN_STYLUS to allow tablet matching in udev */
>>>>                  __set_bit(BTN_STYLUS, hi->input->keybit);
>>>> -               fallthrough;
>>>> -       case HID_DG_PEN:
>>>> -               suffix = "Stylus";
>>>>                  break;
>>>>          default:
>>>>                  suffix = "UNKNOWN";
>>>> --
>>>> 2.25.1
>>>>
diff mbox series

Patch

diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index ad718ceb8af3..78205e445652 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -1741,6 +1741,7 @@  static struct hid_input *hidinput_allocate(struct hid_device *hid,
 		case HID_GD_MOUSE:
 			suffix = "Mouse";
 			break;
+		case HID_DG_PEN:
 		case HID_DG_STYLUS:
 			suffix = "Pen";
 			break;
diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
index 082376a6cb3d..99eabfb4145b 100644
--- a/drivers/hid/hid-multitouch.c
+++ b/drivers/hid/hid-multitouch.c
@@ -1606,9 +1606,6 @@  static int mt_input_configured(struct hid_device *hdev, struct hid_input *hi)
 	case HID_DG_STYLUS:
 		/* force BTN_STYLUS to allow tablet matching in udev */
 		__set_bit(BTN_STYLUS, hi->input->keybit);
-		fallthrough;
-	case HID_DG_PEN:
-		suffix = "Stylus";
 		break;
 	default:
 		suffix = "UNKNOWN";