On my Lenovo ThinkPad X1 Gen6 the pms(4) mouse driver regularly fails
after initialization stating:
pms0: not in sync yet, discard input (state = 0, data = 0)
The reason seems to be that the set mode command hasn't finished while
we already enable the device.
>From the Synaptics documentation, 4.3 Mode Byte:
"Note that, as described at the beginning of section 4.1, it is
important to ensure that the device is disabled ($F5) before sending
this command sequence."
The NetBSD driver does send some extra commands after the mode set
command stating:
/* a couple of set scales to clear out pending commands */
I would prefer to just delay instead of sending additional commands.
5000us was to short, but 10000us seems to do the job reliable.
OK?
- Marcus
Index: pms.c
===================================================================
RCS file: /cvs/src/sys/dev/pckbc/pms.c,v
retrieving revision 1.87
diff -u -p -u -p -r1.87 pms.c
--- pms.c 13 May 2018 14:48:19 -0000 1.87
+++ pms.c 26 Jan 2019 07:32:27 -0000
@@ -962,6 +962,12 @@ synaptics_set_mode(struct pms_softc *sc,
pms_set_rate(sc, SYNAPTICS_CMD_SET_MODE))
return (-1);
+ /*
+ * Make sure that the set mode command has finished.
+ * Otherwise enabling the device before that will make it fail.
+ */
+ delay(10000);
+
syn->mode = mode;
return (0);