This patch adds a query for the lower coordinate limits to the Synaptics part of pms. Up to now, the driver always uses the "typical bezel limits" as given in the "Synaptics PS/2 Interfacing Guide". These limits are indeed typical and often work well, but they aren't exact and you cannot control the edge area sizes precisely.
I hope the query solves the problem for the models that support it, and I would expect that it only causes minor changes in current setups. A few tests would be nice. A quick way to check whether it has effects is # wsconsctl mouse.scale The first and the third value of the result should be different from mouse.scale=1472,...,1408,...,...,... Index: pms.c =================================================================== RCS file: /cvs/src/sys/dev/pckbc/pms.c,v retrieving revision 1.78 diff -u -p -r1.78 pms.c --- pms.c 21 Jul 2017 20:10:10 -0000 1.78 +++ pms.c 21 Aug 2017 20:46:45 -0000 @@ -84,7 +84,7 @@ struct synaptics_softc { int identify; int capabilities, ext_capabilities, ext2_capabilities; int model, ext_model; - int resolution, dimension; + int resolution, max_coords, min_coords; int modes; int mode; @@ -928,9 +928,15 @@ synaptics_get_hwinfo(struct pms_softc *s synaptics_query(sc, SYNAPTICS_QUE_RESOLUTION, &syn->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, &syn->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, &syn->min_coords)) + return (-1); + if (SYNAPTICS_ID_FULL(syn->identify) >= 0x705) { if (synaptics_query(sc, SYNAPTICS_QUE_MODES, &syn->modes)) return (-1); @@ -954,12 +960,15 @@ synaptics_get_hwinfo(struct pms_softc *s hw->h_res = SYNAPTICS_RESOLUTION_X(syn->resolution); hw->v_res = SYNAPTICS_RESOLUTION_Y(syn->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 = (syn->min_coords ? + SYNAPTICS_X_LIMIT(syn->min_coords) : SYNAPTICS_XMIN_BEZEL); + hw->y_min = (syn->min_coords ? + SYNAPTICS_Y_LIMIT(syn->min_coords) : SYNAPTICS_YMIN_BEZEL); + hw->x_max = (syn->max_coords ? + SYNAPTICS_X_LIMIT(syn->max_coords) : SYNAPTICS_XMAX_BEZEL); + hw->y_max = (syn->max_coords ? + SYNAPTICS_Y_LIMIT(syn->max_coords) : SYNAPTICS_YMAX_BEZEL); hw->contacts_max = SYNAPTICS_MAX_FINGERS; Index: pmsreg.h =================================================================== RCS file: /cvs/src/sys/dev/pckbc/pmsreg.h,v retrieving revision 1.13 diff -u -p -r1.13 pmsreg.h --- pmsreg.h 5 Sep 2015 14:02:21 -0000 1.13 +++ pmsreg.h 21 Aug 2017 20:46:45 -0000 @@ -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 */