Bug 77480 - synaptics sometimes unable to detect protocol
Summary: synaptics sometimes unable to detect protocol
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: Input/synaptics (show other bugs)
Version: unspecified
Hardware: x86-64 (AMD64) Linux (All)
: medium major
Assignee: Peter Hutterer
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-04-15 10:17 UTC by Clemens Buchacher
Modified: 2017-03-09 02:24 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments
/var/log/Xorg.N.log bad case (19.43 KB, text/plain)
2014-04-15 10:17 UTC, Clemens Buchacher
no flags Details
/var/log/Xorg.0.log bad case (event) (19.44 KB, text/plain)
2014-05-03 10:36 UTC, Clemens Buchacher
no flags Details
/var/log/Xorg.N.log bad case (event; with debug output) (19.65 KB, text/plain)
2014-05-17 17:19 UTC, Clemens Buchacher
no flags Details
Xorg.N.log good case (event; with debug output; session preceding 99225) (19.65 KB, text/plain)
2014-05-17 17:22 UTC, Clemens Buchacher
no flags Details
0001-eventcomm-Drop-requirement-for-a-grab-during-init.patch (4.21 KB, patch)
2014-05-18 22:15 UTC, Peter Hutterer
no flags Details | Splinter Review

Description Clemens Buchacher 2014-04-15 10:17:40 UTC
Created attachment 97393 [details]
/var/log/Xorg.N.log bad case

In 1 out of roughly 2 or 3 cases, after restarting X the touchpad events are not registered (neither movement nor buttons). At the same time the USB mouse is unaffected. Switching to the console with the touchpad broken in X, sudo evtest /dev/input/event8 (where event8 is the touchpad) outputs events as expected. So the device itself is working fine.

I restart X using sudo systemctl restart gdm. Synaptics version is xf86-input-synaptics 1.7.4. I am using Arch Linux.

* /var/log/Xorg.N.log bad case

[...]
[  1934.613] (EE) synaptics: ETPS/2 Elantech Touchpad: Synaptics driver unable to detect protocol
[  1934.613] (EE) PreInit returned 11 for "ETPS/2 Elantech Touchpad"
[  1934.613] (II) UnloadModule: "synaptics"
[...]

* /var/log/Xorg.N.log good case

Timestamps are removed because I did a diff and other than timestamps this section is indeed the only difference.

[...]
(II) synaptics: ETPS/2 Elantech Touchpad: ignoring touch events for semi-multitouch device
(--) synaptics: ETPS/2 Elantech Touchpad: x-axis range 0 - 1280 (res 0)
(--) synaptics: ETPS/2 Elantech Touchpad: y-axis range 0 - 704 (res 0)
(--) synaptics: ETPS/2 Elantech Touchpad: pressure range 0 - 255
(--) synaptics: ETPS/2 Elantech Touchpad: finger width range 0 - 15
(--) synaptics: ETPS/2 Elantech Touchpad: buttons: left right double triple
(--) synaptics: ETPS/2 Elantech Touchpad: Vendor 0x2 Product 0xe
(**) Option "CornerCoasting" "false"
(**) Option "HorizTwoFingerScroll" "false"
(**) Option "TapButton1" "0"
(**) Option "TapButton2" "0"
(**) Option "TapButton3" "0"
(**) Option "CoastingSpeed" "0"
(--) synaptics: ETPS/2 Elantech Touchpad: touchpad found
(**) ETPS/2 Elantech Touchpad: always reports core events
(**) Option "config_info" "udev:/sys/devices/platform/i8042/serio4/input/input12/event8"
(II) XINPUT: Adding extended input device "ETPS/2 Elantech Touchpad" (type: TOUCHPAD, id 13)
(**) synaptics: ETPS/2 Elantech Touchpad: (accel) MinSpeed is now constant deceleration 2.5
(**) synaptics: ETPS/2 Elantech Touchpad: (accel) MaxSpeed is now 1.75
(**) synaptics: ETPS/2 Elantech Touchpad: (accel) AccelFactor is now 0.137
(**) ETPS/2 Elantech Touchpad: (accel) keeping acceleration scheme 1
(**) ETPS/2 Elantech Touchpad: (accel) acceleration profile 1
(**) ETPS/2 Elantech Touchpad: (accel) acceleration factor: 2.000
(**) ETPS/2 Elantech Touchpad: (accel) acceleration threshold: 4
(--) synaptics: ETPS/2 Elantech Touchpad: touchpad found
[...]
Comment 1 Peter Hutterer 2014-05-01 03:09:52 UTC
weird. the only way this should fail is when the ioctls fail. and that would indicate a kernel issue. Add this section to your xorg.conf.d somewhere:

Section "InputClass"
   Identifier "don't grab synaptics"
   MatchDriver "synaptics"
   Option "Protocol" "event"
EndSection

This is not a permanent fix, it should narrow down where things go wrong though.
Comment 2 Clemens Buchacher 2014-05-03 10:36:18 UTC
Created attachment 98373 [details]
/var/log/Xorg.0.log bad case (event)

Same issue with this added to xorg.conf.d:

Section "InputClass"
   Identifier "don't grab synaptics"
   MatchDriver "synaptics"
   Option "Protocol" "event"
EndSection
Comment 3 Clemens Buchacher 2014-05-03 10:39:34 UTC
Instead of the original error I now get:

 (II) synaptics: ETPS/2 Elantech Touchpad: ignoring touch events for semi-multitouch device
 (--) synaptics: ETPS/2 Elantech Touchpad: x-axis range 0 - 1280 (res 0)
 (--) synaptics: ETPS/2 Elantech Touchpad: y-axis range 0 - 704 (res 0)
 (--) synaptics: ETPS/2 Elantech Touchpad: pressure range 0 - 255
 (--) synaptics: ETPS/2 Elantech Touchpad: finger width range 0 - 15
 (--) synaptics: ETPS/2 Elantech Touchpad: buttons: left right double triple
 (--) synaptics: ETPS/2 Elantech Touchpad: Vendor 0x2 Product 0xe
 (**) Option "CornerCoasting" "false"
 (**) Option "HorizTwoFingerScroll" "false"
 (**) Option "TapButton1" "0"
 (**) Option "TapButton2" "0"
 (**) Option "TapButton3" "0"
 (**) Option "CoastingSpeed" "0"
 (--) synaptics: ETPS/2 Elantech Touchpad: touchpad found
 (**) ETPS/2 Elantech Touchpad: always reports core events
 (**) Option "config_info" "udev:/sys/devices/platform/i8042/serio4/input/input12/event8"
 (II) XINPUT: Adding extended input device "ETPS/2 Elantech Touchpad" (type: TOUCHPAD, id 12)
 (**) synaptics: ETPS/2 Elantech Touchpad: (accel) MinSpeed is now constant deceleration 2.5
 (**) synaptics: ETPS/2 Elantech Touchpad: (accel) MaxSpeed is now 1.75
 (**) synaptics: ETPS/2 Elantech Touchpad: (accel) AccelFactor is now 0.137
 (**) ETPS/2 Elantech Touchpad: (accel) keeping acceleration scheme 1
 (**) ETPS/2 Elantech Touchpad: (accel) acceleration profile 1
 (**) ETPS/2 Elantech Touchpad: (accel) acceleration factor: 2.000
 (**) ETPS/2 Elantech Touchpad: (accel) acceleration threshold: 4
 (WW) synaptics: ETPS/2 Elantech Touchpad: can't grab event device, errno=16
 [dix] couldn't enable device 12
 (EE) Couldn't init device "ETPS/2 Elantech Touchpad"
Comment 4 Peter Hutterer 2014-05-04 02:02:38 UTC
Something has a kernel grab on the device. Does anything else access the device? check with lsof if there's another process, if not there may be a race where synaptics doesn't close the fd correctly.

If you add Option "GrabEventDevice" "off", does this fix the issue? If so, it's a synaptics bug.
Comment 5 Clemens Buchacher 2014-05-10 11:18:28 UTC
There is no output from "sudo lsof | grep event8" when the issue occurs.

I cannot reproduce the issue with GrabEventDevice off.
Comment 6 Peter Hutterer 2014-05-13 00:29:11 UTC
Does the touchpad work? The two logs you posted are caused by the same issue - something else has a grab on the device. If that happens in the initial load you get the "unable to detect protocol" issue, if it happens during device enable you get the "can't grab event device, errno=16" error. 16 is EBUSY which is what the kernel returns when some other client has a grab on the fd.

This could be some imbalanced call in the driver but then I'd expect more people to hit this. Could be a race condition between whatever else tries to grab it just at the wrong time, but I don't know what else is running on your box. the GrabEventDevice option would only fix the second error, if it fixes _both_ errors that could mean you have some other synaptics instance running, or there is some imbalanced call. I wonder if you're hitting a race where one server starts up before the other finished?
Comment 7 Clemens Buchacher 2014-05-13 05:19:54 UTC
With either logfile, the touchpad does not work.

I added the GrabEventDevice off Option to the new Section you proposed in Comment 1. In that case the touchpad is always working and I did not look at the logs.

What is maybe unusual about my setup is the combination of gdm and kde.

I think your suspicion that the device is not properly closed during thr restart sounds reasonable. Can't I enable some kernel trace to confirm this?
Comment 8 Peter Hutterer 2014-05-13 05:38:14 UTC
gdm/kde shouldn't matter too much, unless you're starting a second X server and seeing some race condition there I guess. There is no good way to debug this other than putting ErrorF() statements into the driver and looking at the log but that requires building the driver from git. You can strace the server, but that'll be harder than just building the driver.
Comment 9 Clemens Buchacher 2014-05-13 06:10:42 UTC
I will look into building the driver. This is rather easy with Arch's build system, but I have to install some build dependencies which may require some package upgrades, for example an upgrade to xf86-input-synaptic 1.7.5. Do you think that's ok, or should I try not to change the system?
Comment 10 Clemens Buchacher 2014-05-13 06:19:05 UTC
Err, never mind. My mistake, I can build just fine without upgrading anything.
Comment 11 Clemens Buchacher 2014-05-13 06:41:39 UTC
eventcomm.o: In function `event_query_is_touchpad':
eventcomm.c:(.text+0xee): undefined reference to `xf86ErrorF'

Same with ErrorF. I guess I'll just use xf86IDrvMsg.
Comment 12 Clemens Buchacher 2014-05-17 17:19:28 UTC
Created attachment 99225 [details]
/var/log/Xorg.N.log bad case (event; with debug output)

I added the output "xf86OpenSerial", "xf86CloseSerial" to corresponding function calls, and "grab: $fd", "ungrab: $fd" to ioctl(fd, EVIOCGRAB, [10]) calls.

There is no "ungrab" in the log for the previous session (not attached), which would explain why the device cannot be grabbed yet by the new session. It also explains why this happens only every second time. But I am not sure if output from closing the X session still goes to the log file?
Comment 13 Clemens Buchacher 2014-05-17 17:22:19 UTC
Created attachment 99226 [details]
Xorg.N.log good case (event; with debug output; session preceding 99225)

This is the logfile with debugging information from the session with working touchpad, which precedes the session with not working touchpad. The output "ungrab" is missing:

 EventDeviceOffHook(InputInfoPtr pInfo)
 {
     UninitializeTouch(pInfo);
+    xf86IDrvMsg(pInfo, X_WARNING, "ungrab: %i\n", pInfo->fd);
     SYSCALL(ioctl(pInfo->fd, EVIOCGRAB, (pointer) 0));
 
     return Success;
 }
Comment 14 Peter Hutterer 2014-05-18 22:03:14 UTC
looks like you attached the same file twice, sorry. And yes, the output goes to the log file, the logfile is simply rotated to Xorg.N.log.old when the next server starts up.
Comment 15 Peter Hutterer 2014-05-18 22:15:24 UTC
Created attachment 99284 [details] [review]
0001-eventcomm-Drop-requirement-for-a-grab-during-init.patch

This is for synaptics 1.8 and doesn't fix the cause of your bug, but it'll lessen the effect and is generally useful to have anyway. Just figured I'd archive it here too.
Comment 16 Peter Hutterer 2017-03-09 02:24:24 UTC
patch above posted as ddd8844a47bfa28974e40fc9aec9b17656415a6c

other than that - it's almost 3 years later, I'm hoping/guessing that this bug may be fixed now


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.