りなざうテクノウにたむたむ氏が書いた電源OFF/ON時にカードを再認識させる方法は、sudoのバージョンによって不具合が生じるそうなので、先日NetHelper Appletを使って独自にやってみたんだけど、少々いいかげんな方法だったので他のCFカードでもカード再認識処理が働くようになっていた。
で、ふと思ってりなざうテクノウに書かれていた方法で使っているBluetooth CFカードの制御スクリプトを見てみると、空のファイル/etc/apm.d/suspend.d/S90bluetooth、/etc/apm.d/resume.d/R45bluetoothと、制御スクリプト本体/etc/apm.d/bluetoothが入ってるだけだった。このスクリプトbluetoothは以下のような内容で、パラメータとしてsuspendかresumeを与えると、それに応じた動作を行ってくれる。ちゃんと、hciconfigでBluetooth CFカードが差さっている時に処理を行う。
#!/bin/sh PATH=$PATH:/usr/bin case "$1" in suspend) if [ "`/usr/sbin/hciconfig`" != "" ]; then hcitool dc `hcitool con | grep ACL | sed 's/^.*\([0-9A-F]\{2\}\(:[0-9A-F]\{2\}\)\{5\}\).*$/\1/'` hciconfig hci0 down fi ;; resume) if [ "`/usr/sbin/hciconfig`" != "" ]; then rfcomm bind all cardctl eject cardctl insert fi esac
これをNetHelper Appletからレジューム/サスペンド時に実行できるように/home/zaurus/Settings/nethelper.confに以下のように記述する。
[Global] Enabled = 1 [Run_Off] suspend00 = /etc/apm.d/bluetooth suspend resume00 = /etc/apm.d/bluetooth resume [Run_All] suspend00 = /etc/apm.d/bluetooth suspend resume00 = /etc/apm.d/bluetooth resume