Module Name: src Committed By: mlelstv Date: Sun Sep 13 07:35:15 UTC 2020
Modified Files: src/sbin/wsconsctl: keyboard.c src/share/man/man4: wskbd.4 Log Message: Document keyboard mode ioctls and let wsconsctl manage it. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sbin/wsconsctl/keyboard.c cvs rdiff -u -r1.22 -r1.23 src/share/man/man4/wskbd.4 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.10 src/sbin/wsconsctl/keyboard.c:1.11 --- src/sbin/wsconsctl/keyboard.c:1.10 Fri Nov 23 06:31:57 2018 +++ src/sbin/wsconsctl/keyboard.c Sun Sep 13 07:35:15 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: keyboard.c,v 1.10 2018/11/23 06:31:57 mlelstv Exp $ */ +/* $NetBSD: keyboard.c,v 1.11 2020/09/13 07:35:15 mlelstv Exp $ */ /*- * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc. @@ -58,9 +58,11 @@ static struct wskbd_scroll_data scroll; static int ledstate; static kbd_t kbdencoding; static int havescroll = 1; +static int kbmode; struct field keyboard_field_tab[] = { { "type", &kbtype, FMT_KBDTYPE, FLG_RDONLY }, + { "mode", &kbmode, FMT_UINT, FLG_MODIFY }, { "bell.pitch", &bell.pitch, FMT_UINT, FLG_MODIFY }, { "bell.period", &bell.period, FMT_UINT, FLG_MODIFY }, { "bell.volume", &bell.volume, FMT_UINT, FLG_MODIFY }, @@ -114,6 +116,11 @@ keyboard_get_values(int fd) if (ioctl(fd, WSKBDIO_GTYPE, &kbtype) < 0) err(EXIT_FAILURE, "WSKBDIO_GTYPE"); + if (field_by_value(&kbmode)->flags & FLG_GET) { + ioctl(fd, WSKBDIO_GETMODE, &kbmode); + /* Optional; don't complain. */ + } + bell.which = 0; if (field_by_value(&bell.pitch)->flags & FLG_GET) bell.which |= WSKBD_BELL_DOPITCH; @@ -192,6 +199,12 @@ void keyboard_put_values(int fd) { + if (field_by_value(&kbmode)->flags & FLG_SET) { + if (ioctl(fd, WSKBDIO_SETMODE, &kbmode) == 0) + err(EXIT_FAILURE, "WSKBDIO_SETMODE"); + pr_field(field_by_value(&kbmode), " -> "); + } + bell.which = 0; if (field_by_value(&bell.pitch)->flags & FLG_SET) bell.which |= WSKBD_BELL_DOPITCH; Index: src/share/man/man4/wskbd.4 diff -u src/share/man/man4/wskbd.4:1.22 src/share/man/man4/wskbd.4:1.23 --- src/share/man/man4/wskbd.4:1.22 Mon Jul 13 14:11:16 2020 +++ src/share/man/man4/wskbd.4 Sun Sep 13 07:35:15 2020 @@ -1,4 +1,4 @@ -.\" $NetBSD: wskbd.4,v 1.22 2020/07/13 14:11:16 uwe Exp $ +.\" $NetBSD: wskbd.4,v 1.23 2020/09/13 07:35:15 mlelstv Exp $ .\" .\" Copyright (c) 1999 .\" Matthias Drochner. All rights reserved. @@ -229,6 +229,10 @@ Their definitions are found in .Bl -tag -width Dv .It Dv WSKBDIO_GTYPE Get the keyboard type. +.It Dv WSKBDIO_GETMODE +Get the keyboard mode, 0 means translated through keyboard map, 1 means raw. +.It Dv WSKBDIO_SETMODE +Set the keyboard mode. .It Dv WSKBDIO_COMPLEXBELL , WSKBDIO_SETBELL , WSKBDIO_GETBELL , WSKBDIO_SETDEFAULTBELL , WSKBDIO_GETDEFAULTBELL Pq Vt "struct wsmouse_repeat" Get and set keyboard bell settings. .It Dv WSKBDIO_SETKEYREPEAT , WSKBDIO_GETKEYREPEAT , WSKBDIO_SETDEFAULTKEYREPEAT , WSKBDIO_GETDEFAULTKEYREPEAT Pq Vt "struct wskbd_keyrepeat_data"