Subject: misc/26720: Proposed enhancements to wscons keymaps user interface
To: None <gnats-bugs@gnats.netbsd.org>
From: Matthew Mondor <mmondor@gmail.com>
List: netbsd-bugs
Date: 08/19/2004 14:43:56
>Number: 26720
>Category: misc
>Synopsis: Proposed enhancements to wscons keymaps user interface
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: misc-bug-people
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Thu Aug 19 18:45:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator: Matthew Mondor
>Release: NetBSD 1.6 and 2.0 branch, -current
>Organization:
>Environment:
>Description:
This adds support for wscons text keymap files to be able to specify the
required system encoding to use by default on which it is applying
modifications, that is, not requireing to output codes for all mappings. This
may be useful with time as wscons might expand the code set, to prevent
text keymaps from having to require modifications... For instance, a keymap
file may use:
encoding=us
to specify to apply us encoding and then apply the changes using the codes in
the file.
It also adds the new wsmapload(8) command to allow users easy switching among
keymap files. This is useful without needing /etc/wscons.conf modifications
and launching /etc/rc.d/wscons again (which obviously then errors since wscons
screens are already setup). This is very useful for people like me who both
needs to frequently use a us and french-canadian encodings and switch among
them. Perhaps that if wscons supported a keymap setting per screen this would
not be necessary however, but it is not the case.
Also included are manual pages for wsmap(5) which appeared to be missing,
as well the one for the new wsmapload(8) script.
>How-To-Repeat:
>Fix:
The following diff is suggested (relative to src root directory):
--- etc/rc.d/wscons Fri Apr 26 06:39:03 2002
+++ etc/rc.d/wscons Sun Apr 4 00:37:24 2004
@@ -142,7 +142,11 @@
\#*|"")
continue
;;
- *)
+ *encoding=*)
+ cmd="$wsctl -w $entry >/dev/null"
+ eval $DOIT $cmd
+ ;;
+ *keycode*)
cmd="$wsctl -w \"map+=$entry\""
cmd="$cmd >/dev/null"
eval $DOIT $cmd
--- usr.sbin/Makefile Sat Dec 28 03:25:51 2002
+++ usr.sbin/Makefile Sun Apr 4 00:55:42 2004
@@ -18,7 +18,7 @@
sliplogin slstats spray sunlabel sup sushi syslogd tadpolectl tcpdchk \
tcpdmatch tcpdump timed traceroute trpt trsp unlink \
usbdevs user videomode vipw vnconfig wiconfig wsconscfg \
- wsfontload wsmuxctl zdump zic
+ wsfontload wsmapload wsmuxctl zdump zic
.if (${MKKERBEROS} != "no")
SUBDIR+= hprop kadmin kdc kstash ktutil
--- usr.sbin/wsmapload/Makefile Wed Dec 31 19:00:00 1969
+++ usr.sbin/wsmapload/Makefile Sun Apr 4 00:59:43 2004
@@ -0,0 +1,9 @@
+ # $NetBSD$
+
+ FILES= wsmapload
+ MAN= wsmapload.8
+
+ FILESDIR= /usr/sbin
+ FILESMODE= ${BINMODE}
+
+ .include <bsd.prog.mk>
--- usr.sbin/wsmapload/wsmapload Wed Dec 31 19:00:00 1969
+++ usr.sbin/wsmapload/wsmapload Sun Apr 4 00:59:57 2004
@@ -0,0 +1,73 @@
+ #!/bin/sh
+
+ # $NetBSD$
+ #
+ # Copyright (c) 2004 The NetBSD Foundation, Inc.
+ # All rights reserved.
+ #
+ # This code is derived from software contributed to The NetBSD Foundation
+ # by Matthew Mondor.
+ #
+ # Redistribution and use in source and binary forms, with or without
+ # modification, are permitted provided that the following conditions
+ # are met:
+ # 1. Redistributions of source code must retain the above copyright
+ # notice, this list of conditions and the following disclaimer.
+ # 2. Redistributions in binary form must reproduce the above copyright
+ # notice, this list of conditions and the following disclaimer in the
+ # documentation and/or other materials provided with the distribution.
+ # 3. All advertising materials mentioning features or use of this software
+ # This product includes software developed by the NetBSD
+ # Foundation, Inc. and its contributors.
+ # 4. Neither the name of The NetBSD Foundation nor the names of its
+ # contributors may be used to endorse or promote products derived
+ # from this software without specific prior written permission.
+ #
+ # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ # POSSIBILITY OF SUCH DAMAGE.
+
+ # Loads the specified wscons keymap file. It first applies the encoding on
+ # which the file's modifications mappings are based if a comment is found
+ # indicating the encoding to set. It then simply applies each mapping of
+ # the file. The format of the comment it should find to define the default
+ # encoding is simple, as follows:
+ # encoding=us
+
+ if [ -z $1 ]; then
+ echo 'usage: wsmapload <keymapfile>' >&2
+ exit 1
+ else
+ MAPFILE="$1"
+ DOIT=
+ WSCTL='/sbin/wsconsctl'
+ fi
+
+ ( while read entry; do
+ case "$entry" in
+ \#*|"")
+ continue
+ ;;
+ *encoding=*)
+ cmd="$WSCTL -w $entry >/dev/null"
+ eval $DOIT $cmd
+ ;;
+ *keycode*)
+ cmd="$WSCTL -w \"map+=$entry\" >/dev/null"
+ eval $DOIT $cmd
+ ;;
+ *)
+ echo "Invalid line \"$entry\" in $MAPFILE" >&2
+ exit 1
+ ;;
+ esac
+ done ) < $MAPFILE
--- usr.sbin/wsmapload/wsmapload.8 Wed Dec 31 19:00:00 1969
+++ usr.sbin/wsmapload/wsmapload.8 Sun Apr 4 00:59:57 2004
@@ -0,0 +1,79 @@
+ .\" $NetBSD$
+ .\"
+ .\" Copyright (c) 2004 The NetBSD Foundation, Inc.
+ .\" All rights reserved.
+ .\"
+ .\" This code is derived from software contributed to The NetBSD Foundation
+ .\" by Matthew Mondor.
+ .\"
+ .\" Redistribution and use in source and binary forms, with or without
+ .\" modification, are permitted provided that the following conditions
+ .\" are met:
+ .\" 1. Redistributions of source code must retain the above copyright
+ .\" notice, this list of conditions and the following disclaimer.
+ .\" 2. Redistributions in binary form must reproduce the above copyright
+ .\" notice, this list of conditions and the following disclaimer in the
+ .\" documentation and/or other materials provided with the distribution.
+ .\" 3. All advertising materials mentioning features or use of this software
+ .\" must display the following acknowledgement:
+ .\" This product includes software developed by the NetBSD
+ .\" Foundation, Inc. and its contributors.
+ .\" 4. Neither the name of The NetBSD Foundation nor the names of its
+ .\" contributors may be used to endorse or promote products derived
+ .\" from this software without specific prior written permission.
+ .\"
+ .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ .\" POSSIBILITY OF SUCH DAMAGE.
+ .\"/
+ .Dd April 2, 2004
+ .Dt WSMAPLOAD 8
+ .Os
+ .Sh NAME
+ .Nm wsmapload
+ .Nd load a wscons keymap file
+ .Sh SYNOPSIS
+ .Nm
+ .Ar file
+ .Sh DESCRIPTION
+ The
+ .Nm
+ command is useful to apply a new wscons keymap on a live system at runtime.
+ Although the default mapping can be set via
+ .Xr wscons.conf 5 ,
+ to be applied at boot time, this command is most useful when the mappings
+ frequently need to be changed. The file to be applied is assumed to be in
+ .Xr wsmap 5
+ format.
+ .Pp
+ The
+ .Xr wsconsctl 8
+ command is internally called by this script to modify the encoding and/or
+ individual key mappings. Only the superuser may modify keyboard mappings.
+ .Sh FILES
+ .Bl -tag -width xxxxxxxxxxxxxxxxxxxxxxxxx
+ .It Pa /usr/share/wscons/keymaps
+ The default location for wscons keymap files in
+ .Xr wsmap 5
+ format.
+ .El
+ .Sh SEE ALSO
+ .Xr wsmap 5 ,
+ .Xr wscons.conf 5 ,
+ .Xr wscons 4 ,
+ .Xr wsconscfg 8 ,
+ .Xr wsfontload 8 ,
+ .Xr wsconsctl 8
+ .Sh HISTORY
+ The
+ .Nm
+ command first appeared in
+ .Nx 1.6.3 .
--- share/man/man5/wsmap.5 Wed Dec 31 19:00:00 1969
+++ share/man/man5/wsmap.5 Sun Apr 4 01:06:57 2004
@@ -0,0 +1,129 @@
+ .\" $NetBSD$
+ .\"
+ .\" Copyright (c) 2004 The NetBSD Foundation, Inc.
+ .\" All rights reserved.
+ .\"
+ .\" This code is derived from software contributed to The NetBSD Foundation
+ .\" by Matthew Mondor.
+ .\"
+ .\" Redistribution and use in source and binary forms, with or without
+ .\" modification, are permitted provided that the following conditions
+ .\" are met:
+ .\" 1. Redistributions of source code must retain the above copyright
+ .\" notice, this list of conditions and the following disclaimer.
+ .\" 2. Redistributions in binary form must reproduce the above copyright
+ .\" notice, this list of conditions and the following disclaimer in the
+ .\" documentation and/or other materials provided with the distribution.
+ .\" 3. All advertising materials mentioning features or use of this software
+ .\" must display the following acknowledgement:
+ .\" This product includes software developed by the NetBSD
+ .\" Foundation, Inc. and its contributors.
+ .\" 4. Neither the name of The NetBSD Foundation nor the names of its
+ .\" contributors may be used to endorse or promote products derived
+ .\" from this software without specific prior written permission.
+ .\"
+ .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ .\" POSSIBILITY OF SUCH DAMAGE.
+ .\"/
+ .Dd April 2, 2004
+ .Dt WSMAP 5
+ .Os
+ .Sh NAME
+ .Nm wsmap
+ .Nd wscons keymap file description format
+ .Sh DESCRIPTION
+ The
+ .Nm
+ file format is rather simple and is used to provide keyboard mappings which
+ are not provided by the kernel by default. Most new and custom keymaps should
+ be implemented in the form of such keymap files. Wanted system defaults can
+ be configured through the
+ .Xr wscons.conf
+ configuration file. The
+ .Xr wsmapload 8
+ command may be used to load and apply wanted mappings at runtime.
+ .Pp
+ When building keymap files, there are two ways one may proceed. It may
+ applying the necessary modifications. It is recommended to only use this
+ feature when using very common encodings (I.E. the ones already compiled into
+ GENERIC kernels). Alternatively, it may set new mappings for all keys so that
+ it may be independent from any kernel-specific support.
+ .Pp
+ In any case, new mappings are generally first tested and built by issueing
+ .Xr wsconsctl 8
+ commands as follows:
+ .Bd -literal -offset indent
+ wsconsctl -w map+="<mapping>"
+ .Ed
+ .Pp
+ Afterwards, it is often most useful to obtain the full current mappings
+ in a format which is already suitable for
+ .Xr wsmap 5 :
+ .Bd -literal -offset indent
+ wsconsctl map
+ .Ed
+ .Pp
+ It is recommended to read the
+ .Xr wsconsctl 8
+ manual page for more information. The lines generated by the above command
+ can be placed as-is in the keymap file. In addition, comments starting
+ with the '#' character on the first column are allowed, and ignored.
+ .Pp
+ In the case where the keymap file only consists of modifications to apply
+ to an existing kernel supported encoding, a line in the following format
+ should be found before any other mapping commands in the file:
+ .Bd -literal -offset indent
+ encoding=<encoding>
+ .Ed
+ .Sh FILES
+ .Bl -tag -width xxxxxxxxxxxxxxxxxxxxxxxxx
+ .It Pa /usr/share/wscons/keymaps
+ The default location for wscons keymap files in
+ .Xr wsmap 5
+ format.
+ .El
+ .Sh EXAMPLES
+ Here is an example keymap file, basing itself on the default kernel supported
+ .Nm us
+ encoding,
+ .Nm /usr/share/wscons/keymaps/pckbd.ca_fr.iso8859-1 :
+ .Bd -literal -offset indent
+ encoding=us
+ keycode 3 = 2 quotedbl at
+ keycode 4 = 3 slash numbersign
+ keycode 7 = 6 question asciicircum
+ keycode 26 = dead_circumflex asciicircum bracketleft braceleft
+ keycode 27 = dead_cedilla dead_diaeresis bracketright braceright
+ keycode 39 = semicolon colon asciitilde
+ keycode 40 = dead_grave grave apostrophe quotedbl
+ keycode 41 = numbersign bar grave backslash
+ keycode 43 = less greater backslash bar
+ keycode 47 = v V guillemotleft
+ keycode 48 = b B guillemotright
+ keycode 51 = comma apostrophe less
+ keycode 52 = period sterling greater
+ keycode 53 = eacute Eacute slash question
+ keycode 184 = Mode_switch Multi_key
+ .Ed
+ .Pp
+ This modifies the keymap for the common French+English bilingual keyboards
+ which are often found in Canada, notably in Quebec. The default US encodings
+ are preserved when the alt key is pressed so that it may still be used for
+ programming (none of the important braces and characters are lost).
+ .Sh SEE ALSO
+ .Xr wsmapload 8 ,
+ .Xr wscons.conf 5 ,
+ .Xr wscons 4 ,
+ .Xr wsconscfg 8 ,
+ .Xr wsfontload 8 ,
+ .Xr wsconsctl 8
>Release-Note:
>Audit-Trail:
>Unformatted:
To: gnats-bugs@gnats.netbsd.org
Subject:
From: <Matthew Mondor> mmondor@gmail.com
Reply-To: mmondor@gmail.com
X-send-pr-version: 3.95