CVS commit: src/sbin/wsconsctl
Module Name:src Committed By: drochner Date: Fri Jan 29 09:49:34 UTC 2010 Modified Files: src/sbin/wsconsctl: keysym.c Log Message: follow KS_GROUP_Ascii->KS_GROUP_Plain rename in kernel, noticed by Andreas Gustafsson To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sbin/wsconsctl/keysym.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/wsconsctl/keysym.c diff -u src/sbin/wsconsctl/keysym.c:1.9 src/sbin/wsconsctl/keysym.c:1.10 --- src/sbin/wsconsctl/keysym.c:1.9 Mon Apr 6 12:35:20 2009 +++ src/sbin/wsconsctl/keysym.c Fri Jan 29 09:49:34 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: keysym.c,v 1.9 2009/04/06 12:35:20 lukem Exp $ */ +/* $NetBSD: keysym.c,v 1.10 2010/01/29 09:49:34 drochner Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -180,7 +180,7 @@ if (ksym >= KS_f1 && ksym <= KS_f20) return KS_F1 - KS_f1 + ksym; - if (KS_GROUP(ksym) == KS_GROUP_Ascii && ksym <= 0xff && + if (KS_GROUP(ksym) == KS_GROUP_Plain && ksym <= 0xff && latin1_to_upper[ksym] != 0x00) return latin1_to_upper[ksym];
CVS commit: src/sbin/wsconsctl
Module Name:src Committed By: lukem Date: Mon Apr 6 12:35:21 UTC 2009 Modified Files: src/sbin/wsconsctl: keysym.c map_parse.y util.c Log Message: fix sign-compare issues To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sbin/wsconsctl/keysym.c cvs rdiff -u -r1.7 -r1.8 src/sbin/wsconsctl/map_parse.y cvs rdiff -u -r1.27 -r1.28 src/sbin/wsconsctl/util.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/wsconsctl/keysym.c diff -u src/sbin/wsconsctl/keysym.c:1.8 src/sbin/wsconsctl/keysym.c:1.9 --- src/sbin/wsconsctl/keysym.c:1.8 Mon Apr 28 20:23:09 2008 +++ src/sbin/wsconsctl/keysym.c Mon Apr 6 12:35:20 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: keysym.c,v 1.8 2008/04/28 20:23:09 martin Exp $ */ +/* $NetBSD: keysym.c,v 1.9 2009/04/06 12:35:20 lukem Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -122,7 +122,7 @@ static void sort_ksym_tab(void) { - int i; + size_t i; for (i = 0; i < NUMKSYMS; i++) ksym_tab_by_ksym[i] = ksym_tab_by_name[i]; Index: src/sbin/wsconsctl/map_parse.y diff -u src/sbin/wsconsctl/map_parse.y:1.7 src/sbin/wsconsctl/map_parse.y:1.8 --- src/sbin/wsconsctl/map_parse.y:1.7 Mon Apr 28 20:23:09 2008 +++ src/sbin/wsconsctl/map_parse.y Mon Apr 6 12:35:20 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: map_parse.y,v 1.7 2008/04/28 20:23:09 martin Exp $ */ +/* $NetBSD: map_parse.y,v 1.8 2009/04/06 12:35:20 lukem Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -63,12 +63,12 @@ struct wskbd_map_data newkbmap; /* used in util.c */ static struct wscons_keymap *cur_mp; -static int ksym_lookup(keysym_t); +static size_t ksym_lookup(keysym_t); -static int +static size_t ksym_lookup(keysym_t ksym) { - int i; + size_t i; struct wscons_keymap *mp; for (i = 0; i < kbmap.maplen; i++) { @@ -124,7 +124,7 @@ ; keysym_expr : T_KEYSYM keysym_var "=" keysym_var = { - int src, dst; + size_t src, dst; dst = ksym_lookup($2); src = ksym_lookup($4); @@ -137,7 +137,7 @@ keycode_expr : T_KEYCODE T_NUMBER "=" = { if ($2 >= KS_NUMKEYCODES) errx(EXIT_FAILURE, "%d: keycode too large", $2); - if ($2 >= newkbmap.maplen) + if ((unsigned int)$2 >= newkbmap.maplen) newkbmap.maplen = $2 + 1; cur_mp = mapdata + $2; } keysym_cmd keysym_list Index: src/sbin/wsconsctl/util.c diff -u src/sbin/wsconsctl/util.c:1.27 src/sbin/wsconsctl/util.c:1.28 --- src/sbin/wsconsctl/util.c:1.27 Mon Apr 28 20:23:09 2008 +++ src/sbin/wsconsctl/util.c Mon Apr 6 12:35:20 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: util.c,v 1.27 2008/04/28 20:23:09 martin Exp $ */ +/* $NetBSD: util.c,v 1.28 2009/04/06 12:35:20 lukem Exp $ */ /*- * Copyright (c) 1998, 2006 The NetBSD Foundation, Inc. @@ -330,11 +330,12 @@ if (f == 0) (void)printf("none"); else { - int i, first, mask; + unsigned int i; + int first, mask; for (i = 0, first = 1, mask = 1; i < sizeof(f) * 8; i++) { if (f & mask) { -(void)printf("%s%d", first ? "" : " ", i); +(void)printf("%s%u", first ? "" : " ", i); first = 0; } mask = mask << 1; @@ -396,14 +397,14 @@ if (merge) { if (newkbmap.maplen < kbmap.maplen) newkbmap.maplen = kbmap.maplen; - for (i = 0; i < kbmap.maplen; i++) { -mp = newkbmap.map + i; + for (u = 0; u < kbmap.maplen; u++) { +mp = newkbmap.map + u; if (mp->command == KS_voidSymbol && mp->group1[0] == KS_voidSymbol && mp->group1[1] == KS_voidSymbol && mp->group2[0] == KS_voidSymbol && mp->group2[1] == KS_voidSymbol) - *mp = kbmap.map[i]; + *mp = kbmap.map[u]; } } kbmap.maplen = newkbmap.maplen; @@ -455,7 +456,7 @@ errx(EXIT_FAILURE, "%s: not a valid number list", str); if (errno == ERANGE && (lval == LONG_MAX || lval == LONG_MIN)) errx(EXIT_FAILURE, "%s: not a valid number list", str); - if (lval >= sizeof(result) * 8) + if (lval >= (long)sizeof(result) * 8) errx(EXIT_FAILURE, "%ld: number out of range", lval); result |= (1 << lval); @@ -470,7 +471,7 @@ static void print_kmap(struct wskbd_map_data *map) { - int i; + unsigned int i; struct wscons_keymap *mp; for (i = 0; i < map->maplen; i++) {
CVS commit: src/sbin/wsconsctl
Module Name:src Committed By: snj Date: Tue Jun 9 19:46:33 UTC 2009 Modified Files: src/sbin/wsconsctl: wsconsctl.8 Log Message: Mention a number of keyboard encodings. >From Jukka Ruohonen in PR kern/15955. To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/sbin/wsconsctl/wsconsctl.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/wsconsctl/wsconsctl.8 diff -u src/sbin/wsconsctl/wsconsctl.8:1.26 src/sbin/wsconsctl/wsconsctl.8:1.27 --- src/sbin/wsconsctl/wsconsctl.8:1.26 Sat Nov 29 05:52:32 2008 +++ src/sbin/wsconsctl/wsconsctl.8 Tue Jun 9 19:46:32 2009 @@ -1,4 +1,4 @@ -.\" $NetBSD: wsconsctl.8,v 1.26 2008/11/29 05:52:32 jnemeth Exp $ +.\" $NetBSD: wsconsctl.8,v 1.27 2009/06/09 19:46:32 snj Exp $ .\" .\" Copyright (c) 1998, 2004 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -27,7 +27,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\"/ -.Dd November 28, 2008 +.Dd June 9, 2009 .Dt WSCONSCTL 8 .Os .Sh NAME @@ -116,8 +116,9 @@ emulation and graphics (mapped) modes. .Pp In addition to British, US, and US-Dvorak keyboard encodings, support -currently exists for the following languages: Danish, Finnish, French, -German, Italian, Japanese, Norwegian, Portuguese, Spanish, and Swedish. +currently exists for the following languages: Belgian, Danish, Finnish, +French, German, Greek, Hungarian, Italian, Japanese, Norwegian, Polish, +Portugese, Russian, Spanish, Swedish, Swiss, and Ukrainian. Additionally, a user-defined encoding is supported. .Sh FILES .Bl -tag -width /dev/wsmouse
CVS commit: src/sbin/wsconsctl
Module Name:src Committed By: phx Date: Tue Nov 30 12:22:07 UTC 2010 Modified Files: src/sbin/wsconsctl: map_parse.y map_scan.l Log Message: Allow standalone commands to be recognized, as in the in-kernel keymaps. Also allow the Cmd token. Examples: keycode 210 = Cmd Cmd_BrightnessUp keycode 211 = Cmd_VolumeToggle To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sbin/wsconsctl/map_parse.y cvs rdiff -u -r1.5 -r1.6 src/sbin/wsconsctl/map_scan.l Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/wsconsctl/map_parse.y diff -u src/sbin/wsconsctl/map_parse.y:1.8 src/sbin/wsconsctl/map_parse.y:1.9 --- src/sbin/wsconsctl/map_parse.y:1.8 Mon Apr 6 12:35:20 2009 +++ src/sbin/wsconsctl/map_parse.y Tue Nov 30 12:22:06 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: map_parse.y,v 1.8 2009/04/06 12:35:20 lukem Exp $ */ +/* $NetBSD: map_parse.y,v 1.9 2010/11/30 12:22:06 phx Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -89,7 +89,7 @@ int ival; } -%token T_KEYSYM T_KEYCODE +%token T_KEYSYM T_KEYCODE T_CMD %token T_KEYSYM_VAR T_KEYSYM_CMD_VAR %token T_NUMBER @@ -147,9 +147,14 @@ | T_KEYSYM_CMD_VAR = { cur_mp->command = $1; } + | T_CMD T_KEYSYM_CMD_VAR = { + cur_mp->command = KS_Cmd; + cur_mp->group1[0] = $2; + } ; -keysym_list : keysym_var = { +keysym_list : /* empty */ + | keysym_var = { cur_mp->group1[0] = $1; cur_mp->group1[1] = ksym_upcase(cur_mp->group1[0]); cur_mp->group2[0] = cur_mp->group1[0]; Index: src/sbin/wsconsctl/map_scan.l diff -u src/sbin/wsconsctl/map_scan.l:1.5 src/sbin/wsconsctl/map_scan.l:1.6 --- src/sbin/wsconsctl/map_scan.l:1.5 Wed Oct 28 19:43:56 2009 +++ src/sbin/wsconsctl/map_scan.l Tue Nov 30 12:22:06 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: map_scan.l,v 1.5 2009/10/28 19:43:56 christos Exp $ */ +/* $NetBSD: map_scan.l,v 1.6 2010/11/30 12:22:06 phx Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -70,6 +70,10 @@ return(T_KEYSYM); } +Cmd { + return(T_CMD); + } + [a-zA-Z][a-zA-Z0-9_]* { int i;
CVS commit: src/sbin/wsconsctl
Module Name:src Committed By: christos Date: Wed Oct 28 19:43:56 UTC 2009 Modified Files: src/sbin/wsconsctl: map_scan.l Log Message: add %option noyywrap To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sbin/wsconsctl/map_scan.l Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/wsconsctl/map_scan.l diff -u src/sbin/wsconsctl/map_scan.l:1.4 src/sbin/wsconsctl/map_scan.l:1.5 --- src/sbin/wsconsctl/map_scan.l:1.4 Mon Apr 28 16:23:09 2008 +++ src/sbin/wsconsctl/map_scan.l Wed Oct 28 15:43:56 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: map_scan.l,v 1.4 2008/04/28 20:23:09 martin Exp $ */ +/* $NetBSD: map_scan.l,v 1.5 2009/10/28 19:43:56 christos Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -40,7 +40,6 @@ #include "wsconsctl.h" #include "map_parse.h" -#define yywrap() 1 void map_scan_setinput(char *str) @@ -51,6 +50,8 @@ %} +%option noyywrap + %% [ \t\n]+ {
CVS commit: src/sbin/wsconsctl
Module Name:src Committed By: pooka Date: Sun Feb 6 21:38:10 UTC 2011 Modified Files: src/sbin/wsconsctl: util.c Log Message: update macro names to match new ones (i don't know why they changed, just fixing the build) To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/sbin/wsconsctl/util.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/wsconsctl/util.c diff -u src/sbin/wsconsctl/util.c:1.28 src/sbin/wsconsctl/util.c:1.29 --- src/sbin/wsconsctl/util.c:1.28 Mon Apr 6 12:35:20 2009 +++ src/sbin/wsconsctl/util.c Sun Feb 6 21:38:09 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: util.c,v 1.28 2009/04/06 12:35:20 lukem Exp $ */ +/* $NetBSD: util.c,v 1.29 2011/02/06 21:38:09 pooka Exp $ */ /*- * Copyright (c) 1998, 2006 The NetBSD Foundation, Inc. @@ -118,12 +118,12 @@ { WSDISPLAY_TYPE_SB_P9100, "sparcbook-p9100" }, { WSDISPLAY_TYPE_EGA, "ega" }, { WSDISPLAY_TYPE_DCPVR, "dreamcast-pvr" }, - { WSDISPLAY_TYPE_GATOR, "hp-gator" }, + { WSDISPLAY_TYPE_GBOX, "hp-gator" }, { WSDISPLAY_TYPE_TOPCAT, "hp-topcat" }, - { WSDISPLAY_TYPE_RENAISSANCE, "hp-renaissance" }, + { WSDISPLAY_TYPE_RBOX, "hp-renaissance" }, { WSDISPLAY_TYPE_CATSEYE, "hp-catseye" }, - { WSDISPLAY_TYPE_DAVINCI, "hp-davinci" }, - { WSDISPLAY_TYPE_TIGER, "hp-tiger" }, + { WSDISPLAY_TYPE_DVBOX, "hp-davinci" }, + { WSDISPLAY_TYPE_TVRX, "hp-tiger" }, { WSDISPLAY_TYPE_HYPERION, "hp-hyperion" }, { WSDISPLAY_TYPE_AMIGACC, "amiga-cc" }, { WSDISPLAY_TYPE_SUN24, "sun24" },
CVS commit: src/sbin/wsconsctl
Module Name:src Committed By: khorben Date: Mon Dec 24 01:20:12 UTC 2012 Modified Files: src/sbin/wsconsctl: util.c Log Message: Added a field type for signed integers. This is required when handling touchscreen calibration values, which is about to be implemented in wsconsctl (see PR kern/45872). Reviewed by uwe@ (thank you!) To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/sbin/wsconsctl/util.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/wsconsctl/util.c diff -u src/sbin/wsconsctl/util.c:1.30 src/sbin/wsconsctl/util.c:1.31 --- src/sbin/wsconsctl/util.c:1.30 Thu Dec 15 14:25:12 2011 +++ src/sbin/wsconsctl/util.c Mon Dec 24 01:20:12 2012 @@ -1,7 +1,7 @@ -/* $NetBSD: util.c,v 1.30 2011/12/15 14:25:12 phx Exp $ */ +/* $NetBSD: util.c,v 1.31 2012/12/24 01:20:12 khorben Exp $ */ /*- - * Copyright (c) 1998, 2006 The NetBSD Foundation, Inc. + * Copyright (c) 1998, 2006, 2012 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation @@ -257,6 +257,9 @@ pr_field(struct field *f, const char *se case FMT_UINT: (void)printf("%u", *((unsigned int *) f->valp)); break; + case FMT_INT: + (void)printf("%d", *((int *) f->valp)); + break; case FMT_STRING: (void)printf("\"%s\"", *((char **) f->valp)); break; @@ -361,6 +364,14 @@ rd_field(struct field *f, char *val, int else *((unsigned int *) f->valp) = u; break; + case FMT_INT: + if (sscanf(val, "%d", &i) != 1) + errx(EXIT_FAILURE, "%s: not a number", val); + if (merge) + *((int *) f->valp) += i; + else + *((int *) f->valp) = i; + break; case FMT_STRING: if ((*((char **) f->valp) = strdup(val)) == NULL) err(EXIT_FAILURE, "strdup");
CVS commit: src/sbin/wsconsctl
Module Name:src Committed By: khorben Date: Mon Dec 24 01:20:45 UTC 2012 Modified Files: src/sbin/wsconsctl: wsconsctl.h Log Message: Added a field type for signed integers. This is required when handling touchscreen calibration values, which is about to be implemented in wsconsctl (see PR kern/45872). Reviewed by uwe@ (thank you!) To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sbin/wsconsctl/wsconsctl.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/wsconsctl/wsconsctl.h diff -u src/sbin/wsconsctl/wsconsctl.h:1.11 src/sbin/wsconsctl/wsconsctl.h:1.12 --- src/sbin/wsconsctl/wsconsctl.h:1.11 Sat Aug 27 19:01:34 2011 +++ src/sbin/wsconsctl/wsconsctl.h Mon Dec 24 01:20:44 2012 @@ -1,7 +1,7 @@ -/* $NetBSD: wsconsctl.h,v 1.11 2011/08/27 19:01:34 joerg Exp $ */ +/* $NetBSD: wsconsctl.h,v 1.12 2012/12/24 01:20:44 khorben Exp $ */ /*- - * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc. + * Copyright (c) 1998, 2004, 2012 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation @@ -55,6 +55,7 @@ struct field { #define FMT_UINT 1 /* unsigned integer */ #define FMT_STRING 2 /* zero terminated string */ #define FMT_BITFIELD 3 /* bit field */ +#define FMT_INT 4 /* signed integer */ #define FMT_KBDTYPE 101 /* keyboard type */ #define FMT_MSTYPE 102 /* mouse type */ #define FMT_DPYTYPE 103 /* display type */
CVS commit: src/sbin/wsconsctl
Module Name:src Committed By: khorben Date: Mon Dec 24 01:27:23 UTC 2012 Modified Files: src/sbin/wsconsctl: mouse.c Log Message: Added read-only support for touchscreen calibration (see PR kern/45872). Tested with the uts(4) driver, as well as with mice without calibration support. Reviewed by uwe@ (thank you!) To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sbin/wsconsctl/mouse.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/wsconsctl/mouse.c diff -u src/sbin/wsconsctl/mouse.c:1.8 src/sbin/wsconsctl/mouse.c:1.9 --- src/sbin/wsconsctl/mouse.c:1.8 Mon Apr 28 20:23:09 2008 +++ src/sbin/wsconsctl/mouse.c Mon Dec 24 01:27:23 2012 @@ -1,7 +1,7 @@ -/* $NetBSD: mouse.c,v 1.8 2008/04/28 20:23:09 martin Exp $ */ +/* $NetBSD: mouse.c,v 1.9 2012/12/24 01:27:23 khorben Exp $ */ /*- - * Copyright (c) 1998, 2006 The NetBSD Foundation, Inc. + * Copyright (c) 1998, 2006, 2012 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation @@ -45,8 +45,12 @@ static int mstype; static int resolution; static int samplerate; +static struct wsmouse_calibcoords calibration; +static char *calibration_samples; static struct wsmouse_repeat repeat; +static void mouse_get_calibration(int); + static void mouse_get_repeat(int); static void mouse_put_repeat(int); @@ -54,6 +58,16 @@ struct field mouse_field_tab[] = { { "resolution", &resolution, FMT_UINT, FLG_WRONLY }, { "samplerate", &samplerate, FMT_UINT, FLG_WRONLY }, { "type", &mstype, FMT_MSTYPE, FLG_RDONLY }, +{ "calibration.minx", &calibration.minx, + FMT_INT, FLG_RDONLY }, +{ "calibration.miny", &calibration.miny, + FMT_INT, FLG_RDONLY }, +{ "calibration.maxx", &calibration.maxx, + FMT_INT, FLG_RDONLY }, +{ "calibration.maxy", &calibration.maxy, + FMT_INT, FLG_RDONLY }, +{ "calibration.samples", &calibration_samples, + FMT_STRING, FLG_RDONLY }, { "repeat.buttons", &repeat.wr_buttons, FMT_BITFIELD, FLG_MODIFY }, { "repeat.delay.first", &repeat.wr_delay_first, @@ -75,6 +89,13 @@ mouse_get_values(int fd) if (ioctl(fd, WSMOUSEIO_GTYPE, &mstype) < 0) err(EXIT_FAILURE, "WSMOUSEIO_GTYPE"); + if (field_by_value(&calibration.minx)->flags & FLG_GET || + field_by_value(&calibration.miny)->flags & FLG_GET || + field_by_value(&calibration.maxx)->flags & FLG_GET || + field_by_value(&calibration.maxy)->flags & FLG_GET || + field_by_value(&calibration_samples)->flags & FLG_GET) + mouse_get_calibration(fd); + if (field_by_value(&repeat.wr_buttons)->flags & FLG_GET || field_by_value(&repeat.wr_delay_first)->flags & FLG_GET || field_by_value(&repeat.wr_delay_decrement)->flags & FLG_GET || @@ -83,11 +104,63 @@ mouse_get_values(int fd) } static void +mouse_get_calibration(int fd) +{ + struct wsmouse_calibcoords tmp; + char *samples; + char buf[48]; + int i; + + if (ioctl(fd, WSMOUSEIO_GCALIBCOORDS, &tmp) < 0) { + field_disable_by_value(&calibration.minx); + field_disable_by_value(&calibration.miny); + field_disable_by_value(&calibration.maxx); + field_disable_by_value(&calibration.maxy); + field_disable_by_value(&calibration_samples); + return; + } + + if (field_by_value(&calibration.minx)->flags & FLG_GET) + calibration.minx = tmp.minx; + if (field_by_value(&calibration.miny)->flags & FLG_GET) + calibration.miny = tmp.miny; + if (field_by_value(&calibration.maxx)->flags & FLG_GET) + calibration.maxx = tmp.maxx; + if (field_by_value(&calibration.maxy)->flags & FLG_GET) + calibration.maxy = tmp.maxy; + if (field_by_value(&calibration_samples)->flags & FLG_GET) { + free(calibration_samples); + if (tmp.samplelen <= 0) { + calibration_samples = strdup(""); + if (calibration_samples == NULL) +err(EXIT_FAILURE, "could not list calibration" + " samples"); + } else { + samples = malloc(tmp.samplelen * sizeof(buf)); + if (samples == NULL) +err(EXIT_FAILURE, "could not list calibration" + " samples"); + samples[0] = '\0'; + for (i = 0; i < tmp.samplelen; i++) { +snprintf(buf, sizeof(buf), "%s%d,%d,%d,%d", + (i == 0) ? "" : ":", + tmp.samples[i].rawx, + tmp.samples[i].rawy, + tmp.samples[i].x, + tmp.samples[i].y); +strcat(samples, buf); + } + calibration_samples = samples; + } + } +} + +static void mouse_get_repeat(int fd) { struct wsmouse_repeat tmp; - if (ioctl(fd, WSMOUSEIO_GETREPEAT, &tmp) == -1) + if (ioctl(fd, WSMOUSEIO_GETREPEAT, &tmp) < 0) err(EXIT_FAILURE, "WSMOUSEIO_GETREPEAT"); if (field_by_value(&repeat.wr_buttons)->flags & FLG_GET) @@ -132,7 +205,7 @@ mouse_put_repeat(int fd) struct wsmouse_repeat tmp; /* Fetch current values into the temporary structure. */ - if (ioctl(fd, WSMOUSEIO_GETREPEAT, &tmp) == -1) + if (ioctl(fd, WSMOU
CVS commit: src/sbin/wsconsctl
Module Name:src Committed By: khorben Date: Mon Dec 24 01:29:20 UTC 2012 Modified Files: src/sbin/wsconsctl: mouse.c Log Message: Added complete support for touchscreen calibration (see PR kern/45872). Tested with the uts(4) driver, as well as with mice without calibration support. Reviewed by uwe@ (thank you!) To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sbin/wsconsctl/mouse.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/wsconsctl/mouse.c diff -u src/sbin/wsconsctl/mouse.c:1.9 src/sbin/wsconsctl/mouse.c:1.10 --- src/sbin/wsconsctl/mouse.c:1.9 Mon Dec 24 01:27:23 2012 +++ src/sbin/wsconsctl/mouse.c Mon Dec 24 01:29:20 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: mouse.c,v 1.9 2012/12/24 01:27:23 khorben Exp $ */ +/* $NetBSD: mouse.c,v 1.10 2012/12/24 01:29:20 khorben Exp $ */ /*- * Copyright (c) 1998, 2006, 2012 The NetBSD Foundation, Inc. @@ -50,6 +50,7 @@ static char *calibration_samples; static struct wsmouse_repeat repeat; static void mouse_get_calibration(int); +static void mouse_put_calibration(int); static void mouse_get_repeat(int); static void mouse_put_repeat(int); @@ -59,15 +60,15 @@ struct field mouse_field_tab[] = { { "samplerate", &samplerate, FMT_UINT, FLG_WRONLY }, { "type", &mstype, FMT_MSTYPE, FLG_RDONLY }, { "calibration.minx", &calibration.minx, - FMT_INT, FLG_RDONLY }, + FMT_INT, FLG_MODIFY }, { "calibration.miny", &calibration.miny, - FMT_INT, FLG_RDONLY }, + FMT_INT, FLG_MODIFY }, { "calibration.maxx", &calibration.maxx, - FMT_INT, FLG_RDONLY }, + FMT_INT, FLG_MODIFY }, { "calibration.maxy", &calibration.maxy, - FMT_INT, FLG_RDONLY }, + FMT_INT, FLG_MODIFY }, { "calibration.samples", &calibration_samples, - FMT_STRING, FLG_RDONLY }, + FMT_STRING, FLG_MODIFY }, { "repeat.buttons", &repeat.wr_buttons, FMT_BITFIELD, FLG_MODIFY }, { "repeat.delay.first", &repeat.wr_delay_first, @@ -192,6 +193,13 @@ mouse_put_values(int fd) pr_field(field_by_value(&samplerate), " -> "); } + if (field_by_value(&calibration.minx)->flags & FLG_SET || + field_by_value(&calibration.miny)->flags & FLG_SET || + field_by_value(&calibration.maxx)->flags & FLG_SET || + field_by_value(&calibration.maxy)->flags & FLG_SET || + field_by_value(&calibration_samples)->flags & FLG_SET) + mouse_put_calibration(fd); + if (field_by_value(&repeat.wr_buttons)->flags & FLG_SET || field_by_value(&repeat.wr_delay_first)->flags & FLG_SET || field_by_value(&repeat.wr_delay_decrement)->flags & FLG_SET || @@ -200,6 +208,70 @@ mouse_put_values(int fd) } static void +mouse_put_calibration(int fd) +{ + struct wsmouse_calibcoords tmp; + int i; + const char *p; + char *q; + + /* Fetch current values into the temporary structure. */ + if (ioctl(fd, WSMOUSEIO_GCALIBCOORDS, &tmp) < 0) + err(EXIT_FAILURE, "WSMOUSEIO_GCALIBCOORDS"); + + /* Overwrite the desired values in the temporary structure. */ + if (field_by_value(&calibration.minx)->flags & FLG_SET) + tmp.minx = calibration.minx; + if (field_by_value(&calibration.miny)->flags & FLG_SET) + tmp.miny = calibration.miny; + if (field_by_value(&calibration.maxx)->flags & FLG_SET) + tmp.maxx = calibration.maxx; + if (field_by_value(&calibration.maxy)->flags & FLG_SET) + tmp.maxy = calibration.maxy; + if (field_by_value(&calibration_samples)->flags & FLG_SET) { + p = calibration_samples; + for (i = 0; p[0] != '\0' && i < WSMOUSE_CALIBCOORDS_MAX; i++) { + tmp.samples[i].rawx = strtol(p, &q, 0); + if (*q != ',') +break; + p = q + 1; + tmp.samples[i].rawy = strtol(p, &q, 0); + if (*q != ',') +break; + p = q + 1; + tmp.samples[i].x = strtol(p, &q, 0); + if (*q != ',') +break; + p = q + 1; + tmp.samples[i].y = strtol(p, &q, 0); + p = q + 1; + if (*q != '\0' && *q != ':') +break; + } + if (p[0] != '\0') + errx(EXIT_FAILURE, "%s: invalid calibration data", + calibration_samples); + tmp.samplelen = i; + } + + /* Set new values for calibrating events. */ + if (ioctl(fd, WSMOUSEIO_SCALIBCOORDS, &tmp) < 0) + err(EXIT_FAILURE, "WSMOUSEIO_SCALIBCOORDS"); + + /* Now print what changed. */ + if (field_by_value(&calibration.minx)->flags & FLG_SET) + pr_field(field_by_value(&calibration.minx), " -> "); + if (field_by_value(&calibration.miny)->flags & FLG_SET) + pr_field(field_by_value(&calibration.miny), " -> "); + if (field_by_value(&calibration.maxx)->flags & FLG_SET) + pr_field(field_by_value(&calibration.maxx), " -> "); + if (field_by_value(&calibration.maxy)->flags & FLG_SET) + pr_field(field_by_value(&calibration.maxy), " -> "); + if (field_by_value(&calibration_samples)->flags & FLG_SET) + pr_field(field_by_value(&calibration_samples), " -> "); +} + +static void mouse_put_repeat(int fd) { struct wsmouse_
CVS commit: src/sbin/wsconsctl
Module Name:src Committed By: joerg Date: Sat Aug 27 19:01:34 UTC 2011 Modified Files: src/sbin/wsconsctl: map_parse.y wsconsctl.h Log Message: Mark yyerror as static and dead. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sbin/wsconsctl/map_parse.y cvs rdiff -u -r1.10 -r1.11 src/sbin/wsconsctl/wsconsctl.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/wsconsctl/map_parse.y diff -u src/sbin/wsconsctl/map_parse.y:1.9 src/sbin/wsconsctl/map_parse.y:1.10 --- src/sbin/wsconsctl/map_parse.y:1.9 Tue Nov 30 12:22:06 2010 +++ src/sbin/wsconsctl/map_parse.y Sat Aug 27 19:01:34 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: map_parse.y,v 1.9 2010/11/30 12:22:06 phx Exp $ */ +/* $NetBSD: map_parse.y,v 1.10 2011/08/27 19:01:34 joerg Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -198,7 +198,7 @@ }; %% -void +__dead static void yyerror(const char *msg) { Index: src/sbin/wsconsctl/wsconsctl.h diff -u src/sbin/wsconsctl/wsconsctl.h:1.10 src/sbin/wsconsctl/wsconsctl.h:1.11 --- src/sbin/wsconsctl/wsconsctl.h:1.10 Mon Apr 28 20:23:09 2008 +++ src/sbin/wsconsctl/wsconsctl.h Sat Aug 27 19:01:34 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: wsconsctl.h,v 1.10 2008/04/28 20:23:09 martin Exp $ */ +/* $NetBSD: wsconsctl.h,v 1.11 2011/08/27 19:01:34 joerg Exp $ */ /*- * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc. @@ -91,6 +91,5 @@ #ifndef YYEMPTY int yyparse(void); #endif -void yyerror(const char *); int yylex(void); void map_scan_setinput(char *);
CVS commit: src/sbin/wsconsctl
Module Name:src Committed By: wiz Date: Tue Feb 14 11:05:32 UTC 2012 Modified Files: src/sbin/wsconsctl: wsconsctl.8 Log Message: Fix typo. To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/sbin/wsconsctl/wsconsctl.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/wsconsctl/wsconsctl.8 diff -u src/sbin/wsconsctl/wsconsctl.8:1.27 src/sbin/wsconsctl/wsconsctl.8:1.28 --- src/sbin/wsconsctl/wsconsctl.8:1.27 Tue Jun 9 19:46:32 2009 +++ src/sbin/wsconsctl/wsconsctl.8 Tue Feb 14 11:05:32 2012 @@ -1,4 +1,4 @@ -.\" $NetBSD: wsconsctl.8,v 1.27 2009/06/09 19:46:32 snj Exp $ +.\" $NetBSD: wsconsctl.8,v 1.28 2012/02/14 11:05:32 wiz Exp $ .\" .\" Copyright (c) 1998, 2004 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -118,7 +118,7 @@ emulation and graphics (mapped) modes. In addition to British, US, and US-Dvorak keyboard encodings, support currently exists for the following languages: Belgian, Danish, Finnish, French, German, Greek, Hungarian, Italian, Japanese, Norwegian, Polish, -Portugese, Russian, Spanish, Swedish, Swiss, and Ukrainian. +Portuguese, Russian, Spanish, Swedish, Swiss, and Ukrainian. Additionally, a user-defined encoding is supported. .Sh FILES .Bl -tag -width /dev/wsmouse
CVS commit: src/sbin/wsconsctl
Module Name:src Committed By: joerg Date: Tue May 24 12:07:14 UTC 2011 Modified Files: src/sbin/wsconsctl: map_scan.l Log Message: input is unused To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sbin/wsconsctl/map_scan.l Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/wsconsctl/map_scan.l diff -u src/sbin/wsconsctl/map_scan.l:1.6 src/sbin/wsconsctl/map_scan.l:1.7 --- src/sbin/wsconsctl/map_scan.l:1.6 Tue Nov 30 12:22:06 2010 +++ src/sbin/wsconsctl/map_scan.l Tue May 24 12:07:14 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: map_scan.l,v 1.6 2010/11/30 12:22:06 phx Exp $ */ +/* $NetBSD: map_scan.l,v 1.7 2011/05/24 12:07:14 joerg Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -51,6 +51,7 @@ %} %option noyywrap +%option noinput %%
CVS commit: src/sbin/wsconsctl
Module Name:src Committed By: christos Date: Tue Oct 23 01:59:18 UTC 2012 Modified Files: src/sbin/wsconsctl: map_parse.y Log Message: - remove obsolete = { syntac - print context for yyerror() - add a production to clarify a syntax error To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sbin/wsconsctl/map_parse.y Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/wsconsctl/map_parse.y diff -u src/sbin/wsconsctl/map_parse.y:1.10 src/sbin/wsconsctl/map_parse.y:1.11 --- src/sbin/wsconsctl/map_parse.y:1.10 Sat Aug 27 15:01:34 2011 +++ src/sbin/wsconsctl/map_parse.y Mon Oct 22 21:59:18 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: map_parse.y,v 1.10 2011/08/27 19:01:34 joerg Exp $ */ +/* $NetBSD: map_parse.y,v 1.11 2012/10/23 01:59:18 christos Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -97,7 +97,7 @@ ksym_lookup(keysym_t ksym) %% -program : = { +program : { int i; struct wscons_keymap *mp; @@ -123,7 +123,7 @@ expr : keysym_expr | keycode_expr ; -keysym_expr : T_KEYSYM keysym_var "=" keysym_var = { +keysym_expr : T_KEYSYM keysym_var "=" keysym_var { size_t src, dst; dst = ksym_lookup($2); @@ -134,7 +134,7 @@ keysym_expr : T_KEYSYM keysym_var "=" ke } ; -keycode_expr : T_KEYCODE T_NUMBER "=" = { +keycode_expr : T_KEYCODE T_NUMBER "=" { if ($2 >= KS_NUMKEYCODES) errx(EXIT_FAILURE, "%d: keycode too large", $2); if ((unsigned int)$2 >= newkbmap.maplen) @@ -144,35 +144,38 @@ keycode_expr : T_KEYCODE T_NUMBER "=" = ; keysym_cmd : /* empty */ - | T_KEYSYM_CMD_VAR = { + | T_KEYSYM_CMD_VAR { cur_mp->command = $1; } - | T_CMD T_KEYSYM_CMD_VAR = { + | T_CMD T_KEYSYM_CMD_VAR { cur_mp->command = KS_Cmd; cur_mp->group1[0] = $2; + } + | T_CMD T_KEYSYM_VAR { + yyerror("Not a command keysym"); } ; keysym_list : /* empty */ - | keysym_var = { + | keysym_var { cur_mp->group1[0] = $1; cur_mp->group1[1] = ksym_upcase(cur_mp->group1[0]); cur_mp->group2[0] = cur_mp->group1[0]; cur_mp->group2[1] = cur_mp->group1[1]; } - | keysym_var keysym_var = { + | keysym_var keysym_var { cur_mp->group1[0] = $1; cur_mp->group1[1] = $2; cur_mp->group2[0] = cur_mp->group1[0]; cur_mp->group2[1] = cur_mp->group1[1]; } - | keysym_var keysym_var keysym_var = { + | keysym_var keysym_var keysym_var { cur_mp->group1[0] = $1; cur_mp->group1[1] = $2; cur_mp->group2[0] = $3; cur_mp->group2[1] = ksym_upcase(cur_mp->group2[0]); } - | keysym_var keysym_var keysym_var keysym_var = { + | keysym_var keysym_var keysym_var keysym_var { cur_mp->group1[0] = $1; cur_mp->group1[1] = $2; cur_mp->group2[0] = $3; @@ -180,10 +183,10 @@ keysym_list : /* empty */ } ; -keysym_var : T_KEYSYM_VAR = { +keysym_var : T_KEYSYM_VAR { $$ = $1; } - | T_NUMBER = { + | T_NUMBER { char name[2]; int res; @@ -201,6 +204,8 @@ keysym_var : T_KEYSYM_VAR = { __dead static void yyerror(const char *msg) { + extern char *yytext; + extern int yyleng; - errx(EXIT_FAILURE, "parse: %s", msg); + errx(EXIT_FAILURE, "parse: %s [%.*s]", msg, yyleng, yytext); }
CVS commit: src/sbin/wsconsctl
Module Name:src Committed By: christos Date: Tue Oct 23 15:30:45 UTC 2012 Modified Files: src/sbin/wsconsctl: map_parse.y Log Message: allow non-command keysyms to be mapped as commands (experimental) To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sbin/wsconsctl/map_parse.y Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/wsconsctl/map_parse.y diff -u src/sbin/wsconsctl/map_parse.y:1.11 src/sbin/wsconsctl/map_parse.y:1.12 --- src/sbin/wsconsctl/map_parse.y:1.11 Mon Oct 22 21:59:18 2012 +++ src/sbin/wsconsctl/map_parse.y Tue Oct 23 11:30:45 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: map_parse.y,v 1.11 2012/10/23 01:59:18 christos Exp $ */ +/* $NetBSD: map_parse.y,v 1.12 2012/10/23 15:30:45 christos Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -152,7 +152,8 @@ keysym_cmd : /* empty */ cur_mp->group1[0] = $2; } | T_CMD T_KEYSYM_VAR { - yyerror("Not a command keysym"); + cur_mp->command = KS_Cmd; + cur_mp->group1[0] = $2; } ;
CVS commit: src/sbin/wsconsctl
Module Name:src Committed By: nia Date: Sun Jul 12 03:37:07 UTC 2020 Modified Files: src/sbin/wsconsctl: wsconsctl.8 Log Message: More keyboard layouts To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/sbin/wsconsctl/wsconsctl.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/wsconsctl/wsconsctl.8 diff -u src/sbin/wsconsctl/wsconsctl.8:1.28 src/sbin/wsconsctl/wsconsctl.8:1.29 --- src/sbin/wsconsctl/wsconsctl.8:1.28 Tue Feb 14 11:05:32 2012 +++ src/sbin/wsconsctl/wsconsctl.8 Sun Jul 12 03:37:06 2020 @@ -1,4 +1,4 @@ -.\" $NetBSD: wsconsctl.8,v 1.28 2012/02/14 11:05:32 wiz Exp $ +.\" $NetBSD: wsconsctl.8,v 1.29 2020/07/12 03:37:06 nia Exp $ .\" .\" Copyright (c) 1998, 2004 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -27,7 +27,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\"/ -.Dd June 9, 2009 +.Dd July 12, 2020 .Dt WSCONSCTL 8 .Os .Sh NAME @@ -115,10 +115,11 @@ There are also definitions relating to v control, which are not applicable to all display types, and to text emulation and graphics (mapped) modes. .Pp -In addition to British, US, and US-Dvorak keyboard encodings, support -currently exists for the following languages: Belgian, Danish, Finnish, -French, German, Greek, Hungarian, Italian, Japanese, Norwegian, Polish, -Portuguese, Russian, Spanish, Swedish, Swiss, and Ukrainian. +In addition to British, US, and US-Dvorak keyboard encodings, +support currently exists for the following languages: Belgian, +Brazilian, Danish, Finnish, French, German, Greek, Hungarian, +Italian, Japanese, Norwegian, Polish, Portuguese, Russian, Spanish, +Swedish, Swiss, Turkish, and Ukrainian. Additionally, a user-defined encoding is supported. .Sh FILES .Bl -tag -width /dev/wsmouse
CVS commit: src/sbin/wsconsctl
Module Name:src Committed By: mlelstv Date: Fri Nov 23 06:31:57 UTC 2018 Modified Files: src/sbin/wsconsctl: keyboard.c util.c wsconsctl.c wsconsctl.h Log Message: When merging entries with the keyboard map, print only the resulting changes. While here, replace bcopy with standad memcpy. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sbin/wsconsctl/keyboard.c cvs rdiff -u -r1.31 -r1.32 src/sbin/wsconsctl/util.c cvs rdiff -u -r1.18 -r1.19 src/sbin/wsconsctl/wsconsctl.c cvs rdiff -u -r1.12 -r1.13 src/sbin/wsconsctl/wsconsctl.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/wsconsctl/keyboard.c diff -u src/sbin/wsconsctl/keyboard.c:1.9 src/sbin/wsconsctl/keyboard.c:1.10 --- src/sbin/wsconsctl/keyboard.c:1.9 Mon Apr 28 20:23:09 2008 +++ src/sbin/wsconsctl/keyboard.c Fri Nov 23 06:31:57 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: keyboard.c,v 1.9 2008/04/28 20:23:09 martin Exp $ */ +/* $NetBSD: keyboard.c,v 1.10 2018/11/23 06:31:57 mlelstv Exp $ */ /*- * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc. @@ -38,6 +38,7 @@ #include #include #include +#include #include "wsconsctl.h" @@ -48,6 +49,9 @@ static struct wskbd_bell_data dfbell; static struct wscons_keymap mapdata[KS_NUMKEYCODES]; struct wskbd_map_data kbmap = /* used in map_parse.y and in util.c */ { KS_NUMKEYCODES, mapdata }; +static struct wscons_keymap oldmapdata[KS_NUMKEYCODES]; +static struct wskbd_map_data oldkbmap = +{ KS_NUMKEYCODES, oldmapdata }; static struct wskbd_keyrepeat_data repeat; static struct wskbd_keyrepeat_data dfrepeat; static struct wskbd_scroll_data scroll; @@ -79,6 +83,29 @@ struct field keyboard_field_tab[] = { int keyboard_field_tab_len = sizeof(keyboard_field_tab) / sizeof(keyboard_field_tab[0]); +static void +diff_kmap(struct wskbd_map_data *omap, struct wskbd_map_data *nmap) +{ + unsigned int u; + struct wscons_keymap *op, *np; + + for (u = 0; u < nmap->maplen; u++) { + op = omap->map + u; + np = nmap->map + u; + if (op->command == np->command && + op->group1[0] == np->group1[0] && + op->group1[1] == np->group1[1] && + op->group2[0] == np->group2[0] && + op->group2[1] == np->group2[1]) { + np->command = KS_voidSymbol; + np->group1[0] = KS_voidSymbol; + np->group1[1] = KS_voidSymbol; + np->group2[0] = KS_voidSymbol; + np->group2[1] = KS_voidSymbol; + } + } +} + void keyboard_get_values(int fd) { @@ -112,6 +139,7 @@ keyboard_get_values(int fd) kbmap.maplen = KS_NUMKEYCODES; if (ioctl(fd, WSKBDIO_GETMAP, &kbmap) < 0) err(EXIT_FAILURE, "WSKBDIO_GETMAP"); + memcpy(oldmapdata, mapdata, sizeof(oldmapdata)); } repeat.which = 0; @@ -200,7 +228,11 @@ keyboard_put_values(int fd) if (field_by_value(&kbmap)->flags & FLG_SET) { if (ioctl(fd, WSKBDIO_SETMAP, &kbmap) < 0) err(EXIT_FAILURE, "WSKBDIO_SETMAP"); - pr_field(field_by_value(&kbmap), " -> "); + if (field_by_value(&kbmap)->flags & FLG_MODIFIED) { + diff_kmap(&oldkbmap, &kbmap); + pr_field(field_by_value(&kbmap), " +> "); + } else + pr_field(field_by_value(&kbmap), " -> "); } repeat.which = 0; Index: src/sbin/wsconsctl/util.c diff -u src/sbin/wsconsctl/util.c:1.31 src/sbin/wsconsctl/util.c:1.32 --- src/sbin/wsconsctl/util.c:1.31 Mon Dec 24 01:20:12 2012 +++ src/sbin/wsconsctl/util.c Fri Nov 23 06:31:57 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: util.c,v 1.31 2012/12/24 01:20:12 khorben Exp $ */ +/* $NetBSD: util.c,v 1.32 2018/11/23 06:31:57 mlelstv Exp $ */ /*- * Copyright (c) 1998, 2006, 2012 The NetBSD Foundation, Inc. @@ -420,7 +420,7 @@ rd_field(struct field *f, char *val, int } } kbmap.maplen = newkbmap.maplen; - bcopy(newkbmap.map, kbmap.map, + memcpy(kbmap.map, newkbmap.map, kbmap.maplen * sizeof(struct wscons_keymap)); break; case FMT_COLOR: Index: src/sbin/wsconsctl/wsconsctl.c diff -u src/sbin/wsconsctl/wsconsctl.c:1.18 src/sbin/wsconsctl/wsconsctl.c:1.19 --- src/sbin/wsconsctl/wsconsctl.c:1.18 Mon Aug 25 00:14:46 2008 +++ src/sbin/wsconsctl/wsconsctl.c Fri Nov 23 06:31:57 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: wsconsctl.c,v 1.18 2008/08/25 00:14:46 dholland Exp $ */ +/* $NetBSD: wsconsctl.c,v 1.19 2018/11/23 06:31:57 mlelstv Exp $ */ /*- * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc. @@ -207,8 +207,10 @@ main(int argc, char **argv) } rd_field(f, p, do_merge); f->flags |= FLG_SET; +if (do_merge) + f->flags |= FLG_MODIFIED; (*putval)(fd); -f->flags &= ~FLG_SET; +f->flags &= ~(FLG_SET | FLG_MODIFIED); } } else { for (i = 0; i < argc; i++) { Index: src/sbin/wsconsctl/wsconsctl.h diff -u src/sbin/wsconsctl/wsconsctl.h:1.12 src/sbin/wsconsctl/wsconsctl.h:1.13 --- src/sbin/wsconsctl/wsconsctl.h:1.12 Mon Dec 24 01:20:44 2012 +++ src/sbin/wsconsctl/wsconsctl.h Fri Nov 23 06:31:57 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: wsconsctl.h,v 1.12 2012/12/24 01:20:44 khorb