Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src Document keyboard mode ioctls and let wsconsctl manage it.



details:   https://anonhg.NetBSD.org/src/rev/aa27343ab805
branches:  trunk
changeset: 954900:aa27343ab805
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Sun Sep 13 07:35:15 2020 +0000

description:
Document keyboard mode ioctls and let wsconsctl manage it.

diffstat:

 sbin/wsconsctl/keyboard.c |  15 ++++++++++++++-
 share/man/man4/wskbd.4    |   6 +++++-
 2 files changed, 19 insertions(+), 2 deletions(-)

diffs (66 lines):

diff -r 2f866f82906b -r aa27343ab805 sbin/wsconsctl/keyboard.c
--- a/sbin/wsconsctl/keyboard.c Sun Sep 13 07:32:32 2020 +0000
+++ b/sbin/wsconsctl/keyboard.c Sun Sep 13 07:35:15 2020 +0000
@@ -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 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 @@
                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 @@
 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;
diff -r 2f866f82906b -r aa27343ab805 share/man/man4/wskbd.4
--- a/share/man/man4/wskbd.4    Sun Sep 13 07:32:32 2020 +0000
+++ b/share/man/man4/wskbd.4    Sun Sep 13 07:35:15 2020 +0000
@@ -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 @@
 .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"



Home | Main Index | Thread Index | Old Index