diff options
author | Uwe Stuehler <uwe@cvs.openbsd.org> | 2005-04-24 18:55:50 +0000 |
---|---|---|
committer | Uwe Stuehler <uwe@cvs.openbsd.org> | 2005-04-24 18:55:50 +0000 |
commit | 879323ed84438d1562ddaa1dc5dfa891a8e30d70 (patch) | |
tree | 77322298f9e3aba0df2fbfc6fafb4843e596215e /sbin/sysctl | |
parent | d8ae39c8f007b132312ae0a959d0caf0b6a7743b (diff) |
Do down-sampling of the high-resolution touch pad events in kernel,
and provide sysctls for fine-tuning the touch pad area that covers the
screen. Reasonable defaults are provided, but each machine can be a
bit different due to the manufacturing process.
Diffstat (limited to 'sbin/sysctl')
-rw-r--r-- | sbin/sysctl/sysctl.c | 77 |
1 files changed, 75 insertions, 2 deletions
diff --git a/sbin/sysctl/sysctl.c b/sbin/sysctl/sysctl.c index 60262e1558c..057f4b75b14 100644 --- a/sbin/sysctl/sysctl.c +++ b/sbin/sysctl/sysctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sysctl.c,v 1.119 2005/04/20 23:40:12 beck Exp $ */ +/* $OpenBSD: sysctl.c,v 1.120 2005/04/24 18:55:49 uwe Exp $ */ /* $NetBSD: sysctl.c,v 1.9 1995/09/30 07:12:50 thorpej Exp $ */ /* @@ -40,7 +40,7 @@ static const char copyright[] = #if 0 static const char sccsid[] = "@(#)sysctl.c 8.5 (Berkeley) 5/9/95"; #else -static const char rcsid[] = "$OpenBSD: sysctl.c,v 1.119 2005/04/20 23:40:12 beck Exp $"; +static const char rcsid[] = "$OpenBSD: sysctl.c,v 1.120 2005/04/24 18:55:49 uwe Exp $"; #endif #endif /* not lint */ @@ -182,6 +182,7 @@ int Aflag, aflag, nflag, qflag; #define LONGARRAY 0x00000800 #define KMEMSTATS 0x00001000 #define SENSORS 0x00002000 +#define ZTSSCALE 0x00004000 /* prototypes */ void debuginit(void); @@ -308,6 +309,14 @@ parse(char *string, int flags) struct list *lp; int mib[CTL_MAXNAME]; char *cp, *bufp, buf[BUFSIZ]; +#ifdef CPU_ZTSSCALE + struct ztsscale { + int ts_minx; + int ts_maxx; + int ts_miny; + int ts_maxy; + } tsbuf; +#endif (void)strlcpy(buf, string, sizeof(buf)); bufp = buf; @@ -609,6 +618,46 @@ parse(char *string, int flags) break; } #endif +#ifdef CPU_ZTSSCALE + if (mib[1] == CPU_ZTSSCALE) { + special |= ZTSSCALE; + if (newsize > 0) { + const char *errstr = 0; + + /* Unspecified values default to 0. */ + bzero(&tsbuf, sizeof tsbuf); + newval = (void *)strtok(newval, ","); + if (newval != NULL) { + tsbuf.ts_minx = (int)strtonum(newval, + 0, 32768, &errstr); + newval = (void *)strtok(NULL, ","); + } + if (!errstr && newval != NULL) { + tsbuf.ts_maxx = (int)strtonum(newval, + 0, 32768, &errstr); + newval = (void *)strtok(NULL, ","); + } + if (!errstr && newval != NULL) { + tsbuf.ts_miny = (int)strtonum(newval, + 0, 32768, &errstr); + newval = (void *)strtok(NULL, ","); + } + if (!errstr && newval != NULL) { + tsbuf.ts_maxy = (int)strtonum(newval, + 0, 32768, &errstr); + newval = (void *)strtok(NULL, ","); + } + if (errstr) + errx(1, "calibration value is %s", + errstr); + if (newval != NULL) + errx(1, "too many calibration values"); + newval = &tsbuf; + newsize = sizeof(tsbuf); + } + break; + } +#endif break; case CTL_FS: @@ -922,6 +971,30 @@ parse(char *string, int flags) } return; } + if (special & ZTSSCALE) { + struct ztsscale *tsp; + + if (newsize == 0) { + if (!nflag) + (void)printf("%s%s", string, equ); + tsp = (struct ztsscale *)buf; + (void)printf("%d,%d,%d,%d\n", tsp->ts_minx, + tsp->ts_maxx, tsp->ts_miny, tsp->ts_maxy); + } else { + if (!qflag) { + if (!nflag) { + tsp = (struct ztsscale *)buf; + (void)printf("%s: %d,%d,%d,%d -> ", + string, tsp->ts_minx, tsp->ts_maxx, + tsp->ts_miny, tsp->ts_maxy); + } + tsp = (struct ztsscale *)newval; + (void)printf("%d,%d,%d,%d\n", tsp->ts_minx, + tsp->ts_maxx, tsp->ts_miny, tsp->ts_maxy); + } + } + return; + } switch (type) { case CTLTYPE_INT: |