Bug 104080

Summary: extra straight line when drawing with stylus
Product: Wayland Reporter: Carlo Caione <carlo>
Component: libinputAssignee: Wayland bug list <wayland-bugs>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium CC: peter.hutterer
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: evemu-log
evemu-log-v1.6.3-issue
evemu-log-v1.9.3

Description Carlo Caione 2017-12-04 18:44:57 UTC
Hardware is an old Positivo EC10IS1 laptop with a touchscreen on the USB bus:

  ID 22b9:0005 eTurboTouch Technology, Inc.

the bug is the same as https://bugs.freedesktop.org/show_bug.cgi?id=82250.

That bugzilla entry is not valid anymore since I'm using libinput and not evdev  but the wrong behaviour is the same (copy and pasting from that story):

> When using my pen in drawing programs (I tried gimp and mypaint), if draw
> something on the left side (for example), raise the pen from the screen,
> and draw something on e right side, there is a straight line drawn from the
> last point I touched on the left to the first point I touch on the right.

The GDK bug https://bugzilla.gnome.org/show_bug.cgi?id=735003 is still open but I'm not sure if it is possible to fix this on the libinput side.

This is the evtest output I get when I touch the touchscreen with the stylus, draw a line and then raise the pen again:

Event: time 1512412889.394868, type 4 (EV_MSC), code 4 (MSC_SCAN), value d0042 
Event: time 1512412889.394868, type 1 (EV_KEY), code 330 (BTN_TOUCH), value 1
Event: time 1512412889.394868, type 1 (EV_KEY), code 320 (BTN_TOOL_PEN), value 1
Event: time 1512412889.394868, type 3 (EV_ABS), code 0 (ABS_X), value 1328
Event: time 1512412889.394868, type 3 (EV_ABS), code 1 (ABS_Y), value 2941
Event: time 1512412889.394868, -------------- EV_SYN ------------ 
Event: time 1512412889.399326, type 3 (EV_ABS), code 0 (ABS_X), value 1326
Event: time 1512412889.399326, type 3 (EV_ABS), code 1 (ABS_Y), value 2949
Event: time 1512412889.399326, -------------- EV_SYN ------------
Event: time 1512412889.409335, type 3 (EV_ABS), code 0 (ABS_X), value 1325
Event: time 1512412889.409335, type 3 (EV_ABS), code 1 (ABS_Y), value 2963 
Event: time 1512412889.409335, -------------- EV_SYN ------------ 
...
Event: time 1512412889.624330, -------------- EV_SYN ------------ 
Event: time 1512412889.629329, type 3 (EV_ABS), code 0 (ABS_X), value 1871
Event: time 1512412889.629329, type 3 (EV_ABS), code 1 (ABS_Y), value 2399 
Event: time 1512412889.629329, -------------- EV_SYN ------------
Event: time 1512412889.650334, type 4 (EV_MSC), code 4 (MSC_SCAN), value d0042 
Event: time 1512412889.650334, type 1 (EV_KEY), code 330 (BTN_TOUCH), value 0
Event: time 1512412889.650334, type 1 (EV_KEY), code 320 (BTN_TOOL_PEN), value 0 
Event: time 1512412889.650334, -------------- EV_SYN ------------

Some more info on the touchscreen:

P: /devices/pci0000:00/0000:00:1d.2/usb4/4-2/4-2:1.0/0003:22B9:0005.0001/input/input10/event5                                                                                                                                   
N: input/event5
S: input/by-id/usb-HID_TOUCH_HID_Touch_Panel-event-mouse
S: input/by-path/pci-0000:00:1d.2-usb-0:2:1.0-event-mouse
E: DEVLINKS=/dev/input/by-path/pci-0000:00:1d.2-usb-0:2:1.0-event-mouse /dev/input/by-id/usb-HID_TOUCH_HID_Touch_Panel-event-mouse
E: DEVNAME=/dev/input/event5
E: DEVPATH=/devices/pci0000:00/0000:00:1d.2/usb4/4-2/4-2:1.0/0003:22B9:0005.0001/input/input10/event5
E: ID_BUS=usb
E: ID_INPUT=1
E: ID_INPUT_TOUCHSCREEN=1
E: ID_MODEL=HID_Touch_Panel
E: ID_MODEL_ENC=HID\x20Touch\x20Panel
E: ID_MODEL_ID=0005
E: ID_PATH=pci-0000:00:1d.2-usb-0:2:1.0
E: ID_PATH_TAG=pci-0000_00_1d_2-usb-0_2_1_0
E: ID_REVISION=0000
E: ID_SERIAL=HID_TOUCH_HID_Touch_Panel
E: ID_TYPE=hid
E: ID_USB_DRIVER=usbhid
E: ID_USB_INTERFACES=:030000:
E: ID_USB_INTERFACE_NUM=00
E: ID_VENDOR=HID_TOUCH
E: ID_VENDOR_ENC=HID\x20TOUCH
E: ID_VENDOR_ID=22b9
E: LIBINPUT_DEVICE_GROUP=3/22b9/5/101:usb-0000:00:1d.2-2
E: MAJOR=13
E: MINOR=69
E: SUBSYSTEM=input
E: USEC_INITIALIZED=28633518
Comment 1 Peter Hutterer 2017-12-08 00:36:27 UTC
Please *attach* an evemu recording of a sequence that generates that extra line, thanks.
Comment 2 Peter Hutterer 2017-12-17 23:07:59 UTC
ping?
Comment 3 Carlo Caione 2017-12-18 10:09:28 UTC
Created attachment 136244 [details]
evemu-log

Ups, sorry, missed your request.

We have discovered that the latest libinput solves the issue and specifically the commit:

commit 8c55bc060df837f986f57c8c26ae2f9c58963bcc            
Author: Peter Hutterer <peter.hutterer@who-t.net>          
Date:   Mon Nov 13 12:19:44 2017 +1000                                                                                 
                                                                                                                       
    fallback: change to handle the state at EV_SYN time  

solves this problem.

I'm going to attach anyway a log taken with evemu and a previous release of libinput without the fixing commit.
Comment 4 Peter Hutterer 2017-12-18 21:28:20 UTC
urgh, that's a two or three year old version of evemu and the recordings from that aren't very hujuman-friendly. Any chance you can re-record with something more recent? https://www.freedesktop.org/wiki/Evemu/

That commit shouldn't have fixed the issue because the pen should be handled by the tablet backend, not the mouse/keyboard one. Which indicates something else is amiss here.
Comment 5 Carlo Caione 2017-12-19 10:11:58 UTC
> That commit shouldn't have fixed the issue because the pen should be handled 
> by the tablet backend, not the mouse/keyboard one. Which indicates something 
> else is amiss here.

Odd, I bisected down to that commit myself and at least on my setup that commit is fixing the issue I'm seeing.

Please note that on this hardware we are forcing ID_INPUT_TOUCHSCREEN=1 with:

ENV{ID_BUS}=="usb", ENV{ID_VENDOR_ID}=="22b9", ENV{ID_MODEL_ID}=="0005",
ATTR{[dmi/id]product_name}=="EC10IS1", ENV{ID_INPUT}="1",
ENV{ID_INPUT_TABLET}="", ENV{ID_INPUT_TOUCHSCREEN}="1"



I'm going to attach (in the next messages) the evemu logs obtained when drawing a straight line, lifting the stylus, and drawing a new straight line starting at a different point. When the issue is visible the end of the first line and the start of the second line are connected by a line even though I lifted the stylus.

The two logs are obtained:
1) using an old libinput v1.6.3 where the problem is reproducible
2) using the latest libinput v1.9.3 where the commit 8c55bc060df seems to have solved this issue

Also please note that Ubuntu is shipping this patch https://lists.freedesktop.org/archives/wayland-devel/2015-September/024171.html that solves the same issue for older versions of libinput (I guess it was merged some time in the past).
Comment 6 Carlo Caione 2017-12-19 10:13:11 UTC
Created attachment 136274 [details]
evemu-log-v1.6.3-issue

evemu log taken with libinput v1.6.3 where the issue is present
Comment 7 Carlo Caione 2017-12-19 10:13:37 UTC
Created attachment 136275 [details]
evemu-log-v1.9.3

evemu log with latest libinput with no issue present
Comment 8 Peter Hutterer 2018-01-05 04:07:34 UTC
right, the reason why the commit fixed the issue is your udev rule: ENV{ID_INPUT_TABLET}="", ENV{ID_INPUT_TOUCHSCREEN}="1"

this removes the tablet bit and sets the touchscreen bit instead. without that, the code that was fixed wouldn't have triggered.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.