不久前入了個 Raspberry Pi 也就是大家說的樹梅派(以下簡稱RPi),拿來做藍牙測試,用的藍牙dongle是ORICO的BTA-403-BL
http://item.jd.com/980800.html 。這里簡單記錄下安裝過程:
首先是操作系統(tǒng)。作為Arch重度用戶,當然選Archlinux ARM了:
http://archlinuxarm.org/platforms/armv6/raspberry-pi 下載img文件,用dd寫到SD卡上:
dd bs=1M if=/path/to/archlinux-hf-*.img of=/dev/sdX
然后用GParted把SD卡上的分區(qū)拖滿,充分利用空間。這樣SD卡就準備好了,插到RPi上,接上Micro-USB的電源和網(wǎng)線,啟動RPi,從路由器上找到RPi的IP地址(機器名默認是alarmpi),ssh上去(用戶名root密碼root),修改密碼,創(chuàng)建非root賬號,執(zhí)行系統(tǒng)更新 sudo pacman -Syu ,這之后開始安裝藍牙相關(guān)工具:
sudo pacman -S bluez bluez-utils
確保藍牙dongle插到RPi的USB接口,通過 hciconfig 確認藍牙設(shè)備被識別,輸出應該類似下面這個樣子:
[sean@alarmpi]$ hciconfig
hci0: Type: BR/EDR Bus: USB
BD Address: 84:A6:C8:DC:04:97 ACL MTU: 310:10 SCO MTU: 64:8
DOWN
RX bytes:553 acl:0 sco:0 events:28 errors:0
TX bytes:384 acl:0 sco:0 commands:27 errors:0
啟動bluetooth:
sudo systemctl start bluetooth
完成以后,即可通過 bluetoothctl 命令打開藍牙控制臺,執(zhí)行各項藍牙相關(guān)操作,比如show、list、scan on、agent、info等等,這里不展開了。
如果想使用圖形界面操作RPi,也很簡單,基本步驟如下:
sudo pacman -S xorg xorg-xinit lxde
echo 'exec startlxde' > ~/.xinitrc
startx
Enjoy!