在Linux下藍牙進行rfcomm連接


折騰了半天終於搞定了,開心 用的是bluez3.36,大概說一下流程 1. 配置/etc/bluetooth/rfcomm.conf
rfcomm0 {
#       # Automatically bind the device at startup
        bind no;
#
#       # Bluetooth address of the device
        device XX:XX:XX:XX:XX:XX;
#
#       # RFCOMM channel for the connection
        channel 1;
#
#       # Description of the connection
        comment "Example Bluetooth device";
}
2. 關閉本地pin驗證 1)
hciconfig hci0 noauth ; # 關閉本地的pin驗證
3. 設置連接pin碼 編輯/var/lib/bluetooth/XX:XX:XX:XX:XX:XX/pincodes (XX:XX:XX:XX:XX:XX為本地設備地址) 文件格式為: XX:XX:XX:XX:XX:XX 1234 (XX:XX:XX:XX:XX:XX為目標設備地址) 4. 運行
mknod /dev/rfcomm0 c 216 0
chmod 666 /dev/rfcomm0
rfcomm connect 0;
5. 輸出字符到藍牙串口
echo y>/dev/rfcomm0


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM