#1 2009-01-11 01:22:03
[Optware] 安裝藍牙(BlueZ 2.25)與手機連結
事先說明:
1. 因藍牙棒的種類(晶片)版本不同, 以下安裝藍牙棒的步驟, 或許不能成功. 請詳查錯誤訊息.
2. 因無線頻率都是2.4GHz, 所以暫時關閉WL-500gx無線功能(DD-WRT有選項可與藍牙共存).
3. 若只想玩弄手機, 可到手機官網找AT command, 經由USB直接操控亦可.
4. BlueZ套件另有相關命令, 請自行查閱測試.
5. 有關藍牙的基本概念等, 建議使用Google學術搜尋, 查閱相關論文. 尤其是論文內對藍牙的簡介, 如此才能理解命令執行後, 輸出訊息的涵義.
機型: 華碩 WL-500gx
韌體: CDMA@wifi 1.71
藍牙棒: CG-USB02-01
手機: Sony Ericsson K600i
1. 未載入kernel module前, 插入藍牙棒, 檢查錯誤訊息(dmesg或/tmp/syslog.log)
usb.c: USB device 2 (vend/prod 0x1131/0x1001) is not claimed by any active driver.
2. kernel module來源與安裝
Oleg: 參考站長寫的這篇文章.
CDMA@wifi: 與下載韌體相同的網址.
DD-WRT: 安裝OpenWrt套件: kmod-bluetooth, kmod-bluetooth-hciusb
3. 載入kernel module
$ modprobe -sv bluez
$ modprobe -sv hci_usb
$ modprobe -sv l2cap
$ modprobe -sv rfcomm
$ modprobe -sv bnep
$ modprobe -sv sco
若無modprobe命令, 以insmod取代.
$ insmod -v bluez | logger -s
...
檢查kernel module載入訊息
BlueZ Core ver 2.4 Copyright (C) 2000,2001 Qualcomm Inc
Written 2000,2001 by Maxim Krasnyansky
...
4. 重新插入藍牙棒, 查看kernel能否驅動.
5. 安裝BlueZ套件
因Optware BlueZ 3.36使用上出現Segmentation fault, 原因尚未詳察, 所以安裝BlueZ 2.25
$ ipkg-opt install bluez2-utils
暫不使用啟動檔, 更名之.
$ mv /opt/etc/init.d/S75bluez-utils /opt/etc/init.d/s75bluez-utils
6. 修改HCI daemon設定檔, 暫時關閉認證, 加密. 設定說明請man.
$ vi /opt/etc/bluetooth/hcid.conf
options {
預設值, 不變
}
device {
...
#auth enable;
#encrypt enable;
}
7. 修改配對密碼, 原來的BlueZ暫時改為1234
$ vi /opt/etc/bluetooth/pin
1234
8. 啟動HCI daemon
$ hcid -f /opt/etc/bluetooth/hcid.conf
9. 檢查藍牙棒是否啟動.
$ hciconfig -a
hci0: Type: USB
BD Address: 00:11:xx:xx:xx:xx ACL MTU: 678:8 SCO MTU: 48:10
UP RUNNING PSCAN ISCAN AUTH ENCRYPT
RX bytes:103 acl:0 sco:0 events:13 errors:0
TX bytes:305 acl:0 sco:0 commands:13 errors:0
Features: 0xbf 0xfe 0x8d 0x78 0x08 0x18 0x00 0x00
Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
Link policy: RSWITCH HOLD SNIFF PARK
Link mode: ACCEPT MASTER
Name: 'WL-500gx'
Class: 0x820100
Service Classes: Networking
Device Class: Computer, Uncategorized
HCI Ver: 1.2 (0x2) HCI Rev: 0x1fe LMP Ver: 1.2 (0x2) LMP Subver: 0x1fe
Manufacturer: Integrated System Solution Corp. (57)
10. 掃描其他藍牙設備
$ hcitool scan
Scanning ...
00:16:xx:xx:xx:xx K600i
11. 手機也掃描WL-500gx, 並輸入配對密碼1234
12. 測試連線, Ctrl+c中斷.
$ l2ping 00:16:xx:xx:xx:xx
Ping: 00:16:xx:xx:xx:xx from 00:11:xx:xx:xx:xx (data size 44) ...
44 bytes from 00:16:xx:xx:xx:xx id 0 time 81.81ms
13. 查看手機有哪些服務
$ sdptool browse
Inquiring ...
Browsing 00:16:xx:xx:xx:xx ...
Service Description: Sony Ericsson K600i
Service RecHandle: 0x10000
Service Class ID List:
"PnP Information" (0x1200)
Service Name: Dial-up Networking
Service RecHandle: 0x10001
Service Class ID List:
"Dialup Networking" (0x1103)
"Generic Networking" (0x1201)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 1
Profile Descriptor List:
"Dialup Networking" (0x1103)
Version: 0x0100
Service Name: Serial Port
Service RecHandle: 0x10002
Service Class ID List:
"Serial Port" (0x1101)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 2
Service Name: HF Voice Gateway
Service RecHandle: 0x10003
Service Class ID List:
"Handfree Audio Gateway" (0x111f)
"Generic Audio" (0x1203)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 3
Profile Descriptor List:
"Handsfree" (0x111e)
Version: 0x0101
Service Name: HS Voice Gateway
Service RecHandle: 0x10004
Service Class ID List:
"Headset Audio Gateway" (0x1112)
"Generic Audio" (0x1203)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 4
Profile Descriptor List:
"Headset" (0x1108)
Version: 0x0100
Service Name: OBEX Object Push
Service RecHandle: 0x10005
Service Class ID List:
"OBEX Object Push" (0x1105)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 5
"OBEX" (0x0008)
Profile Descriptor List:
"OBEX Object Push" (0x1105)
Version: 0x0100
Service Name: OBEX File Transfer
Service RecHandle: 0x10006
Service Class ID List:
"OBEX File Transfer" (0x1106)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 6
"OBEX" (0x0008)
Profile Descriptor List:
"OBEX File Transfer" (0x1106)
Version: 0x0100
Service Name: OBEX SyncML Client
Service RecHandle: 0x10007
Service Class ID List:
"Error: This is UUID-128" (0x00000002-0000-1000-8000-0002ee000002)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 7
"OBEX" (0x0008)
Service Name: OBEX IrMC Sync Server
Service RecHandle: 0x10008
Service Class ID List:
"IrMC Sync" (0x1104)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 8
"OBEX" (0x0008)
Profile Descriptor List:
"IrMC Sync" (0x1104)
Version: 0x0100
Service Name: Mouse & Keyboard
Service Description: Remote Control
Service Provider: Sony Ericsson
Service RecHandle: 0x10009
Service Class ID List:
"Human Interface Device" (0x1124)
Protocol Descriptor List:
"L2CAP" (0x0100)
PSM: 17
"HIDP" (0x0011)
Language Base Attr List:
code_ISO639: 0x656e
encoding: 0x6a
base_offset: 0x100
Profile Descriptor List:
"Human Interface Device" (0x1124)
Version: 0x0100
14. 安裝OBEX套件, 以OBEX(OBject EXchange)傳送檔案測試
$ ipkg-opt install openobex
$ ipkg-opt -nodeps install obexftp
$ ipkg-opt install libusb
15. 建立測試文件檔(這部分就不說明了), 傳送到手機
$ obexftp -b 00:16:xx:xx:xx:xx -p test.txt
Browsing 00:16:xx:xx:xx:xx ...
Connecting...done
Sending "test.txt"... done
Disconnecting...done
傳送後, 檢查手機應該就有test.txt文件了.
後續步驟: 設定啟動檔, 修改藍牙相關設定檔等.
DD-WRT: 若JFFS2夠大, 可將kernel model放入flash memory內.
Oleg與CDMA@wifi: 因受限flash.tar.gz只能64K, kernel module要放在USB flash.
後續玩法:
藍牙耳機聽網路音樂, MP3, 網路電話.
Gnokii傳簡訊(目前Optware的Gnokii 0.6.14只支援Nokia舊機型)
3G手機上網
其他天馬行空, 任您想像.
這篇寫的亂了些, 一方面天氣冷, 腦袋結冰, 一方面是之前的測試紀錄文件, 是由不同的測試環境(操作系統)來理解藍牙的運作(咦, 地震...). 若您想進一步運用藍牙, 建議您在其他Linux操作系統(例如: Mandriva)先測試, 再回頭找Optware相關套件實作. 這樣比較容易成功.
離線
#3 2009-01-11 21:19:46
Re: [Optware] 安裝藍牙(BlueZ 2.25)與手機連結
我只不過是追隨前人的腳步罷了. 只要有心, 人人皆可成為食神.
補充BlueZ套件命令的說明, 有興趣的網友請自行測試.
$ ipkg-opt files bluez2-utils | grep man
$ ipkg-opt files bluez2-utils | grep bin
hcid: Bluetooth Host Controller Interface Daemon
rfcomm: RFCOMM configuration utility
sdpd: SDP(Service Discovery Protocol) daemon
ciptool: Bluetooth Common ISDN Access Profile
hcitool: configure Bluetooth connections
hid2hci: Bluetooth HID to HCI mode switching utility
sdptool: control and interrogate SDP servers
hciattach: attach serial devices via UART HCI to BlueZ stack
pand: BlueZ Bluetooth PAN(Personal Area Networking) daemon
dund: BlueZ Bluetooth dial-up networking daemon
hciconfig: configure Bluetooth devices
hidd: Bluetooth HID(Human Interface Device) daemon
l2ping: Send L2CAP(Logical Link Control and Adaptation Protocol) echo request and receive answer
離線
#7 2009-01-13 12:38:44
Re: [Optware] 安裝藍牙(BlueZ 2.25)與手機連結
我測試過二支藍牙棒, Integrated System Solution Corp. KY-BT100(CG-USB02-01)(v1.2), Broadcom BCM92045DG Non-UHE(v2.0). 在Optware BlueZ v2.25下還好, 但在Mandriva 2009.0就不是很穩. 照理說, Mandriva的相容性應大於Optware的.
另外, 若藍牙棒插在外接式USB Hub, 而不是WL-500gx的屁屁, 也會出現一些狀況.
離線
相關討論主題
主題 | 回覆 | 點閱 | 最後發表 |
---|---|---|---|
|
21 | 108282 | 2019-07-19 21:40:01 作者 hemmis |
ASUS RT-N18U 安裝 optware 的後遺症 作者 kuolung
|
0 | 7204 | 2016-05-18 12:08:38 作者 kuolung |
ASUS RT-N18U 如何安裝 optware 作者 kuolung
|
2 | 11255 | 2016-05-08 17:51:07 作者 kuolung |
Optware 套件搜尋 作者 hippo
|
1 | 10541 | 2015-11-18 11:42:23 作者 rv2231 |
|
13 | 40784 | 2015-06-19 14:57:17 作者 kuochihchun |