From d8ae6bd498eb0ea7d086acddac6d3ddda2592c87 Mon Sep 17 00:00:00 2001 From: Ulf Brosziewski Date: Fri, 25 Aug 2017 19:44:22 +0000 Subject: Query the lower coordinate limits. --- sys/dev/pckbc/pms.c | 37 +++++++++++++++++++++++-------------- sys/dev/pckbc/pmsreg.h | 14 ++++++++------ 2 files changed, 31 insertions(+), 20 deletions(-) (limited to 'sys/dev/pckbc') diff --git a/sys/dev/pckbc/pms.c b/sys/dev/pckbc/pms.c index 18f0a3205be..3fa7ed354fe 100644 --- a/sys/dev/pckbc/pms.c +++ b/sys/dev/pckbc/pms.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pms.c,v 1.78 2017/07/21 20:10:10 bru Exp $ */ +/* $OpenBSD: pms.c,v 1.79 2017/08/25 19:44:21 bru Exp $ */ /* $NetBSD: psm.c,v 1.11 2000/06/05 22:20:57 sommerfeld Exp $ */ /*- @@ -84,7 +84,6 @@ struct synaptics_softc { int identify; int capabilities, ext_capabilities, ext2_capabilities; int model, ext_model; - int resolution, dimension; int modes; int mode; @@ -907,6 +906,7 @@ synaptics_get_hwinfo(struct pms_softc *sc) { struct synaptics_softc *syn = sc->synaptics; struct wsmousehw *hw; + int resolution, max_coords, min_coords; hw = wsmouse_get_hw(sc->sc_wsmousedev); @@ -925,12 +925,18 @@ synaptics_get_hwinfo(struct pms_softc *sc) &syn->ext_capabilities)) return (-1); if ((SYNAPTICS_ID_MAJOR(syn->identify) >= 4) && - synaptics_query(sc, SYNAPTICS_QUE_RESOLUTION, &syn->resolution)) + synaptics_query(sc, SYNAPTICS_QUE_RESOLUTION, &resolution)) return (-1); if ((SYNAPTICS_CAP_EXTENDED_QUERIES(syn->capabilities) >= 5) && - (syn->ext_capabilities & SYNAPTICS_EXT_CAP_MAX_DIMENSIONS) && - synaptics_query(sc, SYNAPTICS_QUE_EXT_DIMENSIONS, &syn->dimension)) + (syn->ext_capabilities & SYNAPTICS_EXT_CAP_MAX_COORDS) && + synaptics_query(sc, SYNAPTICS_QUE_EXT_MAX_COORDS, &max_coords)) return (-1); + if ((SYNAPTICS_CAP_EXTENDED_QUERIES(syn->capabilities) >= 7 || + SYNAPTICS_ID_FULL(syn->identify) == 0x801) && + (syn->ext_capabilities & SYNAPTICS_EXT_CAP_MIN_COORDS) && + synaptics_query(sc, SYNAPTICS_QUE_EXT_MIN_COORDS, &min_coords)) + return (-1); + if (SYNAPTICS_ID_FULL(syn->identify) >= 0x705) { if (synaptics_query(sc, SYNAPTICS_QUE_MODES, &syn->modes)) return (-1); @@ -950,16 +956,19 @@ synaptics_get_hwinfo(struct pms_softc *sc) hw->hw_type = (syn->ext_capabilities & SYNAPTICS_EXT_CAP_CLICKPAD) ? WSMOUSEHW_CLICKPAD : WSMOUSEHW_TOUCHPAD; - if (syn->resolution & SYNAPTICS_RESOLUTION_VALID) { - hw->h_res = SYNAPTICS_RESOLUTION_X(syn->resolution); - hw->v_res = SYNAPTICS_RESOLUTION_Y(syn->resolution); + if (resolution & SYNAPTICS_RESOLUTION_VALID) { + hw->h_res = SYNAPTICS_RESOLUTION_X(resolution); + hw->v_res = SYNAPTICS_RESOLUTION_Y(resolution); } - hw->x_min = SYNAPTICS_XMIN_BEZEL; - hw->y_min = SYNAPTICS_YMIN_BEZEL; - hw->x_max = (syn->dimension) ? - SYNAPTICS_DIM_X(syn->dimension) : SYNAPTICS_XMAX_BEZEL; - hw->y_max = (syn->dimension) ? - SYNAPTICS_DIM_Y(syn->dimension) : SYNAPTICS_YMAX_BEZEL; + + hw->x_min = (min_coords ? + SYNAPTICS_X_LIMIT(min_coords) : SYNAPTICS_XMIN_BEZEL); + hw->y_min = (min_coords ? + SYNAPTICS_Y_LIMIT(min_coords) : SYNAPTICS_YMIN_BEZEL); + hw->x_max = (max_coords ? + SYNAPTICS_X_LIMIT(max_coords) : SYNAPTICS_XMAX_BEZEL); + hw->y_max = (max_coords ? + SYNAPTICS_Y_LIMIT(max_coords) : SYNAPTICS_YMAX_BEZEL); hw->contacts_max = SYNAPTICS_MAX_FINGERS; diff --git a/sys/dev/pckbc/pmsreg.h b/sys/dev/pckbc/pmsreg.h index 217699b3baa..6aafdfdaea1 100644 --- a/sys/dev/pckbc/pmsreg.h +++ b/sys/dev/pckbc/pmsreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pmsreg.h,v 1.13 2015/09/05 14:02:21 bru Exp $ */ +/* $OpenBSD: pmsreg.h,v 1.14 2017/08/25 19:44:21 bru Exp $ */ /* $NetBSD: psmreg.h,v 1.1 1998/03/22 15:41:28 drochner Exp $ */ #ifndef SYS_DEV_PCKBC_PMSREG_H @@ -73,7 +73,8 @@ #define SYNAPTICS_QUE_RESOLUTION 0x08 #define SYNAPTICS_QUE_EXT_MODEL 0x09 #define SYNAPTICS_QUE_EXT_CAPABILITIES 0x0c -#define SYNAPTICS_QUE_EXT_DIMENSIONS 0x0d +#define SYNAPTICS_QUE_EXT_MAX_COORDS 0x0d +#define SYNAPTICS_QUE_EXT_MIN_COORDS 0x0f #define SYNAPTICS_QUE_EXT2_CAPABILITIES 0x10 #define SYNAPTICS_CMD_SET_MODE 0x14 @@ -137,13 +138,14 @@ /* Extended Capability bits */ #define SYNAPTICS_EXT_CAP_CLICKPAD (1 << 20) #define SYNAPTICS_EXT_CAP_ADV_GESTURE (1 << 19) -#define SYNAPTICS_EXT_CAP_MAX_DIMENSIONS (1 << 17) +#define SYNAPTICS_EXT_CAP_MAX_COORDS (1 << 17) +#define SYNAPTICS_EXT_CAP_MIN_COORDS (1 << 13) #define SYNAPTICS_EXT_CAP_CLICKPAD_2BTN (1 << 8) -/* Extended Dimensions */ -#define SYNAPTICS_DIM_X(d) ((((d) & 0xff0000) >> 11) | \ +/* Coordinate Limits */ +#define SYNAPTICS_X_LIMIT(d) ((((d) & 0xff0000) >> 11) | \ (((d) & 0xf00) >> 7)) -#define SYNAPTICS_DIM_Y(d) ((((d) & 0xff) << 5) | \ +#define SYNAPTICS_Y_LIMIT(d) ((((d) & 0xff) << 5) | \ (((d) & 0xf000) >> 11)) /* Extended Capability 2 */ -- cgit v1.2.3