On Tue, 27 Apr 2010 22:05:37 +0930 David Walker <davidianwal...@gmail.com> wrote:
> >> Thanks for the heads up on hotplug. > > > > :) > > It's just a work-around. Finding and fixing the root cause is still > > important. > > I wasn't sure if it was a bug or a known feature - i.e. it was decided > to not make guesses about what people were plugging/unplugging. > > BTW, hotplug works great. > > In case anyone has the same issue and can't work it out (I am a script > noob so keep the laughter to a minimum or tell me what I could do > better): > > #!/bin/sh > > DEVCLASS=$1 > DEVNAME=$2 > > case $DEVNAME in > wskbd0) > kbd us.dvorak > ;; > esac > > Make the script executable. > Don't forget to switch on hotplug in rc.conf.local: > hotplugd_flags="" With the fact the keyboard is setup by /etc/rc and the work-around being this easy, it's tough to call this a bug. But the reattach ignoring the /etc/wsconsctl.conf settings is annoying. The confusing part is the keyboard encoding is actually setup *twice* in /etc/rc first by kbd(1) and then (possibly) again by wsconsctl(8) if you have a "keyboard.encoding=" entry in /etc/wsconsctl.conf. Your script above is nice and simple, but would have trouble if you're doing any customizing through /etc/wsconsctl.conf. If you're doing anything custom in /etc/wsconsctl.conf, then your hotplugd script should borrow the portion of /etc/rc which handles executing wsconsctl with all the conf file goodness. It's all in one little function wsconsctl_conf() but you'd also need the stripcom () function and handle IFS properly. -- The OpenBSD Journal - http://www.undeadly.org