diff options
author | bru <bru@cvs.openbsd.org> | 2015-09-05 14:02:22 +0000 |
---|---|---|
committer | bru <bru@cvs.openbsd.org> | 2015-09-05 14:02:22 +0000 |
commit | 6aac782f1d699d4e63c71901fa38466423e5bffb (patch) | |
tree | a914101869f349dbe21b72bab1afb500a72928a4 | |
parent | d66d36ac7d36baca5baa8922a68c5bd53bf3efe1 (diff) |
Support Synaptics touchpads without W mode.
Emulate W mode if a Synaptics model doesn't provide it, and check
for the success of the resolution query during setup.
ok shadchin@, mpi@
-rw-r--r-- | sys/dev/pckbc/pms.c | 42 | ||||
-rw-r--r-- | sys/dev/pckbc/pmsreg.h | 3 |
2 files changed, 19 insertions, 26 deletions
diff --git a/sys/dev/pckbc/pms.c b/sys/dev/pckbc/pms.c index 147a130c49c..9c90253d5f2 100644 --- a/sys/dev/pckbc/pms.c +++ b/sys/dev/pckbc/pms.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pms.c,v 1.66 2015/09/05 13:52:54 bru Exp $ */ +/* $OpenBSD: pms.c,v 1.67 2015/09/05 14:02:21 bru Exp $ */ /* $NetBSD: psm.c,v 1.11 2000/06/05 22:20:57 sommerfeld Exp $ */ /*- @@ -950,8 +950,10 @@ synaptics_get_hwinfo(struct pms_softc *sc) return (-1); } - syn->res_x = SYNAPTICS_RESOLUTION_X(syn->resolution); - syn->res_y = SYNAPTICS_RESOLUTION_Y(syn->resolution); + if (syn->resolution & SYNAPTICS_RESOLUTION_VALID) { + syn->res_x = SYNAPTICS_RESOLUTION_X(syn->resolution); + syn->res_y = SYNAPTICS_RESOLUTION_Y(syn->resolution); + } syn->min_x = SYNAPTICS_XMIN_BEZEL; syn->min_y = SYNAPTICS_YMIN_BEZEL; syn->max_x = (syn->dimension) ? @@ -1164,30 +1166,21 @@ pms_proc_synaptics(struct pms_softc *sc) w = ((sc->packet[0] & 0x30) >> 2) | ((sc->packet[0] & 0x04) >> 1) | ((sc->packet[3] & 0x04) >> 2); + z = sc->packet[2]; - /* - * Conform to the encoding understood by - * /usr/xenocara/driver/xf86-input-synaptics/src/wsconscomm.c - */ - switch (w) { - case 0: - /* fingerwidth 5, numfingers 2 */ - break; - case 1: - /* fingerwidth 5, numfingers 3 */ - break; - case 5: - /* fingerwidth 5, numfingers 1 */ - break; - case 4: - case 8: - /* fingerwidth 4, numfingers 1 */ - w = 4; - break; - default: - break; + if ((syn->capabilities & SYNAPTICS_CAP_EXTENDED) == 0) { + /* + * Emulate W mode for models that don't provide it. Bit 3 + * of the w-input signals a touch ("finger"), Bit 2 and + * the "gesture" bits 1-0 can be ignored. + */ + if (w & 8) + w = 4; + else + z = w = 0; } + if ((syn->capabilities & SYNAPTICS_CAP_PASSTHROUGH) && w == 3) { synaptics_sec_proc(sc); return; @@ -1204,7 +1197,6 @@ pms_proc_synaptics(struct pms_softc *sc) sc->packet[4]; y = ((sc->packet[3] & 0x20) << 7) | ((sc->packet[1] & 0xf0) << 4) | sc->packet[5]; - z = sc->packet[2]; buttons = ((sc->packet[0] & sc->packet[3]) & 0x01) ? WSMOUSE_BUTTON(1) : 0; diff --git a/sys/dev/pckbc/pmsreg.h b/sys/dev/pckbc/pmsreg.h index 684ece8c800..217699b3baa 100644 --- a/sys/dev/pckbc/pmsreg.h +++ b/sys/dev/pckbc/pmsreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pmsreg.h,v 1.12 2015/09/05 13:52:54 bru Exp $ */ +/* $OpenBSD: pmsreg.h,v 1.13 2015/09/05 14:02:21 bru Exp $ */ /* $NetBSD: psmreg.h,v 1.1 1998/03/22 15:41:28 drochner Exp $ */ #ifndef SYS_DEV_PCKBC_PMSREG_H @@ -119,6 +119,7 @@ #define SYNAPTICS_MODEL_GEOMETRY(m) ((m) & 0x0f) /* Resolutions */ +#define SYNAPTICS_RESOLUTION_VALID (1 << 15) #define SYNAPTICS_RESOLUTION_X(r) (((r) >> 16) & 0xff) #define SYNAPTICS_RESOLUTION_Y(r) ((r) & 0xff) |