Zaurus

2006/5/22 02:05 PM 更新

IBS CFBT02I

pdaXromにBluetooth機能を搭載するためにCFカードタイプのBluetoothカードを使えるようにする。
さらにVedofoneの702NKIIをモデムとしてパケット接続を出来るようにする。
今回使用するBluetoothカードはIBS Japan製のCFBT02Iというモデル。

pdaXromはLinuxなのでBluetoothを有効にするためにBlueZというソフトウェアを利用する。
feedにipk化されたBlueZのパッケージがあるので入手してインストール。
 ・bluez-libs_2.5
 ・bluez-utils_2.4
# ipkg install bluez-libs_2.5_armv5tel.ipk
Installing bluez-libs...Done.

# ipkg install bluez-utils_2.4_armv5tel.ipk
Installing bluez-utils...
Stop CF services:                                                    [  OK  ]
Start CF services:                                                   [  OK  ]
Starting Bluetooth:                                                  [  OK  ]
Done.
ログから正常にインストールできたことを確認する。
# tail /var/log/messages
May 16 15:22:51 pcmcia: cardmgr shutdown succeeded
May 16 15:22:52 survive: cardmgr[1598]: watching 2 sockets
May 16 15:22:52 cardmgr[1598]: watching 2 sockets
May 16 15:22:52 pcmcia: cardmgr startup succeeded
May 16 15:23:20 hcid[2381]: HCI daemon ver 2.4 started
May 16 15:23:20 bluetooth: hcid startup succeeded
CFBT02Iを認識させるために以下のパッケージを利用する。
http://www2.licorp.co.jp/pugly/zaurus/pdaxrom_archive/pdaxrom_bluez_for_cfbt02i.tar.gz
「/」で展開する。
# cd /
# tar xvzf pdaxrom_bluez_for_cfbt02i.tar.gz
etc/
etc/rc.d/
etc/rc.d/init.d/
etc/rc.d/init.d/bluetooth
etc/pcmcia/
etc/pcmcia/bluetooth.opts
etc/pcmcia/bluetooth.conf
etc/pcmcia/bluetooth
etc/bluetooth/
etc/bluetooth/link_key
etc/bluetooth/hcid.conf
etc/bluetooth/rfcomm.conf
etc/bluetooth/bt-uart.conf
lib/
lib/modules/
lib/modules/2.4.18-rmk7-pxa3-embedix/
lib/modules/2.4.18-rmk7-pxa3-embedix/kernel/
lib/modules/2.4.18-rmk7-pxa3-embedix/kernel/drivers/
lib/modules/2.4.18-rmk7-pxa3-embedix/kernel/drivers/bluetooth/
lib/modules/2.4.18-rmk7-pxa3-embedix/kernel/drivers/bluetooth/hci_vhci.o
lib/modules/2.4.18-rmk7-pxa3-embedix/kernel/drivers/bluetooth/hci_usb.o
lib/modules/2.4.18-rmk7-pxa3-embedix/kernel/drivers/bluetooth/hci_uart.o
lib/modules/2.4.18-rmk7-pxa3-embedix/kernel/drivers/bluetooth/dtl1_cs.o
lib/modules/2.4.18-rmk7-pxa3-embedix/kernel/drivers/bluetooth/btuart_cs.o
lib/modules/2.4.18-rmk7-pxa3-embedix/kernel/drivers/bluetooth/bt950_cs.o
lib/modules/2.4.18-rmk7-pxa3-embedix/kernel/drivers/bluetooth/bluecard_cs.o
lib/modules/2.4.18-rmk7-pxa3-embedix/kernel/drivers/bluetooth/bfusb.o
tar: lib/modules/2.4.18-rmk7-pxa3-embedix/kernel/drivers/bluetooth/bfusb.o: implausibly old time stamp 1970-01-01 09:00:00
usr/
usr/sbin/
usr/sbin/sdpd
usr/sbin/hcid
usr/sbin/hciconfig
usr/sbin/hciattach
usr/lib/
usr/lib/libbluetooth.so.1.0.23
usr/lib/libbluetooth.so.1
usr/lib/libbluetooth.so
usr/bin/
usr/bin/sdptool
usr/bin/rfcomm
usr/bin/pand
usr/bin/make_dev.bluez.sh
usr/bin/l2ping
usr/bin/hcitool
usr/bin/dund
モジュールを組み込んで有効にするために一度再起動する。
# depmod -A
# reboot
再起動後にBluetooth関連のデーモンが有効になっていればよい。
# tail /var/log/messages
May 16 21:40:51 hcid[381]: Bluetooth HCI daemon
May 16 21:40:51 bluetooth: hcid startup succeeded
May 16 21:40:51 sdpd[386]: Bluetooth SDP daemon
May 16 21:40:51 bluetooth: sdpd startup succeeded
ここでBluetoothカードをCFスロットに挿してみる。
# tail /var/log/messages
May 17 08:37:12 cardmgr[140]: socket 0: Billionton Bluetooth CF Card
May 17 08:37:15 hcid[371]: HCI dev 0 registered
May 17 08:37:15 /sbin/hotplug: no runnable /etc/hotplug/bluetooth.agent is installed
May 17 08:37:15 hcid[371]: HCI dev 0 up
May 17 08:37:15 hcid[371]: Starting security manager 0
カード情報を確認する。 以下のような結果になれば無事認識はされている。
# cardctl ident
Socket 0:
  product info: "Compact Flash", "Bluetooth Card", "", ""
  manfid: 0x0279, 0x950b
  function: 2 (serial)
Socket 1:
  no product info available

# cat /var/lib/pcmcia/stab
Socket 0: Billionton Bluetooth CF Card
0       bluetooth       serial_cs       0       ttyS3   4       67
Socket 1: empty

# hciconfig
hci0:   Type: UART
        BD Address: 00:10:60:AA:BB:CC ACL MTU: 192:8  SCO MTU: 64:8
        UP RUNNING PSCAN ISCAN
        RX bytes:265 acl:0 sco:0 events:13 errors:0
        TX bytes:446 acl:0 sco:0 commands:12 errors:0
周辺にあるBluetooth機器を検出してみる。 うまく検出ができたらOK。
# hcitool scan
Scanning ...
        00:12:62:11:22:33       Nokia 6680

# l2ping -c 5 00:12:62:11:22:33
Ping: 00:12:62:11:22:33 from 00:10:60:AA:BB:CC (data size 20) ...
0 bytes from 00:12:62:11:22:33 id 200 time 66.38ms
0 bytes from 00:12:62:11:22:33 id 201 time 43.24ms
0 bytes from 00:12:62:11:22:33 id 202 time 41.92ms
0 bytes from 00:12:62:11:22:33 id 203 time 31.94ms
0 bytes from 00:12:62:11:22:33 id 204 time 25.62ms
5 sent, 5 received, 0% loss
CFBT02I別のBluetooth機器と接続するためのPIN(認証コード)を作成する。
  /etc/bluetooth/pin
******(実際には英数文字を入れる)
702NKIIをモデムにする場合にPINを取得するコマンドが実行されるが、元からあるコマンドではうまくつながらないので新規にファイルを作成する。
  /usr/bin/bluepin
#!/bin/sh
#
# Bluetooth PIN helper
#
echo "PIN:******"
実行権限を付ける。
# chmod 755 bluepin
# ls -al /usr/bin/bluepin
-rwxr-xr-x    1 root     root           55 May 18 09:49 /usr/bin/bluepin

# /usr/bin/bluepin
PIN:******
pdaXromから702NKIIの情報を取得する。
# sdptool search DUN
Inquiring ...
Searching for DUN on 00:12:62:11:22:33 ...
Service Name: Dial-Up Networking
Service RecHandle: 0x10018
Service Class ID List:
  "Dialup Networking" (0x1103)
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 3
Language Base Attr List:
  code_ISO639: 0x454e
  encoding:    0x6a
  base_offset: 0x100
Profile Descriptor List:
  "Dialup Networking" (0x1103)
    Version: 0x0100
Bluetooth用の設定を編集。
  /etc/bluetooth/rfcomm.conf
rfcomm0 {
    bind yes;
    device 00:12:62:11:22:33;
    channel 3;
    comment "Nokia 6680";
}
XウィンドウよりPPP Modemを設定。
必要なのは以下の箇所
【Accountタブ】
 ・Username:ai@vodafone
 ・Password:vodafone
 ・Phone:*99#
 ・Make connect via:Bluetooth

【Modemタブ】
 ・Device:/dev/rfcomm0
 ・Init stiring:ATZ
 ・Speed:115200
 ・Hardwere flow control:チェック
 ・Time out:1sec
 ・BT DTN:(空白)
 ・BT PIN:(空白)
 ・Demand Dialog:Manual connect and disconnect
 ・Idle timeout:30 seconds

【Networkタブ】
 ・Auto-detect routing:Auto
 ・Auto-detect name servers:Auto
設定した内容は次ののファイルに記録される。
手動でBTDUNデバイスを記載する。
  /etc/ppp/peers/Vodafone
/dev/rfcomm0
115200
connect '/usr/sbin/chat -s -v ABORT "NO CARRIER" ABORT "NO DIALTONE" ABORT "BUSY" "" "ATZ" OK ATDT*99# CONNECT'
crtscts
noipdefault
modem
user "ai@vodafone"
usepeerdns
defaultroute
connect-delay 6000
remotename Vodafone
   ~/Choices/common/Network-PPP-Vodafone.conf
[Info]
name = Vodafone
[Properties]
BTDUN = Nokia 6680
Bluetooth = 1
IrDA = 0
Serial = 0
atdial = ATZ
connectdelay = 6000
crtscts = 1
defaultroute = 1
device = /dev/rfcomm0
dialmode = 0
dns1 =
dns2 =
gateway =
idletime = 120
password = vodafone
phone = *99#
speed = 115200
usepeerdns = 1
username = ai@vodafone
次に702NKII側からBluetooth機器を検出してPINを入力しておく。
このようなログが出れば認証が成功している。
# tail /var/log/messages
May 17 12:44:44 hcid[2177]: HCI dev 0 up
May 17 12:44:44 hcid[2177]: Starting security manager 0
May 17 12:45:48 hcid[2177]: pin_code_request (sba=00:10:60:AA:BB:CC, dba=00:12:62:11:22:33)
May 17 12:45:48 hcid[2177]: link_key_notify (sba=00:10:60:AA:BB:CC)
May 17 12:45:48 hcid[2177]: Saving link key 00:10:60:AA:CB:CC 00:12:62:11:22:33

さらに[ツール]−[設定]−[接続]−[パケット接続]内にある[パケット接続]を『必要時』に変更する。

これで全ての準備は整ったのでPPP dialerより接続してみる。
# tail /var/log/messages
May 19 23:33:43 pppd[6192]: pppd 2.4.3 started by root, uid 0
May 19 23:33:44 hcid[5661]: link_key_request (sba=00:10:60:AA:BB:CC, dba=00:12:62:11:22:33)
May 19 23:33:45 chat[6193]: abort on (NO CARRIER)
May 19 23:33:45 chat[6193]: abort on (NO DIALTONE)
May 19 23:33:45 chat[6193]: abort on (BUSY)
May 19 23:33:45 chat[6193]: send (ATZ^M)
May 19 23:33:46 chat[6193]: expect (OK)
May 19 23:33:46 chat[6193]: ATZ^M^M
May 19 23:33:46 chat[6193]: OK
May 19 23:33:46 chat[6193]: -- got it
May 19 23:33:46 chat[6193]: send (ATDT*99#^M)
May 19 23:33:46 chat[6193]: expect (CONNECT)
May 19 23:33:46 chat[6193]: ^M
May 19 23:33:47 chat[6193]: ATDT*99#^M^M
May 19 23:33:47 chat[6193]: CONNECT
May 19 23:33:48 chat[6193]: -- got it
May 19 23:33:48 pppd[6192]: Serial connection established.
May 19 23:33:48 pppd[6192]: Using interface ppp0
May 19 23:33:48 pppd[6192]: Connect: ppp0 <--> /dev/rfcomm0
May 19 23:33:51 pppd[6192]: PAP authentication succeeded
May 19 23:33:52 pppd[6192]: local IP address 61.195.xxx.yyy
May 19 23:33:52 pppd[6192]: remote IP address 10.6.6.6

これで702NKII経由でネットに接続できるようになった。

【トラブルシューティング】
/dev/rfcomm0が見つからない。
# tail /var/log/messages
May 17 10:53:49 pppd[922]: pppd 2.4.3 started by root, uid 0
May 17 10:53:49 pppd[922]: Failed to open /dev/rfcomm0: No such device
May 17 10:53:49 pppd[922]: Exit.
Bluetooth機器が正常に認識されていない場合に出る。 以下の手順にて復旧。
# /etc/rc.d/init.d/bluetooth stop
# /etc/rc.d/init.d/pcmcia stop
Bluetooth機器を外す
# /etc/rc.d/init.d/pcmcia start
# /etc/rc.d/init.d/bluetooth start
Bluetooth機器を挿す
/usr/bin/bluepinが見つからない
# tail /var/log/messages
May 17 13:11:19 pppd[2799]: pppd 2.4.3 started by root, uid 0
May 17 13:11:21 hcid[2719]: link_key_request (sba=00:10:60:AA:BB:CC, dba=00:12:62:11:22:33)
May 17 13:11:31 hcid[2719]: pin_code_request (sba=00:10:60:AA:BB:CC, dba=00:12:62:11:22:33)
May 17 13:11:31 hcid[2800]: Can't exec PIN helper /usr/bin/bluepin. No such file or directory(2)
May 17 13:11:31 pppd[2799]: Failed to open /dev/rfcomm0: Connection refused
May 17 13:11:31 pppd[2799]: Exit.
コマンドを手動で作成する。
  /usr/bin/bluepin
#!/bin/sh
#
# Bluetooth PIN helper
#
echo "PIN:******"