USL-5Pとudlとwsconsとttys
2013/01/05(土) 16:38 NetBSD はてブ情報 はてブに登録 はてブ数

せっかくインストールしたUSL-5Pもシリアルやssh経由だけで使うのも何とも味気ないものですから、豊富なUSBポートを活用してディスプレイとキーボードをつないでみましょう。

ディスプレイはCentury LCD-8000U, キーボードはELECOM TK-UP84CPWHです。

もちろんX Window Systemを動かすのが見た目のインパクトも大きいのですが、kernelにもXにもパッチが必要で割と手間がかかります。ということで、まずはコンソールだけでもやってみようと思ったのであります。

2012年3月にもコンソールに挑戦して敗北していることもあって、いっちょう今回は逃げずに頑張ってみましょうと。

結論から言うと動きました。

pg92onUSL5P.jpg

landiskに関してはkernelに
options         WSEMUL_VT100            # VT100 / VT220 emulation
を定義して作り直す必要がありました。これをつけないと
wsconscfg: WSDISPLAYIO_ADDSCREEN: Device not configured
というエラーメッセージが出てしまいます。実は、これはwscons.confの
screen  1       -       vt100
に書かれているvt100をみて、wsconsが「vt100のエミュレーションないなー、デバイスコンフィグできませんなー」ということのようですね。

wsconscfgコマンドを使うとわかるのですが、
usl5p# wsconscfg -e dumb 1
usl5p# wsconscfg -e vt100 1
てな具合で、知っている端末エミュレーションだとエラーを出さずに成功し、
usl5p# wsconscfg -e sun 1
wsconscfg: WSDISPLAYIO_ADDSCREEN: Device not configured
てな具合で、知らない端末エミュレーションだと上のようなエラーを出すようです。知らない端末だと教えてくれるといいんですけど、wsdisplay.c#364あたりからすると、return ENXIO つまりDevice not configuredを返しているので、そこまでハンドリングできないようです。

そしてなぜか、screen 2, screen 3を作ろうとすると、メモリをアロケートできませんというエラーが出ます。
options        WSDISPLAY_DEFAULTSCREENS=4
をカーネルのコンフィグに足してみましたが、状況変わらず。これについてはちょっとあきらめることにしました。

先のwscons.confで作ったscreenに対応するttyがttysに書かれた/dev/ttyE1になるようですね。
ttyE1   "/usr/libexec/getty Pc"         vt220   on secure
よくわかっていないのですが、console = screen 0 = ttyE0と考えておけばよいのかなぁ。そいでもって、screen 1 = ttyE1で有効にしてやれば動くと。

/etc/ttyactionにもこういうの書いてあるし。ttyE0とconsoleは深い関係にありそうですなー。この辺の整合性が取れていないとconsoleでもrootでログインできなくなっちゃったりするんでしょうね。
ttyE0   *       chown ${USER}:tty /dev/console
と思ったらNetBSD/landiskにはなかったな。うーん。

さて、wsconsですが、黒字に白文字というのはいかにもパッとしません。
きっと色ぐらいは変えられるだろうと思い、wsconsctlなどといういかにもなコマンドを発見し、おー、オプションに-aを渡せば設定項目が全部表示されるんだねー。と思い。
usl5p# wsconsctl -a
type=usb
bell.pitch=1500
bell.period=100
bell.volume=50
bell.pitch.default=1500
bell.period.default=100
bell.volume.default=50
wsconsctl: "map" not shown with -a; use "wsconsctl map" to view.
repeat.del1=400
repeat.deln=100
repeat.del1.default=400
repeat.deln.default=100
ledstate=0
encoding=us
keyclick=0
scroll.mode=0
scroll.modifier=1
あれぇ? 色に関する項目がないですねぇ。
どうやら、オプションに-dを与えないとディスプレイ関連の設定値は出てこないんですね。
usl5p# wsconsctl -f /dev/ttyE1 -d -a
type=unknown_49
scroll.fastlines=25
scroll.slowlines=2
msg.default.attrs=color
msg.default.bg=black
msg.default.fg=white
msg.kernel.attrs=color
msg.kernel.bg=black
msg.kernel.fg=white
これで設定がわかりました。白背景に黒文字にしたければ次のようにします。
usl5p# wsconsctl -f /dev/ttyE1 -d -w msg.default.bg=white
msg.default.bg -> white
usl5p# wsconsctl -f /dev/ttyE1 -d -w msg.default.fg=black
msg.default.fg -> black
この設定をwscons.confのsetvarで書いてやればいいみたいですね。

起動時に試してみたら、確かに文字の所は設定が反映されて白背景に黒文字ですけれど、それ以外のスペースの部分は黒いままだったりして... まぁ、ログインしてCtrl-lで全面描画されるので良いんですけど。そもそもの背景色を設定する方法がほかにあるのかもしれません。

設定をまとめておきましょう。

カーネル (実際に必要なのは最後の一行だけですけど)
n601# diff -u GENERIC USL-5P.nfs
--- GENERIC     2013-01-05 18:03:35.000000000 +0000
+++ USL-5P.nfs  2013-01-05 18:06:35.000000000 +0000
@@ -175,8 +175,8 @@

 # Kernel root file system and dump configuration.
 #config                netbsd  root on ? type ?
-config         netbsd  root on wd0a type ffs
-#config                netbsd  root on ? type nfs
+#config                netbsd  root on wd0a type ffs
+config         netbsd  root on ? type nfs


 #
@@ -224,8 +224,8 @@
 # The 0x0001 flag force the driver to use DMA, even if the driver doesn't know
 # how to set up DMA modes for this chip. This may work, or may cause
 # a machine hang with some controllers.
-pciide*        at pci? dev ? function ? flags 0x0000   # GENERIC pciide driver
-acardide*      at pci? dev ? function ?        # Acard IDE controllers
+#pciide*       at pci? dev ? function ? flags 0x0000   # GENERIC pciide driver
+#acardide*     at pci? dev ? function ?        # Acard IDE controllers

 wdc0   at obio? port 0x14000000 irq 10         # CF
 #wdc1  at obio? port 0x18000000 irq 9          # iConnect
@@ -477,3 +477,14 @@
 # wscons pseudo-devices
 pseudo-device  wsmux                   # mouse & keyboard multiplexor
 #pseudo-device wsfont
+
+options        WSDISPLAY_CUSTOM_OUTPUT # color customization from wsconsctl(8)
+options        WSDISPLAY_CUSTOM_BORDER # custom border colors via wsconsctl(8)
+#options       WSDISPLAY_BORDER_COLOR=WSCOL_BLUE       # default color
+options        WSDISPLAY_COMPAT_PCVT           # emulate some ioctls
+options        WSDISPLAY_COMPAT_SYSCONS        # emulate some ioctls
+options        WSDISPLAY_COMPAT_USL            # wsconscfg VT handling
+options        WSDISPLAY_COMPAT_RAWKBD         # can get raw scancodes
+#options       WSDISPLAY_DEFAULTSCREENS=4
+options        WSDISPLAY_SCROLLSUPPORT
+options        WSEMUL_VT100            # VT100 / VT220 emulation
/etc/rc.conf
wscons=YES
/etc/ttys
console "/usr/libexec/getty std.9600"   vt220   on secure
constty "/usr/libexec/getty std.9600"   vt220   off secure
ttyE0   "/usr/libexec/getty Pc"         vt220   off secure
ttyE1   "/usr/libexec/getty Pc"         vt220   on secure
ttyE2   "/usr/libexec/getty Pc"         vt220   off secure
ttyE3   "/usr/libexec/getty Pc"         vt220   off secure
tty00   "/usr/libexec/getty std.9600"   unknown off secure
tty01   "/usr/libexec/getty std.9600"   unknown off secure
tty02   "/usr/libexec/getty std.9600"   unknown off secure
tty03   "/usr/libexec/getty std.9600"   unknown off secure
tty04   "/usr/libexec/getty std.9600"   unknown off secure
tty05   "/usr/libexec/getty std.9600"   unknown off secure
tty06   "/usr/libexec/getty std.9600"   unknown off secure
tty07   "/usr/libexec/getty std.9600"   unknown off secure

/etc/wscons.conf (screensの部分とsetvarの部分を抜粋)
#screen 0       -       vt100
screen  1       -       vt100
#screen 2       -       vt100
#screen 3       -       vt100
#screen 4       -       -

setvar ttyE1    msg.default.bg  white
setvar ttyE1    msg.default.fg  black

名前:  非公開コメント   

  • TB-URL  http://www.tokuda.net/diary/0795/tb/