linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCHv4 0/5] HID: initial USI support patches
@ 2021-12-10 11:11 Tero Kristo
  2021-12-10 11:11 ` [PATCHv4 1/5] HID: Add map_msc() to avoid boilerplate code Tero Kristo
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Tero Kristo @ 2021-12-10 11:11 UTC (permalink / raw)
  To: linux-input, benjamin.tissoires, jikos, mika.westerberg, tero.kristo
  Cc: linux-kernel, dmitry.torokhov, peter.hutterer

Hi,

As per request, this set contains initial USI support patches targeted
for 5.17. Any patches still under discussion dropped from this set.
Patch #3 is a split from previous revision, only containing the HID usage
definitions.

Series is based on top of hid/for-next.

-Tero



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

* [PATCHv4 1/5] HID: Add map_msc() to avoid boilerplate code
  2021-12-10 11:11 [PATCHv4 0/5] HID: initial USI support patches Tero Kristo
@ 2021-12-10 11:11 ` Tero Kristo
  2021-12-10 11:11 ` [PATCHv4 2/5] HID: hid-input: Add suffix also for HID_DG_PEN Tero Kristo
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: Tero Kristo @ 2021-12-10 11:11 UTC (permalink / raw)
  To: linux-input, benjamin.tissoires, jikos, mika.westerberg, tero.kristo
  Cc: linux-kernel, dmitry.torokhov, peter.hutterer

From: Mika Westerberg <mika.westerberg@linux.intel.com>

Since we are going to have more MSC events too, add map_msc() that can
be used to fill in necessary fields and avoid boilerplate code.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Tero Kristo <tero.kristo@linux.intel.com>
---
 drivers/hid/hid-input.c | 6 ++----
 include/linux/hid.h     | 4 ++++
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index 03f994541981..ad718ceb8af3 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -52,6 +52,7 @@ static const struct {
 #define map_rel(c)	hid_map_usage(hidinput, usage, &bit, &max, EV_REL, (c))
 #define map_key(c)	hid_map_usage(hidinput, usage, &bit, &max, EV_KEY, (c))
 #define map_led(c)	hid_map_usage(hidinput, usage, &bit, &max, EV_LED, (c))
+#define map_msc(c)	hid_map_usage(hidinput, usage, &bit, &max, EV_MSC, (c))
 
 #define map_abs_clear(c)	hid_map_usage_clear(hidinput, usage, &bit, \
 		&max, EV_ABS, (c))
@@ -876,10 +877,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
 
 		case 0x5b: /* TransducerSerialNumber */
 		case 0x6e: /* TransducerSerialNumber2 */
-			usage->type = EV_MSC;
-			usage->code = MSC_SERIAL;
-			bit = input->mscbit;
-			max = MSC_MAX;
+			map_msc(MSC_SERIAL);
 			break;
 
 		default:  goto unknown;
diff --git a/include/linux/hid.h b/include/linux/hid.h
index 313fa4a2554f..cc797d608951 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -1015,6 +1015,10 @@ static inline void hid_map_usage(struct hid_input *hidinput,
 		bmap = input->ledbit;
 		limit = LED_MAX;
 		break;
+	case EV_MSC:
+		bmap = input->mscbit;
+		limit = MSC_MAX;
+		break;
 	}
 
 	if (unlikely(c > limit || !bmap)) {
-- 
2.25.1


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

* [PATCHv4 2/5] HID: hid-input: Add suffix also for HID_DG_PEN
  2021-12-10 11:11 [PATCHv4 0/5] HID: initial USI support patches Tero Kristo
  2021-12-10 11:11 ` [PATCHv4 1/5] HID: Add map_msc() to avoid boilerplate code Tero Kristo
@ 2021-12-10 11:11 ` Tero Kristo
  2021-12-10 16:21   ` Benjamin Tissoires
  2021-12-10 11:11 ` [PATCHv4 3/5] HID: Add hid usages for USI style pens Tero Kristo
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 10+ messages in thread
From: Tero Kristo @ 2021-12-10 11:11 UTC (permalink / raw)
  To: linux-input, benjamin.tissoires, jikos, mika.westerberg, tero.kristo
  Cc: linux-kernel, dmitry.torokhov, peter.hutterer

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(-)

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


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

* [PATCHv4 3/5] HID: Add hid usages for USI style pens
  2021-12-10 11:11 [PATCHv4 0/5] HID: initial USI support patches Tero Kristo
  2021-12-10 11:11 ` [PATCHv4 1/5] HID: Add map_msc() to avoid boilerplate code Tero Kristo
  2021-12-10 11:11 ` [PATCHv4 2/5] HID: hid-input: Add suffix also for HID_DG_PEN Tero Kristo
@ 2021-12-10 11:11 ` Tero Kristo
  2021-12-10 11:11 ` [PATCHv4 4/5] HID: input: Make hidinput_find_field() static Tero Kristo
  2021-12-10 11:11 ` [PATCHv4 5/5] HID: debug: Add USI usages Tero Kristo
  4 siblings, 0 replies; 10+ messages in thread
From: Tero Kristo @ 2021-12-10 11:11 UTC (permalink / raw)
  To: linux-input, benjamin.tissoires, jikos, mika.westerberg, tero.kristo
  Cc: linux-kernel, dmitry.torokhov, peter.hutterer

Add usage codes for USI style pens, based on the USB-HID usage table:
    https://usb.org/document-library/hid-usage-tables-122

See chapter 16, Digitizers Page (0x0D)

Signed-off-by: Tero Kristo <tero.kristo@linux.intel.com>
---
 include/linux/hid.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/include/linux/hid.h b/include/linux/hid.h
index cc797d608951..b8634d17d11e 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -241,6 +241,7 @@ struct hid_item {
 #define HID_DG_TOUCH		0x000d0033
 #define HID_DG_UNTOUCH		0x000d0034
 #define HID_DG_TAP		0x000d0035
+#define HID_DG_TRANSDUCER_INDEX	0x000d0038
 #define HID_DG_TABLETFUNCTIONKEY	0x000d0039
 #define HID_DG_PROGRAMCHANGEKEY	0x000d003a
 #define HID_DG_BATTERYSTRENGTH	0x000d003b
@@ -253,6 +254,15 @@ struct hid_item {
 #define HID_DG_BARRELSWITCH	0x000d0044
 #define HID_DG_ERASER		0x000d0045
 #define HID_DG_TABLETPICK	0x000d0046
+#define HID_DG_PEN_COLOR			0x000d005c
+#define HID_DG_PEN_LINE_WIDTH			0x000d005e
+#define HID_DG_PEN_LINE_STYLE			0x000d0070
+#define HID_DG_PEN_LINE_STYLE_INK		0x000d0072
+#define HID_DG_PEN_LINE_STYLE_PENCIL		0x000d0073
+#define HID_DG_PEN_LINE_STYLE_HIGHLIGHTER	0x000d0074
+#define HID_DG_PEN_LINE_STYLE_CHISEL_MARKER	0x000d0075
+#define HID_DG_PEN_LINE_STYLE_BRUSH		0x000d0076
+#define HID_DG_PEN_LINE_STYLE_NO_PREFERENCE	0x000d0077
 
 #define HID_CP_CONSUMERCONTROL	0x000c0001
 #define HID_CP_NUMERICKEYPAD	0x000c0002
-- 
2.25.1


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

* [PATCHv4 4/5] HID: input: Make hidinput_find_field() static
  2021-12-10 11:11 [PATCHv4 0/5] HID: initial USI support patches Tero Kristo
                   ` (2 preceding siblings ...)
  2021-12-10 11:11 ` [PATCHv4 3/5] HID: Add hid usages for USI style pens Tero Kristo
@ 2021-12-10 11:11 ` Tero Kristo
  2021-12-10 11:11 ` [PATCHv4 5/5] HID: debug: Add USI usages Tero Kristo
  4 siblings, 0 replies; 10+ messages in thread
From: Tero Kristo @ 2021-12-10 11:11 UTC (permalink / raw)
  To: linux-input, benjamin.tissoires, jikos, mika.westerberg, tero.kristo
  Cc: linux-kernel, dmitry.torokhov, peter.hutterer

From: Mika Westerberg <mika.westerberg@linux.intel.com>

This function is not called outside of hid-input.c so we can make it
static.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Tero Kristo <tero.kristo@linux.intel.com>
---
 drivers/hid/hid-input.c | 4 ++--
 include/linux/hid.h     | 1 -
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index 78205e445652..1179ef1d257a 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -1463,7 +1463,8 @@ void hidinput_report_event(struct hid_device *hid, struct hid_report *report)
 }
 EXPORT_SYMBOL_GPL(hidinput_report_event);
 
-int hidinput_find_field(struct hid_device *hid, unsigned int type, unsigned int code, struct hid_field **field)
+static int hidinput_find_field(struct hid_device *hid, unsigned int type,
+			       unsigned int code, struct hid_field **field)
 {
 	struct hid_report *report;
 	int i, j;
@@ -1478,7 +1479,6 @@ int hidinput_find_field(struct hid_device *hid, unsigned int type, unsigned int
 	}
 	return -1;
 }
-EXPORT_SYMBOL_GPL(hidinput_find_field);
 
 struct hid_field *hidinput_get_led_field(struct hid_device *hid)
 {
diff --git a/include/linux/hid.h b/include/linux/hid.h
index b8634d17d11e..6b482c855605 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -904,7 +904,6 @@ extern void hidinput_disconnect(struct hid_device *);
 
 int hid_set_field(struct hid_field *, unsigned, __s32);
 int hid_input_report(struct hid_device *, int type, u8 *, u32, int);
-int hidinput_find_field(struct hid_device *hid, unsigned int type, unsigned int code, struct hid_field **field);
 struct hid_field *hidinput_get_led_field(struct hid_device *hid);
 unsigned int hidinput_count_leds(struct hid_device *hid);
 __s32 hidinput_calc_abs_res(const struct hid_field *field, __u16 code);
-- 
2.25.1


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

* [PATCHv4 5/5] HID: debug: Add USI usages
  2021-12-10 11:11 [PATCHv4 0/5] HID: initial USI support patches Tero Kristo
                   ` (3 preceding siblings ...)
  2021-12-10 11:11 ` [PATCHv4 4/5] HID: input: Make hidinput_find_field() static Tero Kristo
@ 2021-12-10 11:11 ` Tero Kristo
  4 siblings, 0 replies; 10+ messages in thread
From: Tero Kristo @ 2021-12-10 11:11 UTC (permalink / raw)
  To: linux-input, benjamin.tissoires, jikos, mika.westerberg, tero.kristo
  Cc: linux-kernel, dmitry.torokhov, peter.hutterer

From: Mika Westerberg <mika.westerberg@linux.intel.com>

Add USI defined usages to the HID debug code.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Tero Kristo <tero.kristo@linux.intel.com>
---
 drivers/hid/hid-debug.c | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/drivers/hid/hid-debug.c b/drivers/hid/hid-debug.c
index 7a92e2a04a09..26c31d759914 100644
--- a/drivers/hid/hid-debug.c
+++ b/drivers/hid/hid-debug.c
@@ -141,8 +141,10 @@ static const struct hid_usage_entry hid_usage_table[] = {
     {0, 0x33, "Touch"},
     {0, 0x34, "UnTouch"},
     {0, 0x35, "Tap"},
+    {0, 0x38, "Transducer Index"},
     {0, 0x39, "TabletFunctionKey"},
     {0, 0x3a, "ProgramChangeKey"},
+    {0, 0x3B, "Battery Strength"},
     {0, 0x3c, "Invert"},
     {0, 0x42, "TipSwitch"},
     {0, 0x43, "SecondaryTipSwitch"},
@@ -160,7 +162,40 @@ static const struct hid_usage_entry hid_usage_table[] = {
     {0, 0x59, "ButtonType"},
     {0, 0x5A, "SecondaryBarrelSwitch"},
     {0, 0x5B, "TransducerSerialNumber"},
+    {0, 0x5C, "Preferred Color"},
+    {0, 0x5D, "Preferred Color is Locked"},
+    {0, 0x5E, "Preferred Line Width"},
+    {0, 0x5F, "Preferred Line Width is Locked"},
     {0, 0x6e, "TransducerSerialNumber2"},
+    {0, 0x70, "Preferred Line Style"},
+      {0, 0x71, "Preferred Line Style is Locked"},
+      {0, 0x72, "Ink"},
+      {0, 0x73, "Pencil"},
+      {0, 0x74, "Highlighter"},
+      {0, 0x75, "Chisel Marker"},
+      {0, 0x76, "Brush"},
+      {0, 0x77, "No Preference"},
+    {0, 0x80, "Digitizer Diagnostic"},
+    {0, 0x81, "Digitizer Error"},
+      {0, 0x82, "Err Normal Status"},
+      {0, 0x83, "Err Transducers Exceeded"},
+      {0, 0x84, "Err Full Trans Features Unavailable"},
+      {0, 0x85, "Err Charge Low"},
+    {0, 0x90, "Transducer Software Info"},
+      {0, 0x91, "Transducer Vendor Id"},
+      {0, 0x92, "Transducer Product Id"},
+    {0, 0x93, "Device Supported Protocols"},
+    {0, 0x94, "Transducer Supported Protocols"},
+      {0, 0x95, "No Protocol"},
+      {0, 0x96, "Wacom AES Protocol"},
+      {0, 0x97, "USI Protocol"},
+      {0, 0x98, "Microsoft Pen Protocol"},
+    {0, 0xA0, "Supported Report Rates"},
+      {0, 0xA1, "Report Rate"},
+      {0, 0xA2, "Transducer Connected"},
+      {0, 0xA3, "Switch Disabled"},
+      {0, 0xA4, "Switch Unimplemented"},
+      {0, 0xA5, "Transducer Switches"},
   { 15, 0, "PhysicalInterfaceDevice" },
     {0, 0x00, "Undefined"},
     {0, 0x01, "Physical_Interface_Device"},
-- 
2.25.1


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

* Re: [PATCHv4 2/5] HID: hid-input: Add suffix also for HID_DG_PEN
  2021-12-10 11:11 ` [PATCHv4 2/5] HID: hid-input: Add suffix also for HID_DG_PEN Tero Kristo
@ 2021-12-10 16:21   ` Benjamin Tissoires
  2021-12-10 17:51     ` Tero Kristo
  0 siblings, 1 reply; 10+ messages in thread
From: Benjamin Tissoires @ 2021-12-10 16:21 UTC (permalink / raw)
  To: Tero Kristo
  Cc: open list:HID CORE LAYER, Jiri Kosina, Mika Westerberg, lkml,
	Dmitry Torokhov, Peter Hutterer



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.

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
>


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

* Re: [PATCHv4 2/5] HID: hid-input: Add suffix also for HID_DG_PEN
  2021-12-10 16:21   ` Benjamin Tissoires
@ 2021-12-10 17:51     ` Tero Kristo
  2021-12-14 12:35       ` Benjamin Tissoires
  0 siblings, 1 reply; 10+ messages in thread
From: Tero Kristo @ 2021-12-10 17:51 UTC (permalink / raw)
  To: Benjamin Tissoires
  Cc: open list:HID CORE LAYER, Jiri Kosina, Mika Westerberg, lkml,
	Dmitry Torokhov, Peter Hutterer


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
>>
>

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

* Re: [PATCHv4 2/5] HID: hid-input: Add suffix also for HID_DG_PEN
  2021-12-10 17:51     ` Tero Kristo
@ 2021-12-14 12:35       ` Benjamin Tissoires
  2021-12-14 12:50         ` Tero Kristo
  0 siblings, 1 reply; 10+ messages in thread
From: Benjamin Tissoires @ 2021-12-14 12:35 UTC (permalink / raw)
  To: Tero Kristo
  Cc: open list:HID CORE LAYER, Jiri Kosina, Mika Westerberg, lkml,
	Dmitry Torokhov, Peter Hutterer

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
> >>
> >
>


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

* Re: [PATCHv4 2/5] HID: hid-input: Add suffix also for HID_DG_PEN
  2021-12-14 12:35       ` Benjamin Tissoires
@ 2021-12-14 12:50         ` Tero Kristo
  0 siblings, 0 replies; 10+ messages in thread
From: Tero Kristo @ 2021-12-14 12:50 UTC (permalink / raw)
  To: Benjamin Tissoires
  Cc: open list:HID CORE LAYER, Jiri Kosina, Mika Westerberg, lkml,
	Dmitry Torokhov, Peter Hutterer


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
>>>>

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

end of thread, other threads:[~2021-12-14 12:50 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-10 11:11 [PATCHv4 0/5] HID: initial USI support patches Tero Kristo
2021-12-10 11:11 ` [PATCHv4 1/5] HID: Add map_msc() to avoid boilerplate code Tero Kristo
2021-12-10 11:11 ` [PATCHv4 2/5] HID: hid-input: Add suffix also for HID_DG_PEN Tero Kristo
2021-12-10 16:21   ` Benjamin Tissoires
2021-12-10 17:51     ` Tero Kristo
2021-12-14 12:35       ` Benjamin Tissoires
2021-12-14 12:50         ` Tero Kristo
2021-12-10 11:11 ` [PATCHv4 3/5] HID: Add hid usages for USI style pens Tero Kristo
2021-12-10 11:11 ` [PATCHv4 4/5] HID: input: Make hidinput_find_field() static Tero Kristo
2021-12-10 11:11 ` [PATCHv4 5/5] HID: debug: Add USI usages Tero Kristo

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).