[SOLVED] Troubleshooting erratic clicks on touchpads

Write tutorials here
There are more tutorials here http://community.linuxmint.com/tutorial/welcome
Forum rules
Please don't add support questions to tutorials,start your own thread in the appropriate sub-forum instead. Before you post please read this
Post Reply
flyingrhino
Level 3
Level 3
Posts: 162
Joined: Sat Apr 04, 2015 8:55 pm

[SOLVED] Troubleshooting erratic clicks on touchpads

Post by flyingrhino » Mon Jan 09, 2017 12:25 am

Problem: Touchpad randomly clicks. Can happen once a day or once every couple minutes, totally random.
Device: Asus UX302LG laptop
OS: LM 17.3 XFCE

I've spent hours researching this on the web and there are lots of posts talking about various solutions, but no proper introduction to the subject, or a good amount of knowledge in one place.
This post fixes that.
I aim to give a solid explaination of the tools used, the various outputs are analyzed, resources to look up more information, and a solution.

----------

Install the supporting programs:
gpointing-device-settings (I don't use this one but it lets people configure some of the functionality from the GUI)
evtest
input-utils (package for lsinput)

----------

The first starting point is understanding the device capabilities:

The event codes are described here:
https://www.mjmwired.net/kernel/Documen ... -codes.txt
https://www.mjmwired.net/kernel/Documen ... otocol.txt
https://www.kernel.org/doc/Documentatio ... -codes.txt (same as above)
https://www.kernel.org/doc/Documentatio ... otocol.txt

As root run 'evtest' , then select the touchpad.
You will see it's capabilities displayed first.
Then it enters query mode.

Code: Select all

# evtest 	(as root with no arguments)

No device specified, trying to scan all of /dev/input/event*
Available devices:
/dev/input/event0:	Lid Switch
/dev/input/event1:	Sleep Button
/dev/input/event2:	Power Button
/dev/input/event3:	AT Translated Set 2 keyboard
/dev/input/event4:	Video Bus
/dev/input/event5:	Video Bus
/dev/input/event6:	ETPS/2 Elantech Touchpad
/dev/input/event7:	HDA Intel PCH Mic
/dev/input/event8:	HDA Intel PCH Headphone
/dev/input/event9:	HDA Intel HDMI HDMI/DP,pcm=3
/dev/input/event10:	HDA Intel HDMI HDMI/DP,pcm=7
/dev/input/event11:	HDA Intel HDMI HDMI/DP,pcm=8
/dev/input/event12:	Atmel Atmel maXTouch Digitizer
/dev/input/event13:	Asus WMI hotkeys
/dev/input/event14:	HD WebCam
/dev/input/event15:	Logitech Logitech Wireless Headset
Select the device event number [0-15]: 6		(I selected 6 which is the touchpad)

Now it outputs the device capabilities:

Input driver version is 1.0.1
Input device ID: bus 0x11 vendor 0x2 product 0xe version 0x0
Input device name: "ETPS/2 Elantech Touchpad"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 272 (BTN_LEFT)
    Event code 325 (BTN_TOOL_FINGER)
    Event code 330 (BTN_TOUCH)
    Event code 333 (BTN_TOOL_DOUBLETAP)
    Event code 334 (BTN_TOOL_TRIPLETAP)
    Event code 335 (BTN_TOOL_QUADTAP)
  Event type 3 (EV_ABS)
    Event code 0 (ABS_X)
      Value    688
      Min        0
      Max     2960
      Resolution      32
    Event code 1 (ABS_Y)
      Value   1875
      Min        0
      Max     1924
      Resolution      32
    Event code 24 (ABS_PRESSURE)
      Value      0
      Min        0
      Max      255
    Event code 28 (ABS_TOOL_WIDTH)
      Value      1
      Min        0
      Max       15
    Event code 47 (ABS_MT_SLOT)
      Value      1
      Min        0
      Max        4
    Event code 48 (ABS_MT_TOUCH_MAJOR)
      Value      0
      Min        0
      Max     2220
    Event code 53 (ABS_MT_POSITION_X)
      Value      0
      Min        0
      Max     2960
      Resolution      32
    Event code 54 (ABS_MT_POSITION_Y)
      Value      0
      Min        0
      Max     1924
      Resolution      32
    Event code 57 (ABS_MT_TRACKING_ID)
      Value      0
      Min        0
      Max    65535
    Event code 58 (ABS_MT_PRESSURE)
      Value      0
      Min        0
      Max      255
Properties:
  Property type 0 (INPUT_PROP_POINTER)
  Property type 2 (INPUT_PROP_BUTTONPAD)
----------

At this stage it's waiting for touchpad activity. It will display the codes resulting from it.
For example, clicking on the touchpad generates this output. I am also commenting it for clarity:

Code: Select all

Event: time 1483667902.516828, type 3 (EV_ABS), code 57 (ABS_MT_TRACKING_ID), value 4012
	New Absolute Multitouch value: Contact with the touchpad made, unique contact ID created
Event: time 1483667902.516828, type 3 (EV_ABS), code 53 (ABS_MT_POSITION_X), value 1015
	New Absolute Multitouch value: Center of touch on surface - X coordinate
	This is the middle point of the area where your finger touches the pad
Event: time 1483667902.516828, type 3 (EV_ABS), code 54 (ABS_MT_POSITION_Y), value 647
	New Absolute Multitouch value: Center of touch on surface - Y coordinate
Event: time 1483667902.516828, type 3 (EV_ABS), code 58 (ABS_MT_PRESSURE), value 13
	New Absolute Multitouch value: The pressure on the contact area
Event: time 1483667902.516828, type 3 (EV_ABS), code 48 (ABS_MT_TOUCH_MAJOR), value 444
	New Absolute Multitouch value: The size of the contact area with the touchpad
Event: time 1483667902.516828, type 3 (EV_ABS), code 28 (ABS_TOOL_WIDTH), value 3
	New absolute value: The width of the contact area
Event: time 1483667902.516828, type 1 (EV_KEY), code 330 (BTN_TOUCH), value 1
	Button changed state: Device is in contact, being touched (1)
Event: time 1483667902.516828, type 1 (EV_KEY), code 325 (BTN_TOOL_FINGER), value 1
	Button changed state: Device in use (1). Corresponding 'no longer in use'
	will follow later on when the finger is removed from the device.
	BTN_TOOL_FINGER is used for single finger contact. (see DOUBLE/TRIPLE/QUAD)
Event: time 1483667902.516828, type 3 (EV_ABS), code 0 (ABS_X), value 1015
	New absolute value: X coordinate of touch location on the touchpad
	Repeats the value of the event: ABS_MT_POSITION_X
Event: time 1483667902.516828, type 3 (EV_ABS), code 1 (ABS_Y), value 647
	New absolute value: Y coordinate of touch location on thr touchpad
	Repeats the value of the event: ABS_MT_POSITION_Y
Event: time 1483667902.516828, type 3 (EV_ABS), code 24 (ABS_PRESSURE), value 13
	New absolute value: Pressure on the touch location
	Repeats the value of the event: ABS_MT_PRESSURE
Event: time 1483667902.516828, -------------- SYN_REPORT ------------
	End of event #1 

Event: time 1483667902.534839, type 3 (EV_ABS), code 58 (ABS_MT_PRESSURE), value 12
	New Absolute Multitouch value:
Event: time 1483667902.534839, type 3 (EV_ABS), code 24 (ABS_PRESSURE), value 12
	New absolute value:
Event: time 1483667902.534839, -------------- SYN_REPORT ------------
	Now the touch pressure changed a little (went from 13 to 12)
	Therefore a new event was created

Event: time 1483667902.543364, type 3 (EV_ABS), code 48 (ABS_MT_TOUCH_MAJOR), value 148
	New Absolute Multitouch value:
Event: time 1483667902.543364, type 3 (EV_ABS), code 28 (ABS_TOOL_WIDTH), value 1
	New absolute value:
Event: time 1483667902.543364, -------------- SYN_REPORT ------------
	Finger coming off the touchpad so the touch area and width are reducing
	This results in a new event

Event: time 1483667902.561180, type 3 (EV_ABS), code 57 (ABS_MT_TRACKING_ID), value -1
	New Absolute Multitouch value: Unused slot (probably the earlier contact is
	no longer present, therefore this is now an unused slot
Event: time 1483667902.561180, type 1 (EV_KEY), code 330 (BTN_TOUCH), value 0
	Button changed state: Device is no longer in contact, not being touched (0)
Event: time 1483667902.561180, type 1 (EV_KEY), code 325 (BTN_TOOL_FINGER), value 0
	Button changed state: Device no longer in use (0)
Event: time 1483667902.561180, type 3 (EV_ABS), code 24 (ABS_PRESSURE), value 0
	New absolute value:
Event: time 1483667902.561180, -------------- SYN_REPORT ------------
	Finally, the touch event ends and finger comes off the touchpad.
	An event is created for this change
----------

Armed with this information, I now know what a click looks like.
Now all I need to do is prepare another window with 'evtest' running in monitoring mode, and continue using the laptop WITHOUT TOUCHING THE TOUCHPAD. When the touchpad registers another click I'll see the output and I'll be able to compare it to the output above which comes from a 'real click' (a click that I intended to make).

First thing is to understand the input devices using 'xinput' , since this is the tool I'll use to fine tune it.

'xinput list' (lists all input devcies - gives the same output when run as user or root)
'xinput list-props "ETPS/2 Elantech Touchpad"' (run as user or root)
'synclient -l' (displays the current setup. I won't use synclient now, but good to know)

These are the default settings on my laptop:

Code: Select all

xinput list-props "ETPS/2 Elantech Touchpad"

Device 'ETPS/2 Elantech Touchpad':
	Device Enabled (141):	1
	Coordinate Transformation Matrix (143):	1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
	Device Accel Profile (276):	1
	Device Accel Constant Deceleration (277):	2.500000
	Device Accel Adaptive Deceleration (278):	1.000000
	Device Accel Velocity Scaling (279):	12.500000
	Synaptics Edges (302):	118, 2842, 103, 1821
	Synaptics Finger (303):	1, 1, 0
	Synaptics Tap Time (304):	180
	Synaptics Tap Move (305):	155
	Synaptics Tap Durations (306):	180, 180, 100
	Synaptics ClickPad (307):	1
	Synaptics Middle Button Timeout (308):	0
	Synaptics Two-Finger Pressure (309):	282
	Synaptics Two-Finger Width (310):	7
	Synaptics Scrolling Distance (311):	70, 70
	Synaptics Edge Scrolling (312):	0, 0, 0
	Synaptics Two-Finger Scrolling (313):	1, 1
	Synaptics Move Speed (314):	1.000000, 1.750000, 0.056657, 0.000000
	Synaptics Off (315):	0
	Synaptics Locked Drags (316):	0
	Synaptics Locked Drags Timeout (317):	5000
	Synaptics Tap Action (318):	2, 3, 0, 0, 1, 3, 2
	Synaptics Click Action (319):	1, 3, 0
	Synaptics Circular Scrolling (320):	0
	Synaptics Circular Scrolling Distance (321):	0.100000
	Synaptics Circular Scrolling Trigger (322):	0
	Synaptics Circular Pad (323):	0
	Synaptics Palm Detection (324):	0
	Synaptics Palm Dimensions (325):	10, 200
	Synaptics Coasting Speed (326):	20.000000, 50.000000
	Synaptics Pressure Motion (327):	30, 160
	Synaptics Pressure Motion Factor (328):	1.000000, 1.000000
	Synaptics Resolution Detect (329):	1
	Synaptics Grab Event Device (330):	0
	Synaptics Gestures (331):	1
	Synaptics Capabilities (332):	1, 0, 0, 1, 1, 1, 1
	Synaptics Pad Resolution (333):	32, 32
	Synaptics Area (334):	0, 0, 0, 0
	Synaptics Soft Button Areas (335):	1480, 0, 1577, 0, 0, 0, 0, 0
	Synaptics Noise Cancellation (336):	17, 17
	Device Product ID (258):	2, 14
	Device Node (259):	"/dev/input/event5"
----------

Letting 'evtest' run a bit, it doesn't take long for a rogue click to occur:

Code: Select all

Event: time 1483841938.255895, type 3 (EV_ABS), code 57 (ABS_MT_TRACKING_ID), value 28
	Don't care about this
Event: time 1483841938.255895, type 3 (EV_ABS), code 53 (ABS_MT_POSITION_X), value 2425
	Don't care about this
Event: time 1483841938.255895, type 3 (EV_ABS), code 54 (ABS_MT_POSITION_Y), value 1
	Don't care about this
Event: time 1483841938.255895, type 3 (EV_ABS), code 58 (ABS_MT_PRESSURE), value 0
	Multitouch pressure registered as 0
Event: time 1483841938.255895, type 3 (EV_ABS), code 48 (ABS_MT_TOUCH_MAJOR), value 0
	The size of the contact area registered as 0
Event: time 1483841938.255895, type 3 (EV_ABS), code 28 (ABS_TOOL_WIDTH), value 0
	The width of the contact area registered as zero
Event: time 1483841938.255895, type 1 (EV_KEY), code 330 (BTN_TOUCH), value 1
	Device is in contact, being touched !
Event: time 1483841938.255895, type 1 (EV_KEY), code 325 (BTN_TOOL_FINGER), value 1
	Device in use !
Event: time 1483841938.255895, type 3 (EV_ABS), code 0 (ABS_X), value 2425
	Don't care about this
Event: time 1483841938.255895, type 3 (EV_ABS), code 1 (ABS_Y), value 1
	Don't care about this
Event: time 1483841938.255895, -------------- SYN_REPORT ------------

Event: time 1483841938.329759, type 3 (EV_ABS), code 57 (ABS_MT_TRACKING_ID), value -1
	Unused slot, end of the above event
Event: time 1483841938.329759, type 1 (EV_KEY), code 330 (BTN_TOUCH), value 0
	Device no longer in contact
Event: time 1483841938.329759, type 1 (EV_KEY), code 325 (BTN_TOOL_FINGER), value 0
	Device no longer in use
Event: time 1483841938.329759, -------------- SYN_REPORT ------------
And here we go - the touchpad registered a touch (BTN_TOUCH , BTN_TOOL_FINGER).
I have also seen these values:
Event: time 1483693898.278841, type 3 (EV_ABS), code 58 (ABS_MT_PRESSURE), value 2
Event: time 1483693898.278841, type 3 (EV_ABS), code 28 (ABS_TOOL_WIDTH), value 3
Event: time 1483693898.301009, type 3 (EV_ABS), code 48 (ABS_MT_TOUCH_MAJOR), value 148
Event: time 1483693898.301009, type 3 (EV_ABS), code 28 (ABS_TOOL_WIDTH), value 1

----------

Start with low values:
'xinput set-prop "ETPS/2 Elantech Touchpad" "Synaptics Finger" 1 2 3' (run as user)
The values are:
Release pressure (FingerLow) - below this pressure registers as a release
Touch pressure (FingerHigh) - above this pressure registers as a touch
Note that the value for Touch needs to be higher than Release
Press (I think this is the actual value that represents a click)

----------

Also good to configure is palm detection:
'xinput set-prop "ETPS/2 Elantech Touchpad" "Synaptics Palm Detection" 1' (run as user)
And using the default palm dimension 10,200 (these values were already present in the default settings)

----------

Once you figure out the correct values, you need to make it permanent. The 'xinput' changes only last as long as the current X session.
I'll update this section shortly.

----------

Other resources for further information:
'man synaptics' is the best place to start
https://wiki.archlinux.org/index.php/Touchpad_Synaptics
https://askubuntu.com/questions/483707/ ... -sensitive
https://www.x.org/archive/X11R7.5/doc/m ... ics.4.html
http://www.techrepublic.com/article/twe ... -in-linux/

Post Reply

Return to “Tutorials”