Subject: wscons.conf's setvar functionality [patch]
To: None <tech-userlevel@netbsd.org>
From: Mike M. Volokhov <mishka@netbsd.org>
List: tech-userlevel
Date: 03/29/2007 15:00:33
--8P1HSweYDcXXzwPJ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Hello!

The rc.d/wscons startup script is used to configure wscons at boot
time. The wscons.conf contains a set of keywords and parameters,
parsed by rc.d/wscons. One of them is 'setvar'. Unfortunately,
it's limited enough to be not used at practice. The offered patch
extends 'setvar's functionality, so it becomes a good method for
manual wscons manipulations.

Any objections to commit (patch is against 3.1, but I'll adopt it
for current)?

--
Mishka.


--8P1HSweYDcXXzwPJ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="wscons-rcd.patch"

--- wscons.conf	2004-07-06 07:02:05.000000000 +0300
+++ wscons.conf	2007-03-26 15:57:29.000000000 +0300
@@ -38,3 +38,8 @@
 # entries.
 # See wsconsctl(8) for more details.
 #mapfile /usr/share/wscons/keymaps/pckbd.sv.svascii
+
+# Set arbitrary variable using specified control device
+#	ctldev	var	value
+#setvar	ttyE0	font	ibm
+#setvar	ttyE1	font	ibm
--- rc.d/wscons	2004-08-13 21:08:03.000000000 +0300
+++ rc.d/wscons	2007-03-26 15:24:18.000000000 +0300
@@ -157,7 +157,23 @@
 				;;
 
 			setvar)
-				cmd="$wsctl -w $arg1"
+				dev=$arg1
+				var=$arg2
+				val=$arg3
+
+				case $dev in
+				    ttyE*)
+					cmdmod="-d"
+					;;
+				    wskbd*)
+					cmdmod="-k"
+					;;
+				    wsmouse*)
+					cmdmod="-m"
+					;;
+				esac
+				echo -n "$dev: "
+				cmd="$wsctl -f /dev/$dev $cmdmod -w $var=$val"
 				eval $DOIT $cmd
 				;;
 

--8P1HSweYDcXXzwPJ--