linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* hid-multitouch: goodix: hovering works as touch
@ 2020-07-30 16:23 Dmitry Mastykin
  2020-07-31 13:07 ` UPD: " Dmitry Mastykin
  2021-04-14 15:35 ` Vitaly Minko
  0 siblings, 2 replies; 9+ messages in thread
From: Dmitry Mastykin @ 2020-07-30 16:23 UTC (permalink / raw)
  To: linux-input; +Cc: Hans de Goede

[-- Attachment #1: Type: text/plain, Size: 3178 bytes --]

Hello all,

I'm using a notebook with Goodix gt7385p touchscreen controller in HID 
Protocol Device (I2C bus) mode.

hid-multitouch driver is servicing this device. I added this to be sure 
the quirks set:
	{ .driver_data = MT_CLS_WIN_8_DUAL,
		HID_DEVICE(BUS_I2C, HID_GROUP_MULTITOUCH_WIN_8,
			I2C_VENDOR_ID_GOODIX,
			I2C_DEVICE_ID_GOODIX_0113) },

The problem is that hovering works as touch, and UI menus and buttons 
are activated before I touch the panel with stylus. I attach evtest 
output of touching panel be stylus and removing stylus away.

Trying a wacom pen tablet, borrowed from my daughter, I see that they 
use such a sequence:
EV_KEY BTN_TOOL_PEN 1 - start hovering here
EV_KEY BTN_TOUCH 1 - start touching
EV_KEY BTN_TOUCH 0 - stop touching
EV_KEY BTN_TOOL_PEN 0 - stop hovering

Just to make the touchscreen working I tried to add BTN_TOUCH reports to 
hid-multitouch for my device. But as soon as I add 
input_set_capability(hi->input, EV_KEY, BTN_TOUCH), I see BTN_TOUCH 0 / 
BTN_TOUCH 1 pair in every report.

So 2 questions that I have:
1) is the sequence in evtest.txt correct?
2) who may report BTN_TOUCH 0/1 pairs when BTN_TOUCH capability is 
added? I tried to search with debug messages in hid-input.c and 
hid-multitouch.c but without success.

Thank you in advance!
Dmitry Mastykin

Here is the citation from dmesg:
----------------------------------------------------------------------
[    5.032956] i2c_hid i2c-GXTP7380:00: i2c-GXTP7380:00 supply vdd not 
found, using dummy regulator
[    5.032979] i2c_hid i2c-GXTP7380:00: i2c-GXTP7380:00 supply vddl not 
found, using dummy regulator                [    5.088245] input: 
GXTP7380:00 27C6:0113 Touchscreen as 
/devices/pci0000:00/0000:00:17.0/i2c_designware.4/i2c-9/i
2c-GXTP7380:00/0018:27C6:0113.0001/input/input14 
                                            [    5.109607] input: 
GXTP7380:00 27C6:0113 as 
/devices/pci0000:00/0000:00:17.0/i2c_designware.4/i2c-9/i2c-GXTP7380:
00/0018:27C6:0113.0001/input/input15 
                                            [    5.112486] input: 
GXTP7380:00 27C6:0113 as 
/devices/pci0000:00/0000:00:17.0/i2c_designware.4/i2c-9/i2c-GXTP7380:
00/0018:27C6:0113.0001/input/input16 
                                            [    5.112561] hid-generic 
0018:27C6:0113.0001: input,hidraw0: I2C HID v1.00 Device [GXTP7380:00 
27C6:0113] on i2c-G
XTP7380:00 
                                            [    6.417241] input: 
GXTP7380:00 27C6:0113 as 
/devices/pci0000:00/0000:00:17.0/i2c_designware.4/i2c-9/i2c-GXTP7380:
00/0018:27C6:0113.0001/input/input20 
                                            [    6.417833] input: 
GXTP7380:00 27C6:0113 Stylus as 
/devices/pci0000:00/0000:00:17.0/i2c_designware.4/i2c-9/i2c-GX
TP7380:00/0018:27C6:0113.0001/input/input21 
                                            [    6.417902] input: 
GXTP7380:00 27C6:0113 UNKNOWN as 
/devices/pci0000:00/0000:00:17.0/i2c_designware.4/i2c-9/i2c-G
XTP7380:00/0018:27C6:0113.0001/input/input22 
                                            [    6.417973] 
hid-multitouch 0018:27C6:0113.0001: input,hidraw0: I2C HID v1.00 Device 
[GXTP7380:00 27C6:0113] on i2
c-GXTP7380:00

[-- Attachment #2: evtest.txt --]
[-- Type: text/plain, Size: 4855 bytes --]

Input driver version is 1.0.1
Input device ID: bus 0x18 vendor 0x27c6 product 0x113 version 0x100
Input device name: "GXTP7380:00 27C6:0113 Stylus"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
  Event type 3 (EV_ABS)
    Event code 47 (ABS_MT_SLOT)
      Value      0
      Min        0
      Max        9
    Event code 53 (ABS_MT_POSITION_X)
      Value      0
      Min        0
      Max      960
      Resolution       4
    Event code 54 (ABS_MT_POSITION_Y)
      Value      0
      Min        0
      Max      540
      Resolution       3
    Event code 57 (ABS_MT_TRACKING_ID)
      Value      0
      Min        0
      Max    65535
    Event code 58 (ABS_MT_PRESSURE)
      Value      0
      Min        0
      Max     1023
    Event code 59 (ABS_MT_DISTANCE)
      Value      0
      Min        0
      Max        1
Properties:
  Property type 1 (INPUT_PROP_DIRECT)
Testing ... (interrupt to exit)
Event: time 1596124249.087943, type 3 (EV_ABS), code 57 (ABS_MT_TRACKING_ID), value 0
Event: time 1596124249.087943, type 3 (EV_ABS), code 53 (ABS_MT_POSITION_X), value 599
Event: time 1596124249.087943, type 3 (EV_ABS), code 54 (ABS_MT_POSITION_Y), value 340
Event: time 1596124249.087943, type 3 (EV_ABS), code 59 (ABS_MT_DISTANCE), value 1
Event: time 1596124249.087943, type 3 (EV_ABS), code 58 (ABS_MT_PRESSURE), value 139
Event: time 1596124249.087943, -------------- SYN_REPORT ------------
Event: time 1596124249.097234, type 3 (EV_ABS), code 59 (ABS_MT_DISTANCE), value 0
Event: time 1596124249.097234, type 3 (EV_ABS), code 58 (ABS_MT_PRESSURE), value 201
Event: time 1596124249.097234, -------------- SYN_REPORT ------------
Event: time 1596124249.101803, type 3 (EV_ABS), code 58 (ABS_MT_PRESSURE), value 260
Event: time 1596124249.101803, -------------- SYN_REPORT ------------
Event: time 1596124249.112267, type 3 (EV_ABS), code 58 (ABS_MT_PRESSURE), value 289
Event: time 1596124249.112267, -------------- SYN_REPORT ------------
Event: time 1596124249.116674, type 3 (EV_ABS), code 58 (ABS_MT_PRESSURE), value 266
Event: time 1596124249.116674, -------------- SYN_REPORT ------------
Event: time 1596124249.127249, type 3 (EV_ABS), code 53 (ABS_MT_POSITION_X), value 598
Event: time 1596124249.127249, type 3 (EV_ABS), code 58 (ABS_MT_PRESSURE), value 223
Event: time 1596124249.127249, -------------- SYN_REPORT ------------
Event: time 1596124249.131745, type 3 (EV_ABS), code 54 (ABS_MT_POSITION_Y), value 339
Event: time 1596124249.131745, type 3 (EV_ABS), code 58 (ABS_MT_PRESSURE), value 181
Event: time 1596124249.131745, -------------- SYN_REPORT ------------
Event: time 1596124249.142256, type 3 (EV_ABS), code 53 (ABS_MT_POSITION_X), value 597
Event: time 1596124249.142256, type 3 (EV_ABS), code 54 (ABS_MT_POSITION_Y), value 338
Event: time 1596124249.142256, type 3 (EV_ABS), code 58 (ABS_MT_PRESSURE), value 161
Event: time 1596124249.142256, -------------- SYN_REPORT ------------
Event: time 1596124249.146603, type 3 (EV_ABS), code 53 (ABS_MT_POSITION_X), value 596
Event: time 1596124249.146603, type 3 (EV_ABS), code 54 (ABS_MT_POSITION_Y), value 337
Event: time 1596124249.146603, type 3 (EV_ABS), code 59 (ABS_MT_DISTANCE), value 1
Event: time 1596124249.146603, type 3 (EV_ABS), code 58 (ABS_MT_PRESSURE), value 0
Event: time 1596124249.146603, -------------- SYN_REPORT ------------
Event: time 1596124249.172060, type 3 (EV_ABS), code 54 (ABS_MT_POSITION_Y), value 336
Event: time 1596124249.172060, -------------- SYN_REPORT ------------
Event: time 1596124249.202273, type 3 (EV_ABS), code 53 (ABS_MT_POSITION_X), value 595
Event: time 1596124249.202273, type 3 (EV_ABS), code 54 (ABS_MT_POSITION_Y), value 335
Event: time 1596124249.202273, -------------- SYN_REPORT ------------
Event: time 1596124249.206695, type 3 (EV_ABS), code 54 (ABS_MT_POSITION_Y), value 334
Event: time 1596124249.206695, -------------- SYN_REPORT ------------
Event: time 1596124249.217088, type 3 (EV_ABS), code 54 (ABS_MT_POSITION_Y), value 333
Event: time 1596124249.217088, -------------- SYN_REPORT ------------
Event: time 1596124249.232096, type 3 (EV_ABS), code 54 (ABS_MT_POSITION_Y), value 331
Event: time 1596124249.232096, -------------- SYN_REPORT ------------
Event: time 1596124249.236768, type 3 (EV_ABS), code 54 (ABS_MT_POSITION_Y), value 330
Event: time 1596124249.236768, -------------- SYN_REPORT ------------
Event: time 1596124249.247150, type 3 (EV_ABS), code 54 (ABS_MT_POSITION_Y), value 329
Event: time 1596124249.247150, -------------- SYN_REPORT ------------
Event: time 1596124249.251871, type 3 (EV_ABS), code 54 (ABS_MT_POSITION_Y), value 328
Event: time 1596124249.251871, -------------- SYN_REPORT ------------
Event: time 1596124249.262288, type 3 (EV_ABS), code 57 (ABS_MT_TRACKING_ID), value -1
Event: time 1596124249.262288, -------------- SYN_REPORT ------------

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

* UPD: hid-multitouch: goodix: hovering works as touch
  2020-07-30 16:23 hid-multitouch: goodix: hovering works as touch Dmitry Mastykin
@ 2020-07-31 13:07 ` Dmitry Mastykin
  2021-04-14 15:35 ` Vitaly Minko
  1 sibling, 0 replies; 9+ messages in thread
From: Dmitry Mastykin @ 2020-07-31 13:07 UTC (permalink / raw)
  To: linux-input; +Cc: Hans de Goede, benjamin.tissoires

Hello,
I tried touchscreen with kernel 4.15 (ubuntu) and hid-multitouch gives 
me BTN_TOOL_PEN and BTN_TOUCH events, so both hovering and touching work.
Back to kernel 5.4 I noticed that I don't see BTN_TOUCH among supported 
events, despite of this (hid-multitouch/mt_touch_input_mapping):

case HID_DG_TIPSWITCH:
	if (field->application != HID_GD_SYSTEM_MULTIAXIS) {
		input_set_capability(hi->input, EV_KEY, BTN_TOUCH);
	}
	MT_STORE_FIELD(tip_state);
	return 1;

But after I added:
case HID_DG_ERASER: // comes from my device
	return -1;

BTN_TOUCH appeared again in supported events, and I see it appearing in 
evtest output in the moments of start/stop hovering. I would like to see 
BTN_TOOL_PEN instead...

Please, could you suggest, where could be a problem?
Thank you very much!
Dmitry Mastykin


On 7/30/20 7:23 PM, Dmitry Mastykin wrote:
> Hello all,
> 
> I'm using a notebook with Goodix gt7385p touchscreen controller in HID 
> Protocol Device (I2C bus) mode.
> 
> hid-multitouch driver is servicing this device. I added this to be sure 
> the quirks set:
>      { .driver_data = MT_CLS_WIN_8_DUAL,
>          HID_DEVICE(BUS_I2C, HID_GROUP_MULTITOUCH_WIN_8,
>              I2C_VENDOR_ID_GOODIX,
>              I2C_DEVICE_ID_GOODIX_0113) },
> 
> The problem is that hovering works as touch, and UI menus and buttons 
> are activated before I touch the panel with stylus. I attach evtest 
> output of touching panel be stylus and removing stylus away.
> 
> Trying a wacom pen tablet, borrowed from my daughter, I see that they 
> use such a sequence:
> EV_KEY BTN_TOOL_PEN 1 - start hovering here
> EV_KEY BTN_TOUCH 1 - start touching
> EV_KEY BTN_TOUCH 0 - stop touching
> EV_KEY BTN_TOOL_PEN 0 - stop hovering
> 
> Just to make the touchscreen working I tried to add BTN_TOUCH reports to 
> hid-multitouch for my device. But as soon as I add 
> input_set_capability(hi->input, EV_KEY, BTN_TOUCH), I see BTN_TOUCH 0 / 
> BTN_TOUCH 1 pair in every report.
> 
> So 2 questions that I have:
> 1) is the sequence in evtest.txt correct?
> 2) who may report BTN_TOUCH 0/1 pairs when BTN_TOUCH capability is 
> added? I tried to search with debug messages in hid-input.c and 
> hid-multitouch.c but without success.
> 
> Thank you in advance!
> Dmitry Mastykin
> 
> Here is the citation from dmesg:
> ----------------------------------------------------------------------
> [    5.032956] i2c_hid i2c-GXTP7380:00: i2c-GXTP7380:00 supply vdd not 
> found, using dummy regulator
> [    5.032979] i2c_hid i2c-GXTP7380:00: i2c-GXTP7380:00 supply vddl not 
> found, using dummy regulator                [    5.088245] input: 
> GXTP7380:00 27C6:0113 Touchscreen as 
> /devices/pci0000:00/0000:00:17.0/i2c_designware.4/i2c-9/i
> 2c-GXTP7380:00/0018:27C6:0113.0001/input/input14 
>                                             [    5.109607] input: 
> GXTP7380:00 27C6:0113 as 
> /devices/pci0000:00/0000:00:17.0/i2c_designware.4/i2c-9/i2c-GXTP7380:
> 00/0018:27C6:0113.0001/input/input15 
>                                             [    5.112486] input: 
> GXTP7380:00 27C6:0113 as 
> /devices/pci0000:00/0000:00:17.0/i2c_designware.4/i2c-9/i2c-GXTP7380:
> 00/0018:27C6:0113.0001/input/input16 
>                                             [    5.112561] hid-generic 
> 0018:27C6:0113.0001: input,hidraw0: I2C HID v1.00 Device [GXTP7380:00 
> 27C6:0113] on i2c-G
> XTP7380:00                                            [    6.417241] 
> input: GXTP7380:00 27C6:0113 as 
> /devices/pci0000:00/0000:00:17.0/i2c_designware.4/i2c-9/i2c-GXTP7380:
> 00/0018:27C6:0113.0001/input/input20 
>                                             [    6.417833] input: 
> GXTP7380:00 27C6:0113 Stylus as 
> /devices/pci0000:00/0000:00:17.0/i2c_designware.4/i2c-9/i2c-GX
> TP7380:00/0018:27C6:0113.0001/input/input21 
>                                             [    6.417902] input: 
> GXTP7380:00 27C6:0113 UNKNOWN as 
> /devices/pci0000:00/0000:00:17.0/i2c_designware.4/i2c-9/i2c-G
> XTP7380:00/0018:27C6:0113.0001/input/input22 
>                                             [    6.417973] 
> hid-multitouch 0018:27C6:0113.0001: input,hidraw0: I2C HID v1.00 Device 
> [GXTP7380:00 27C6:0113] on i2
> c-GXTP7380:00


evtest.txt
Input driver version is 1.0.1
Input device ID: bus 0x18 vendor 0x27c6 product 0x113 version 0x100
Input device name: "GXTP7380:00 27C6:0113 Stylus"
Supported events:
   Event type 0 (EV_SYN)
   Event type 1 (EV_KEY)
   Event type 3 (EV_ABS)
     Event code 47 (ABS_MT_SLOT)
       Value      0
       Min        0
       Max        9
     Event code 53 (ABS_MT_POSITION_X)
       Value      0
       Min        0
       Max      960
       Resolution       4
     Event code 54 (ABS_MT_POSITION_Y)
       Value      0
       Min        0
       Max      540
       Resolution       3
     Event code 57 (ABS_MT_TRACKING_ID)
       Value      0
       Min        0
       Max    65535
     Event code 58 (ABS_MT_PRESSURE)
       Value      0
       Min        0
       Max     1023
     Event code 59 (ABS_MT_DISTANCE)
       Value      0
       Min        0
       Max        1
Properties:
   Property type 1 (INPUT_PROP_DIRECT)
Testing ... (interrupt to exit)
Event: time 1596124249.087943, type 3 (EV_ABS), code 57 
(ABS_MT_TRACKING_ID), value 0
Event: time 1596124249.087943, type 3 (EV_ABS), code 53 
(ABS_MT_POSITION_X), value 599
Event: time 1596124249.087943, type 3 (EV_ABS), code 54 
(ABS_MT_POSITION_Y), value 340
Event: time 1596124249.087943, type 3 (EV_ABS), code 59 
(ABS_MT_DISTANCE), value 1
Event: time 1596124249.087943, type 3 (EV_ABS), code 58 
(ABS_MT_PRESSURE), value 139
Event: time 1596124249.087943, -------------- SYN_REPORT ------------
Event: time 1596124249.097234, type 3 (EV_ABS), code 59 
(ABS_MT_DISTANCE), value 0
Event: time 1596124249.097234, type 3 (EV_ABS), code 58 
(ABS_MT_PRESSURE), value 201
Event: time 1596124249.097234, -------------- SYN_REPORT ------------
Event: time 1596124249.101803, type 3 (EV_ABS), code 58 
(ABS_MT_PRESSURE), value 260
Event: time 1596124249.101803, -------------- SYN_REPORT ------------
Event: time 1596124249.112267, type 3 (EV_ABS), code 58 
(ABS_MT_PRESSURE), value 289
Event: time 1596124249.112267, -------------- SYN_REPORT ------------
Event: time 1596124249.116674, type 3 (EV_ABS), code 58 
(ABS_MT_PRESSURE), value 266
Event: time 1596124249.116674, -------------- SYN_REPORT ------------
Event: time 1596124249.127249, type 3 (EV_ABS), code 53 
(ABS_MT_POSITION_X), value 598
Event: time 1596124249.127249, type 3 (EV_ABS), code 58 
(ABS_MT_PRESSURE), value 223
Event: time 1596124249.127249, -------------- SYN_REPORT ------------
Event: time 1596124249.131745, type 3 (EV_ABS), code 54 
(ABS_MT_POSITION_Y), value 339
Event: time 1596124249.131745, type 3 (EV_ABS), code 58 
(ABS_MT_PRESSURE), value 181
Event: time 1596124249.131745, -------------- SYN_REPORT ------------
Event: time 1596124249.142256, type 3 (EV_ABS), code 53 
(ABS_MT_POSITION_X), value 597
Event: time 1596124249.142256, type 3 (EV_ABS), code 54 
(ABS_MT_POSITION_Y), value 338
Event: time 1596124249.142256, type 3 (EV_ABS), code 58 
(ABS_MT_PRESSURE), value 161
Event: time 1596124249.142256, -------------- SYN_REPORT ------------
Event: time 1596124249.146603, type 3 (EV_ABS), code 53 
(ABS_MT_POSITION_X), value 596
Event: time 1596124249.146603, type 3 (EV_ABS), code 54 
(ABS_MT_POSITION_Y), value 337
Event: time 1596124249.146603, type 3 (EV_ABS), code 59 
(ABS_MT_DISTANCE), value 1
Event: time 1596124249.146603, type 3 (EV_ABS), code 58 
(ABS_MT_PRESSURE), value 0
Event: time 1596124249.146603, -------------- SYN_REPORT ------------
Event: time 1596124249.172060, type 3 (EV_ABS), code 54 
(ABS_MT_POSITION_Y), value 336
Event: time 1596124249.172060, -------------- SYN_REPORT ------------
Event: time 1596124249.202273, type 3 (EV_ABS), code 53 
(ABS_MT_POSITION_X), value 595
Event: time 1596124249.202273, type 3 (EV_ABS), code 54 
(ABS_MT_POSITION_Y), value 335
Event: time 1596124249.202273, -------------- SYN_REPORT ------------
Event: time 1596124249.206695, type 3 (EV_ABS), code 54 
(ABS_MT_POSITION_Y), value 334
Event: time 1596124249.206695, -------------- SYN_REPORT ------------
Event: time 1596124249.217088, type 3 (EV_ABS), code 54 
(ABS_MT_POSITION_Y), value 333
Event: time 1596124249.217088, -------------- SYN_REPORT ------------
Event: time 1596124249.232096, type 3 (EV_ABS), code 54 
(ABS_MT_POSITION_Y), value 331
Event: time 1596124249.232096, -------------- SYN_REPORT ------------
Event: time 1596124249.236768, type 3 (EV_ABS), code 54 
(ABS_MT_POSITION_Y), value 330
Event: time 1596124249.236768, -------------- SYN_REPORT ------------
Event: time 1596124249.247150, type 3 (EV_ABS), code 54 
(ABS_MT_POSITION_Y), value 329
Event: time 1596124249.247150, -------------- SYN_REPORT ------------
Event: time 1596124249.251871, type 3 (EV_ABS), code 54 
(ABS_MT_POSITION_Y), value 328
Event: time 1596124249.251871, -------------- SYN_REPORT ------------
Event: time 1596124249.262288, type 3 (EV_ABS), code 57 
(ABS_MT_TRACKING_ID), value -1
Event: time 1596124249.262288, -------------- SYN_REPORT ------------


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

* UPD: hid-multitouch: goodix: hovering works as touch
  2020-07-30 16:23 hid-multitouch: goodix: hovering works as touch Dmitry Mastykin
  2020-07-31 13:07 ` UPD: " Dmitry Mastykin
@ 2021-04-14 15:35 ` Vitaly Minko
  2021-04-15  7:13   ` Dmitry Mastykin
  1 sibling, 1 reply; 9+ messages in thread
From: Vitaly Minko @ 2021-04-14 15:35 UTC (permalink / raw)
  To: Dmitry Mastykin, linux-input; +Cc: Benjamin Tissoires, Hans de Goede

Hello Dmitry,


I have faced with exactly the same problem. Have you managed to solve 
the issue?

If yes, could you please share the patch?

Thanks in advance!


Best regards,

Vitaly


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

* Re: UPD: hid-multitouch: goodix: hovering works as touch
  2021-04-14 15:35 ` Vitaly Minko
@ 2021-04-15  7:13   ` Dmitry Mastykin
  2021-04-15 13:33     ` Vitaly Minko
  2021-06-10  0:59     ` Alexander Sosedkin
  0 siblings, 2 replies; 9+ messages in thread
From: Dmitry Mastykin @ 2021-04-15  7:13 UTC (permalink / raw)
  To: Vitaly Minko, linux-input
  Cc: Benjamin Tissoires, Hans de Goede, Daniele Gobbetti

[-- Attachment #1: Type: text/plain, Size: 909 bytes --]

Hi Vitaly,

Yes, we made a quirk for separate non-multitouch processing of the 
HID_DG_PEN application for Goodix gt7385p (I2C_DEVICE_ID_GOODIX_0113 == 
0x0113). It works well, BTN_TOOL_PEN and BTN_TOUCH events have right order.
I attach patches for kernel 5.4
Buttons support was very tricky, because the panel tries to imitate 
eraser usage with combination of tip's and eraser's bits off and on, 
seems that Windows driver needs this. In second patch we add 
state-machines for pen buttons to simulate right and middle click. It 
works also well with this panel/pen, but I'm not sure if it works with 
other devices.

Kind regards,
Dmitry Mastykin


On 4/14/21 6:35 PM, Vitaly Minko wrote:
> Hello Dmitry,
> 
> 
> I have faced with exactly the same problem. Have you managed to solve 
> the issue?
> 
> If yes, could you please share the patch?
> 
> Thanks in advance!
> 
> 
> Best regards,
> 
> Vitaly
> 

[-- Attachment #2: commit-b7ee3d7 --]
[-- Type: text/plain, Size: 7115 bytes --]

From b7ee3d77291460b21437280b9838aaf680046073 Mon Sep 17 00:00:00 2001
From: Dmitry Mastykin <dmastykin@astralinux.ru>
Date: Tue, 25 Aug 2020 10:29:03 +0300
Subject: pen support

no buttons

diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
index 128d8f4319b9..280d85e0eac5 100644
--- a/drivers/hid/hid-multitouch.c
+++ b/drivers/hid/hid-multitouch.c
@@ -48,6 +48,9 @@ MODULE_LICENSE("GPL");
 
 #include "hid-ids.h"
 
+// #define MY(fmt,arg...) printk(KERN_INFO "%s: " fmt "\n", __func__, ##arg)
+#define MY(fmt,arg...)
+
 /* quirks to control the device */
 #define MT_QUIRK_NOT_SEEN_MEANS_UP	BIT(0)
 #define MT_QUIRK_SLOT_IS_CONTACTID	BIT(1)
@@ -70,6 +73,7 @@ MODULE_LICENSE("GPL");
 #define MT_QUIRK_WIN8_PTP_BUTTONS	BIT(18)
 #define MT_QUIRK_SEPARATE_APP_REPORT	BIT(19)
 #define MT_QUIRK_FORCE_MULTI_INPUT	BIT(20)
+#define MT_QUIRK_NON_MT_PEN		BIT(21)
 
 #define MT_INPUTMODE_TOUCHSCREEN	0x02
 #define MT_INPUTMODE_TOUCHPAD		0x03
@@ -100,6 +104,9 @@ struct mt_usages {
 	bool *tip_state;	/* is the touch valid? */
 	bool *inrange_state;	/* is the finger in proximity of the sensor? */
 	bool *confidence_state;	/* is the touch made by a finger? */
+	bool *barrel_state;
+	bool *invert_state;
+	bool *eraser_state;
 };
 
 struct mt_application {
@@ -153,6 +160,7 @@ struct mt_report_data {
 	struct hid_report *report;
 	struct mt_application *application;
 	bool is_mt_collection;
+	bool non_mt_pen;
 };
 
 struct mt_device {
@@ -208,6 +216,7 @@ static void mt_post_parse(struct mt_device *td, struct mt_application *app);
 #define MT_CLS_GOOGLE				0x0111
 #define MT_CLS_RAZER_BLADE_STEALTH		0x0112
 #define MT_CLS_SMART_TECH			0x0113
+#define MT_CLS_NON_MT_PEN			0x0114
 
 #define MT_DEFAULT_MAXCONTACT	10
 #define MT_MAX_MAXCONTACT	250
@@ -374,6 +383,9 @@ static const struct mt_class mt_classes[] = {
 			MT_QUIRK_CONTACT_CNT_ACCURATE |
 			MT_QUIRK_SEPARATE_APP_REPORT,
 	},
+	{ .name = MT_CLS_NON_MT_PEN,
+		.quirks = MT_QUIRK_NON_MT_PEN,
+	},
 	{ }
 };
 
@@ -523,6 +535,9 @@ static struct mt_usages *mt_allocate_usage(struct hid_device *hdev,
 	usage->tip_state = DEFAULT_FALSE;
 	usage->inrange_state = DEFAULT_FALSE;
 	usage->confidence_state = DEFAULT_TRUE;
+	usage->barrel_state = DEFAULT_FALSE;
+	usage->invert_state = DEFAULT_FALSE;
+	usage->eraser_state = DEFAULT_FALSE;
 
 	list_add_tail(&usage->list, &application->mt_usages);
 
@@ -877,6 +892,67 @@ static int mt_touch_input_mapping(struct hid_device *hdev, struct hid_input *hi,
 	return 0;
 }
 
+static int mt_pen_input_mapping(struct hid_device *hdev, struct hid_input *hi,
+		struct hid_field *field, struct hid_usage *usage,
+		unsigned long **bit, int *max, struct mt_application *app)
+{
+	struct mt_device *td = hid_get_drvdata(hdev);
+	struct mt_class *cls = &td->mtclass;
+
+	MY("application:%s:%x:%x", hdev->name, field->application, usage->hid);
+
+	switch (usage->hid & HID_USAGE_PAGE) {
+	case HID_UP_GENDESK:
+		switch (usage->hid) {
+		case HID_GD_X:
+			__set_bit(INPUT_PROP_DIRECT, hi->input->propbit);
+			set_abs(hi->input, ABS_X, field, cls->sn_move);
+			MT_STORE_FIELD(x);
+			return 1;
+		case HID_GD_Y:
+			set_abs(hi->input, ABS_Y, field, cls->sn_move);
+			MT_STORE_FIELD(y);
+			return 1;
+		}
+		return -1;
+
+	case HID_UP_DIGITIZER:
+		switch (usage->hid) {
+		case HID_DG_INRANGE:
+			input_set_capability(hi->input,
+					     EV_KEY, BTN_TOOL_PEN);
+			input_set_abs_params(hi->input,
+					     ABS_DISTANCE, 0, 1, 0, 0);
+			MT_STORE_FIELD(inrange_state);
+			return 1;
+		case HID_DG_TIPSWITCH:
+			input_set_capability(hi->input,
+					     EV_KEY, BTN_TOUCH);
+			MT_STORE_FIELD(tip_state);
+			return 1;
+		case HID_DG_BARRELSWITCH:
+			input_set_capability(hi->input,
+					     EV_KEY, BTN_STYLUS2);
+			MT_STORE_FIELD(barrel_state);
+			return 1;
+		case HID_DG_INVERT:
+			MT_STORE_FIELD(invert_state);
+			return 1;
+		case HID_DG_ERASER:
+			MT_STORE_FIELD(eraser_state);
+			return 1;
+		case HID_DG_TIPPRESSURE:
+			set_abs(hi->input, ABS_PRESSURE, field,
+				cls->sn_pressure);
+			MT_STORE_FIELD(p);
+			return 1;
+		}
+		return -1;
+	}
+
+	return 0;
+}
+
 static int mt_compute_slot(struct mt_device *td, struct mt_application *app,
 			   struct mt_usages *slot,
 			   struct input_dev *input)
@@ -1242,6 +1318,34 @@ static void mt_touch_report(struct hid_device *hid,
 	clear_bit(MT_IO_FLAGS_RUNNING, &td->mt_io_flags);
 }
 
+static void mt_pen_report(struct hid_device *hid,
+		       struct mt_report_data *rdata)
+{
+	struct mt_application *app = rdata->application;
+	struct mt_usages *usage;
+	struct input_dev *input = rdata->report->field[0]->hidinput->input;
+
+	if (!(usage = list_first_entry_or_null(&app->mt_usages,
+					       struct mt_usages, list)))
+		return;
+
+
+	MY("inr:tip:bar:inv:era %d:%d:%d:%d:%d",
+		*usage->inrange_state,
+		*usage->tip_state,
+		*usage->barrel_state,
+		*usage->invert_state,
+		*usage->eraser_state
+	);
+	input_report_key(input, BTN_TOOL_PEN, *usage->inrange_state);
+	input_report_key(input, BTN_TOUCH, *usage->tip_state);
+	// input_report_key(input, BTN_STYLUS2, *usage->barrel_state);
+	input_event(input, EV_ABS, ABS_X, *usage->x);
+	input_event(input, EV_ABS, ABS_Y, *usage->y);
+	input_event(input, EV_ABS, ABS_PRESSURE, *usage->p);
+	input_event(input, EV_ABS, ABS_DISTANCE, !*usage->tip_state);
+}
+
 static int mt_touch_input_configured(struct hid_device *hdev,
 				     struct hid_input *hi,
 				     struct mt_application *app)
@@ -1347,6 +1451,14 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi,
 		return 1;
 	}
 
+	if (field->application == HID_DG_PEN &&
+	    application->quirks & MT_QUIRK_NON_MT_PEN) {
+		rdata->is_mt_collection = false;
+		rdata->non_mt_pen = true;
+		return mt_pen_input_mapping(hdev, hi, field, usage, bit, max,
+					    application);
+	}
+
 	if (rdata->is_mt_collection)
 		return mt_touch_input_mapping(hdev, hi, field, usage, bit, max,
 					      application);
@@ -1370,7 +1482,7 @@ static int mt_input_mapped(struct hid_device *hdev, struct hid_input *hi,
 	struct mt_report_data *rdata;
 
 	rdata = mt_find_report_data(td, field->report);
-	if (rdata && rdata->is_mt_collection) {
+	if (rdata && (rdata->is_mt_collection || rdata->non_mt_pen)) {
 		/* We own these mappings, tell hid-input to ignore them */
 		return -1;
 	}
@@ -1404,6 +1516,8 @@ static void mt_report(struct hid_device *hid, struct hid_report *report)
 	rdata = mt_find_report_data(td, report);
 	if (rdata && rdata->is_mt_collection)
 		return mt_touch_report(hid, rdata);
+	if (rdata && rdata->non_mt_pen)
+		mt_pen_report(hid, rdata);
 
 	if (field && field->hidinput && field->hidinput->input)
 		input_sync(field->hidinput->input);
@@ -2151,6 +2265,11 @@ static const struct hid_device_id mt_devices[] = {
 		HID_DEVICE(HID_BUS_ANY, HID_GROUP_ANY, USB_VENDOR_ID_GOOGLE,
 			USB_DEVICE_ID_GOOGLE_TOUCH_ROSE) },
 
+	{ .driver_data = MT_CLS_NON_MT_PEN,
+		HID_DEVICE(BUS_I2C, HID_GROUP_MULTITOUCH_WIN_8,
+			I2C_VENDOR_ID_GOODIX,
+			I2C_DEVICE_ID_GOODIX_0113) },
+
 	/* Generic MT device */
 	{ HID_DEVICE(HID_BUS_ANY, HID_GROUP_MULTITOUCH, HID_ANY_ID, HID_ANY_ID) },
 

[-- Attachment #3: commit-530201a --]
[-- Type: text/plain, Size: 2821 bytes --]

From 530201a53fc0bb9b0db53c41d8e2fe7f324a4d8f Mon Sep 17 00:00:00 2001
From: Dmitry Mastykin <dmastykin@astralinux.ru>
Date: Fri, 20 Nov 2020 18:12:39 +0300
Subject: buttons support


diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
index 280d85e0eac5..5d4301fa5b75 100644
--- a/drivers/hid/hid-multitouch.c
+++ b/drivers/hid/hid-multitouch.c
@@ -107,6 +107,8 @@ struct mt_usages {
 	bool *barrel_state;
 	bool *invert_state;
 	bool *eraser_state;
+	int rclick;
+	int mclick;
 };
 
 struct mt_application {
@@ -538,6 +540,8 @@ static struct mt_usages *mt_allocate_usage(struct hid_device *hdev,
 	usage->barrel_state = DEFAULT_FALSE;
 	usage->invert_state = DEFAULT_FALSE;
 	usage->eraser_state = DEFAULT_FALSE;
+	usage->rclick = 0;
+	usage->mclick = 0;
 
 	list_add_tail(&usage->list, &application->mt_usages);
 
@@ -939,6 +943,8 @@ static int mt_pen_input_mapping(struct hid_device *hdev, struct hid_input *hi,
 			MT_STORE_FIELD(invert_state);
 			return 1;
 		case HID_DG_ERASER:
+			input_set_capability(hi->input,
+					     EV_KEY, BTN_STYLUS);
 			MT_STORE_FIELD(eraser_state);
 			return 1;
 		case HID_DG_TIPPRESSURE:
@@ -1329,17 +1335,58 @@ static void mt_pen_report(struct hid_device *hid,
 					       struct mt_usages, list)))
 		return;
 
+	switch (usage->rclick) {
+	case 0:
+		if (*usage->barrel_state)
+			usage->rclick++;
+		break;
+	case 1:
+	case 7:
+		if (*usage->tip_state)
+			usage->rclick = 2;
+		else if (!*usage->barrel_state)
+			usage->rclick = 0;
+		break;
+	case 2:
+		if (!*usage->tip_state)
+			usage->rclick++;
+		break;
+	default:
+		usage->rclick++;
+	}
+
+	switch (usage->mclick) {
+	case 0:
+		if (*usage->eraser_state)
+			usage->mclick++;
+		break;
+	case 1:
+		if (!*usage->eraser_state)
+			usage->mclick++;
+		break;
+	case 3:
+		if (!*usage->tip_state)
+			usage->mclick = 0;
+		break;
+	default:
+		usage->mclick++;
+	}
 
-	MY("inr:tip:bar:inv:era %d:%d:%d:%d:%d",
+	MY("inr:tip:bar:rck::inv:era:mck %d:%d:%d:%d::%d:%d:%d",
 		*usage->inrange_state,
 		*usage->tip_state,
 		*usage->barrel_state,
+		usage->rclick,
 		*usage->invert_state,
-		*usage->eraser_state
+		*usage->eraser_state,
+		usage->mclick
 	);
-	input_report_key(input, BTN_TOOL_PEN, *usage->inrange_state);
-	input_report_key(input, BTN_TOUCH, *usage->tip_state);
-	// input_report_key(input, BTN_STYLUS2, *usage->barrel_state);
+	input_report_key(input, BTN_TOOL_PEN, *usage->inrange_state ||
+			 *usage->tip_state);
+	input_report_key(input, BTN_TOUCH, *usage->tip_state &&
+			 !(usage->rclick || usage->mclick));
+	input_report_key(input, BTN_STYLUS2, usage->rclick == 2);
+	input_report_key(input, BTN_STYLUS, usage->mclick);
 	input_event(input, EV_ABS, ABS_X, *usage->x);
 	input_event(input, EV_ABS, ABS_Y, *usage->y);
 	input_event(input, EV_ABS, ABS_PRESSURE, *usage->p);

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

* Re: UPD: hid-multitouch: goodix: hovering works as touch
  2021-04-15  7:13   ` Dmitry Mastykin
@ 2021-04-15 13:33     ` Vitaly Minko
  2021-04-15 16:02       ` Hans de Goede
  2021-06-10  0:59     ` Alexander Sosedkin
  1 sibling, 1 reply; 9+ messages in thread
From: Vitaly Minko @ 2021-04-15 13:33 UTC (permalink / raw)
  To: Dmitry Mastykin, linux-input
  Cc: Benjamin Tissoires, Hans de Goede, Daniele Gobbetti

Hello Dmitry,


I have tested your patches on the kernel version 5.10.27. I had to add 
one define for I2C_DEVICE_ID_GOODIX_0113. Everything else was applied 
successfully.

The digitizer works fine now. So the original issue is solved. Both pen 
buttons also work as expected (right and middle mouse buttons).

All tests performed on One-Netbook A1.

Thanks a lot for your efforts. Could you please send me a private email 
with your credentials for sending a tip (I would like to buy you a coffee).


Best regards,

Vitaly


15.04.2021 10:13, Dmitry Mastykin wrote:
> Hi Vitaly,
>
> Yes, we made a quirk for separate non-multitouch processing of the 
> HID_DG_PEN application for Goodix gt7385p (I2C_DEVICE_ID_GOODIX_0113 
> == 0x0113). It works well, BTN_TOOL_PEN and BTN_TOUCH events have 
> right order.
> I attach patches for kernel 5.4
> Buttons support was very tricky, because the panel tries to imitate 
> eraser usage with combination of tip's and eraser's bits off and on, 
> seems that Windows driver needs this. In second patch we add 
> state-machines for pen buttons to simulate right and middle click. It 
> works also well with this panel/pen, but I'm not sure if it works with 
> other devices.
>
> Kind regards,
> Dmitry Mastykin
>
>
> On 4/14/21 6:35 PM, Vitaly Minko wrote:
>> Hello Dmitry,
>>
>>
>> I have faced with exactly the same problem. Have you managed to solve 
>> the issue?
>>
>> If yes, could you please share the patch?
>>
>> Thanks in advance!
>>
>>
>> Best regards,
>>
>> Vitaly
>>

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

* Re: UPD: hid-multitouch: goodix: hovering works as touch
  2021-04-15 13:33     ` Vitaly Minko
@ 2021-04-15 16:02       ` Hans de Goede
  2021-04-16  7:16         ` Dmitry Mastykin
  0 siblings, 1 reply; 9+ messages in thread
From: Hans de Goede @ 2021-04-15 16:02 UTC (permalink / raw)
  To: Vitaly Minko, Dmitry Mastykin, linux-input
  Cc: Benjamin Tissoires, Daniele Gobbetti

Hi,

On 4/15/21 3:33 PM, Vitaly Minko wrote:
> Hello Dmitry,
> 
> 
> I have tested your patches on the kernel version 5.10.27. I had to add one define for I2C_DEVICE_ID_GOODIX_0113. Everything else was applied successfully.
> 
> The digitizer works fine now. So the original issue is solved. Both pen buttons also work as expected (right and middle mouse buttons).
> 
> All tests performed on One-Netbook A1.
> 
> Thanks a lot for your efforts. Could you please send me a private email with your credentials for sending a tip (I would like to buy you a coffee).

Although it is nice that these patches fix things for you, I wonder if there
is any plan to get the fixes for this upstream, so that once distros jump
to a newer kernel this will just work out of the box for all Linux users ?

Regards,

Hans




> 15.04.2021 10:13, Dmitry Mastykin wrote:
>> Hi Vitaly,
>>
>> Yes, we made a quirk for separate non-multitouch processing of the HID_DG_PEN application for Goodix gt7385p (I2C_DEVICE_ID_GOODIX_0113 == 0x0113). It works well, BTN_TOOL_PEN and BTN_TOUCH events have right order.
>> I attach patches for kernel 5.4
>> Buttons support was very tricky, because the panel tries to imitate eraser usage with combination of tip's and eraser's bits off and on, seems that Windows driver needs this. In second patch we add state-machines for pen buttons to simulate right and middle click. It works also well with this panel/pen, but I'm not sure if it works with other devices.
>>
>> Kind regards,
>> Dmitry Mastykin
>>
>>
>> On 4/14/21 6:35 PM, Vitaly Minko wrote:
>>> Hello Dmitry,
>>>
>>>
>>> I have faced with exactly the same problem. Have you managed to solve the issue?
>>>
>>> If yes, could you please share the patch?
>>>
>>> Thanks in advance!
>>>
>>>
>>> Best regards,
>>>
>>> Vitaly
>>>
> 


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

* Re: UPD: hid-multitouch: goodix: hovering works as touch
  2021-04-15 16:02       ` Hans de Goede
@ 2021-04-16  7:16         ` Dmitry Mastykin
  2021-04-16 14:43           ` Hans de Goede
  0 siblings, 1 reply; 9+ messages in thread
From: Dmitry Mastykin @ 2021-04-16  7:16 UTC (permalink / raw)
  To: Hans de Goede, Vitaly Minko, linux-input
  Cc: Benjamin Tissoires, Daniele Gobbetti

Hi Hans,

Of course I would like to put a pen patch to upstream, and ready to work 
for that.
Have you taken a look to it? It's seems to be like a workaround. And 
it's difficult to say if pen button part of the patch will work fine 
with all gt7385p firmwares (sequence of tip, barrel and eraser is very 
tricky, but is it stable from version to version?)
Should I rebase my patch, provide with comments and send the series to 
linux-input? Do you have any wishes how I could improve it before?

Thank you very much!
Dmitry Mastykin


On 4/15/21 7:02 PM, Hans de Goede wrote:
> Hi,
> 
> On 4/15/21 3:33 PM, Vitaly Minko wrote:
>> Hello Dmitry,
>>
>>
>> I have tested your patches on the kernel version 5.10.27. I had to add one define for I2C_DEVICE_ID_GOODIX_0113. Everything else was applied successfully.
>>
>> The digitizer works fine now. So the original issue is solved. Both pen buttons also work as expected (right and middle mouse buttons).
>>
>> All tests performed on One-Netbook A1.
>>
>> Thanks a lot for your efforts. Could you please send me a private email with your credentials for sending a tip (I would like to buy you a coffee).
> 
> Although it is nice that these patches fix things for you, I wonder if there
> is any plan to get the fixes for this upstream, so that once distros jump
> to a newer kernel this will just work out of the box for all Linux users ?
> 
> Regards,
> 
> Hans
> 
> 
> 
> 
>> 15.04.2021 10:13, Dmitry Mastykin wrote:
>>> Hi Vitaly,
>>>
>>> Yes, we made a quirk for separate non-multitouch processing of the HID_DG_PEN application for Goodix gt7385p (I2C_DEVICE_ID_GOODIX_0113 == 0x0113). It works well, BTN_TOOL_PEN and BTN_TOUCH events have right order.
>>> I attach patches for kernel 5.4
>>> Buttons support was very tricky, because the panel tries to imitate eraser usage with combination of tip's and eraser's bits off and on, seems that Windows driver needs this. In second patch we add state-machines for pen buttons to simulate right and middle click. It works also well with this panel/pen, but I'm not sure if it works with other devices.
>>>
>>> Kind regards,
>>> Dmitry Mastykin
>>>
>>>
>>> On 4/14/21 6:35 PM, Vitaly Minko wrote:
>>>> Hello Dmitry,
>>>>
>>>>
>>>> I have faced with exactly the same problem. Have you managed to solve the issue?
>>>>
>>>> If yes, could you please share the patch?
>>>>
>>>> Thanks in advance!
>>>>
>>>>
>>>> Best regards,
>>>>
>>>> Vitaly
>>>>
>>
> 

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

* Re: UPD: hid-multitouch: goodix: hovering works as touch
  2021-04-16  7:16         ` Dmitry Mastykin
@ 2021-04-16 14:43           ` Hans de Goede
  0 siblings, 0 replies; 9+ messages in thread
From: Hans de Goede @ 2021-04-16 14:43 UTC (permalink / raw)
  To: Dmitry Mastykin, Vitaly Minko, linux-input, Benjamin Tissoires
  Cc: Daniele Gobbetti

Hi Dmitry,

On 4/16/21 9:16 AM, Dmitry Mastykin wrote:
> Hi Hans,
> 
> Of course I would like to put a pen patch to upstream, and ready to work for that.
> Have you taken a look to it? It's seems to be like a workaround. And it's difficult to say if pen button part of the patch will work fine with all gt7385p firmwares (sequence of tip, barrel and eraser is very tricky, but is it stable from version to version?)
> Should I rebase my patch, provide with comments and send the series to linux-input? Do you have any wishes how I could improve it before?

I'm not sure I'm the best person to answer that. Benjamin Tissoires knows the
HID multi-touch code much better then I do.

Benjamin can you please take a look at the 2 out of tree patches for this
and give some hints what needs to be done to make these suitable for
the mainline kernel?

The patches where attached to another email in this thread, for your
convenience I've put them here:

Pen support (patch 1/2):
https://fedorapeople.org/~jwrdegoede/commit-b7ee3d7

Buttons on pen support (patch 2/2)
https://fedorapeople.org/~jwrdegoede/commit-530201a

Regards,

Hans



> On 4/15/21 7:02 PM, Hans de Goede wrote:
>> Hi,
>>
>> On 4/15/21 3:33 PM, Vitaly Minko wrote:
>>> Hello Dmitry,
>>>
>>>
>>> I have tested your patches on the kernel version 5.10.27. I had to add one define for I2C_DEVICE_ID_GOODIX_0113. Everything else was applied successfully.
>>>
>>> The digitizer works fine now. So the original issue is solved. Both pen buttons also work as expected (right and middle mouse buttons).
>>>
>>> All tests performed on One-Netbook A1.
>>>
>>> Thanks a lot for your efforts. Could you please send me a private email with your credentials for sending a tip (I would like to buy you a coffee).
>>
>> Although it is nice that these patches fix things for you, I wonder if there
>> is any plan to get the fixes for this upstream, so that once distros jump
>> to a newer kernel this will just work out of the box for all Linux users ?
>>
>> Regards,
>>
>> Hans
>>
>>
>>
>>
>>> 15.04.2021 10:13, Dmitry Mastykin wrote:
>>>> Hi Vitaly,
>>>>
>>>> Yes, we made a quirk for separate non-multitouch processing of the HID_DG_PEN application for Goodix gt7385p (I2C_DEVICE_ID_GOODIX_0113 == 0x0113). It works well, BTN_TOOL_PEN and BTN_TOUCH events have right order.
>>>> I attach patches for kernel 5.4
>>>> Buttons support was very tricky, because the panel tries to imitate eraser usage with combination of tip's and eraser's bits off and on, seems that Windows driver needs this. In second patch we add state-machines for pen buttons to simulate right and middle click. It works also well with this panel/pen, but I'm not sure if it works with other devices.
>>>>
>>>> Kind regards,
>>>> Dmitry Mastykin
>>>>
>>>>
>>>> On 4/14/21 6:35 PM, Vitaly Minko wrote:
>>>>> Hello Dmitry,
>>>>>
>>>>>
>>>>> I have faced with exactly the same problem. Have you managed to solve the issue?
>>>>>
>>>>> If yes, could you please share the patch?
>>>>>
>>>>> Thanks in advance!
>>>>>
>>>>>
>>>>> Best regards,
>>>>>
>>>>> Vitaly
>>>>>
>>>
>>
> 


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

* Re: UPD: hid-multitouch: goodix: hovering works as touch
  2021-04-15  7:13   ` Dmitry Mastykin
  2021-04-15 13:33     ` Vitaly Minko
@ 2021-06-10  0:59     ` Alexander Sosedkin
  1 sibling, 0 replies; 9+ messages in thread
From: Alexander Sosedkin @ 2021-06-10  0:59 UTC (permalink / raw)
  To: Dmitry Mastykin, linux-input, Benjamin Tissoires
  Cc: Hans de Goede, Daniele Gobbetti, Vitaly Minko

On 4/15/21 9:13 AM, Dmitry Mastykin wrote:
> Hi Vitaly,
> 
> Yes, we made a quirk for separate non-multitouch processing of the 
> HID_DG_PEN application for Goodix gt7385p (I2C_DEVICE_ID_GOODIX_0113 == 
> 0x0113). It works well, BTN_TOOL_PEN and BTN_TOUCH events have right order.
> I attach patches for kernel 5.4
> Buttons support was very tricky, because the panel tries to imitate 
> eraser usage with combination of tip's and eraser's bits off and on, 
> seems that Windows driver needs this. In second patch we add 
> state-machines for pen buttons to simulate right and middle click. It 
> works also well with this panel/pen, but I'm not sure if it works with 
> other devices.
> 
> Kind regards,
> Dmitry Mastykin

These patches have solved the same problem for my OneNetbook 4's
"GXTP7386:00 27C6:011A Stylus" manifesting the same symptoms.
I just had to replace the device ID from 0x0113 to 0x011A.
Tested on 5.12.4 and 5.12.7.
It'd be nice to see these fixes extended and upstreamed one day.

Dmitry, thanks for putting work into this.
Benjamin, would you kindly take a look at this submission?

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

end of thread, other threads:[~2021-06-10  1:07 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-30 16:23 hid-multitouch: goodix: hovering works as touch Dmitry Mastykin
2020-07-31 13:07 ` UPD: " Dmitry Mastykin
2021-04-14 15:35 ` Vitaly Minko
2021-04-15  7:13   ` Dmitry Mastykin
2021-04-15 13:33     ` Vitaly Minko
2021-04-15 16:02       ` Hans de Goede
2021-04-16  7:16         ` Dmitry Mastykin
2021-04-16 14:43           ` Hans de Goede
2021-06-10  0:59     ` Alexander Sosedkin

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