From owner-freebsd-current Mon Sep 3 3:27:52 2001 Delivered-To: freebsd-current@freebsd.org Received: from air.linkclub.or.jp (air.linkclub.or.jp [210.250.19.40]) by hub.freebsd.org (Postfix) with ESMTP id 96E4537B408 for ; Mon, 3 Sep 2001 03:27:34 -0700 (PDT) Received: from localhost.jp.FreeBSD.org (1Cust15.tnt1.hanno.jp.da.uu.net [63.12.195.15]) by air.linkclub.or.jp (8.11.4/8.11.4) with ESMTP id f83AQ2W48754 for ; Mon, 3 Sep 2001 19:26:03 +0900 (JST) (envelope-from toshi@jp.FreeBSD.org) Date: Mon, 3 Sep 2001 17:20:16 +0900 (JST) Message-Id: <200109030820.f838KGd17031.toshi@jp.FreeBSD.org> From: Toshihiko ARAI To: Kazutaka YOKOTA Cc: current@FreeBSD.org Subject: Re: keyboard reset (was: Re: FreeBSD's aggressive keyboard probe/attach) In-Reply-To: References: X-Mailer: VM 5.96 (beta) / Mule 2.3 (SUETSUMUHANA) based on 19.34.1 Mime-Version: 1.0 (generated by tm-edit 7.106) Content-Type: text/plain; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG + Kazutaka YOKOTA wrote: > We can improve our current behavior of syscons and keyboard drivers > in the following approaches. > a) Remove the FAIL_IF_NO_KBD flag from /boot/device.hints. > Leave the AUTO_DETECT_KBD as it is now for syscons, so that > syscons searches for a keyboard periodically while it isn't using > one. Add a script to /etc/usbd.conf to switch to the USB keyboard. I use the following scripts. This /etc/usb_kbd was an improvement version and became a topic with "-tech-jp ML" in Japan before a little. When you use it, please do "chmod +x". And you can use below four variables with rc.conf. keymap_ keyrate_ keybell_ keychange_ is device name of an USB keyboard. For example, when you use a "jp.106x" keymap with ukbd0, you add keymap_ukbd0="jp.106x" line to /etc/rc.conf. And other variable are similar, too. However, a case to use several USB keyboards is a testing shortage. And keyboard device will not accord with variable name of rc.conf by order to connect an USB keyboard to. > I always liked the idea b), but haven't designed it yet. I like b) plan, too. -- Toshihiko ARAI -----/etc/usbd.conf----- # This entry changes a console keyboard to an USB keyboard when connected it. # And switch back to keyboard just before that when disconnected. # device "USB keyboard" devname "ukbd[0-9]+" attach "/etc/usb_kbd ${DEVNAME} start" detach "/etc/usb_kbd ${DEVNAME} stop" -----/etc/usb_kbd----- #!/bin/sh - # # $FreeBSD$ # # usb_kbd devname [start|stop] # # example: usb_kbd ukbd0 start # # Suck in the configuration variables # if [ -r /etc/defaults/rc.conf ]; then . /etc/defaults/rc.conf source_rc_confs elif [ -r /etc/rc.conf ]; then . /etc/rc.conf fi kbdhist=/var/run/usb_kbd.hist kbddev= ttydev=/dev/ttyv0 devname=$1 shift startstop=$1 shift case ${startstop} in [Ss][Tt][Aa][Rr][Tt] | '') # To change system console by insertion of USB keyboard. # # Acquire a keyboard device name from a message of # "kbd1 at ukbd0" of dmesg command. # kbddev=`dmesg | sed -n -e "/at ${devname}\\$/h" \ -e '${ g s///p }'` [ -z ${kbddev} ] && kbddev=kbd1 # XXX kbdcontrol -k /dev/${kbddev} < ${ttydev} || exit # Append pair of device name into history file. echo "${kbddev} ${devname}" >> ${kbdhist} # You can use following four variables. # For example, # keymap_ukbd0="jp.106x" # and rc.conf(5) may be helpful for you. # eval keymap=\$keymap_${devname} eval keyrate=\$keyrate_${devname} eval keybell=\$keybell_${devname} eval keychange=\$keychange_${devname} # Reference from src/etc/rc.syscons # keymap # case ${keymap} in [Nn][Oo] | '') ;; *) kbdcontrol < ${ttydev} -l ${keymap} ;; esac # keyrate # case ${keyrate} in [Nn][Oo] | '') ;; *) kbdcontrol < ${ttydev} -r ${keyrate} ;; esac # keybell # case ${keybell} in [Nn][Oo] | '') ;; *) kbdcontrol < ${ttydev} -b ${keybell} ;; esac # change function keys # case ${keychange} in [Nn][Oo] | '') ;; *) set - ${keychange} while [ $# -gt 0 ]; do kbdcontrol <${ttydev} -f "$1" "$2" shift; shift done ;; esac ;; *) # To switch back to keyboard before one by removal of # USB keyboard. # if [ -s ${kbdhist} ]; then # # Delete a current keyboard from history file # and get a last keyboard device name. # kbddev=`sed -e "/ ${devname}\\$/d" -e "w ${kbdhist}.tmp" \ ${kbdhist} | sed -n '$s/ .*$//p'` mv ${kbdhist}.tmp ${kbdhist} fi [ -z ${kbddev} ] && kbddev=kbd0 kbdcontrol -k /dev/${kbddev} < ${ttydev} ;; esac To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message