So, continuing with fixing my netbook, I have another patch which fixes
"pointer skipping". This is a bug in 2 particular (0x20022 and 0x20600)
elantech
v1 firmwares which causes at least the first packet (in my tests, only
one
packet was mangled, but Linux says two and I don't have a way to test it
with
0x20600 FW, so I'm just dropping two packets, since it doesn't change
anything
for my FW) to state the last position and not the current one, thus
jumping the
cursor somewhere else.
I'm not really sure about the counter variable, can it be like this or
should it
get moved to the softc struct or even somewhere else?
Index: pms.c
===================================================================
RCS file: /cvs/src/sys/dev/pckbc/pms.c,v
retrieving revision 1.94
diff -u -p -u -p -r1.94 pms.c
--- pms.c 10 Aug 2020 21:55:59 -0000 1.94
+++ pms.c 2 Sep 2020 14:54:48 -0000
@@ -2425,8 +2425,26 @@ void
pms_proc_elantech_v1(struct pms_softc *sc)
{
struct elantech_softc *elantech = sc->elantech;
+ static int single_touch_pkt = 0;
int x, y, w, z;
u_int buttons;
+
+ /*
+ * Firmwares 0x20022 and 0x20600 have a bug, which makes the first 2
+ * position reports mangled, which in turns causes cursor skipping.
+ */
+
+ if (elantech->fw_version == 0x20022 || elantech->fw_version ==
0x20600) {
+ if((sc->packet[0] & 0xc0) >> 6)
+ {
+ if(single_touch_pkt < 2)
+ {
+ single_touch_pkt++;
+ return;
+ }
+ } else
+ single_touch_pkt = 0;
+ }
buttons = butmap[sc->packet[0] & 3];