diff options
author | Jean-Sébastien Pédron <dumbbell@FreeBSD.org> | 2018-01-20 11:02:18 +0000 |
---|---|---|
committer | Jean-Sébastien Pédron <dumbbell@FreeBSD.org> | 2018-01-20 11:02:18 +0000 |
commit | 9402bd96df8000c2ac5d9c239ff746919af0dd66 (patch) | |
tree | f316115ab96a1daea8d2652ed0bca110e054b3a2 /sys/dev/atkbdc/psm.c | |
parent | 450c7a04f77097cd0c7d649180e5a417ddcf7972 (diff) | |
download | src-9402bd96df8000c2ac5d9c239ff746919af0dd66.tar.gz src-9402bd96df8000c2ac5d9c239ff746919af0dd66.zip |
psm: Skip sync check when `PSM_CONFIG_NOCHECKSYNC` is set
In psmprobe(), we set the initial `syncmask` to the vendor default value
if the `PSM_CONFIG_NOCHECKSYNC` bit is unset. However, we currently only
set it for the Elantech touchpad later in psmattach(), thus `syncmask`
is always configured.
Now, we check `PSM_CONFIG_NOCHECKSYNC` and skip sync check if it is set.
This fixes Elantech touchpad support for units which have `hascrc` set.
To clarify that, when we log the `syncmask` and `syncbits` fields, also
mention if they are actually used.
Finally, when we set `PSM_CONFIG_NOCHECKSYNC`, clear `PSM_NEED_SYNCBITS`
flag.
PR: 225338
MFC after: 1 week
Notes
Notes:
svn path=/head/; revision=328190
Diffstat (limited to 'sys/dev/atkbdc/psm.c')
-rw-r--r-- | sys/dev/atkbdc/psm.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/sys/dev/atkbdc/psm.c b/sys/dev/atkbdc/psm.c index 608e4c58f0f0..8037ea5513f1 100644 --- a/sys/dev/atkbdc/psm.c +++ b/sys/dev/atkbdc/psm.c @@ -1947,8 +1947,10 @@ psmattach(device_t dev) /* Elantech trackpad`s sync bit differs from touchpad`s one */ if (sc->hw.model == MOUSE_MODEL_ELANTECH && - (sc->elanhw.hascrc || sc->elanhw.hastrackpoint)) + (sc->elanhw.hascrc || sc->elanhw.hastrackpoint)) { sc->config |= PSM_CONFIG_NOCHECKSYNC; + sc->flags &= ~PSM_NEED_SYNCBITS; + } if (!verbose) printf("psm%d: model %s, device ID %d\n", @@ -1959,8 +1961,9 @@ psmattach(device_t dev) sc->hw.hwid >> 8, sc->hw.buttons); printf("psm%d: config:%08x, flags:%08x, packet size:%d\n", unit, sc->config, sc->flags, sc->mode.packetsize); - printf("psm%d: syncmask:%02x, syncbits:%02x\n", - unit, sc->mode.syncmask[0], sc->mode.syncmask[1]); + printf("psm%d: syncmask:%02x, syncbits:%02x%s\n", + unit, sc->mode.syncmask[0], sc->mode.syncmask[1], + sc->config & PSM_CONFIG_NOCHECKSYNC ? " (sync not checked)" : ""); } if (bootverbose) @@ -2976,7 +2979,8 @@ psmintr(void *arg) VLOG(2, (LOG_DEBUG, "psmintr: Sync bytes now %04x,%04x\n", sc->mode.syncmask[0], sc->mode.syncmask[0])); - } else if ((c & sc->mode.syncmask[0]) != sc->mode.syncmask[1]) { + } else if ((sc->config & PSM_CONFIG_NOCHECKSYNC) == 0 && + (c & sc->mode.syncmask[0]) != sc->mode.syncmask[1]) { VLOG(3, (LOG_DEBUG, "psmintr: out of sync " "(%04x != %04x) %d cmds since last error.\n", c & sc->mode.syncmask[0], sc->mode.syncmask[1], |