博客專欄

        EEPW首頁(yè) > 博客 > 藍(lán)牙bluez命令

        藍(lán)牙bluez命令

        發(fā)布人:電子禪石 時(shí)間:2021-05-14 來(lái)源:工程師 發(fā)布文章

        記錄一下自己平時(shí)調(diào)試藍(lán)牙的命令,后續(xù)學(xué)習(xí)到再添加

         

        sdptool命令:

        sdptool add SP    - 添加SPP:

        sdptool add --channel=1 DID SP DUN LAN FAX OPUSH FTP HS HF SAP NAP GN PANU HID CIP CTP A2SRC A2SNK SYNCML NOKID PCSUITE SR1

        sdptool brower local - 查看適配器提供的功能

         

        bluetoothctl 命令:

        bluetoothctl scan on 掃描
        bluetoothctl agent on 代理
        bluetoothctl default-agent 默認(rèn)代理
        bluetoothctl trust xx:xx:xx:xx:CF:F0 信任
        bluetoothctl pair xx:xx:xx:xx:CF:F0 配對(duì)

         

        命令行進(jìn)入: bluetoothctl

        查看:default-agent

        注冊(cè)agent:agent on

        掃描:scan on

        停止掃描:scan off

        找到要配對(duì)的藍(lán)牙:pair xx:xx:xx:xx:xx:xx

        添加信任:trust xx:xx:xx:xx:xx:xx

        連接:connect xx:xx:xx:xx:xx:xx

        設(shè)置藍(lán)牙可被發(fā)現(xiàn)狀態(tài):discoverable yes

         

        rfcomm命令:

        mknod /dev/rfcomm0 c 216 0   ---216是RFCOMM設(shè)備號(hào)

        rfcomm bind 0 xx:xx:xx:xx:CF:F0 綁定設(shè)備

        rfcomm connect 0  xx:xx:xx:xx:CF:F0 1連接設(shè)備

        rfcomm show 0  查看設(shè)備狀態(tài)

        cat >/dev/rfcomm0 寫數(shù)據(jù)

        rfcomm release 0 解綁

         

        rfcomm watch /dev/rfcomm0 3 /sbin/agetty rfcomm0 linux 115200   --沒(méi)用過(guò)

         

        hciconfig命令:

        hciconfig hci0 piscan 可使設(shè)備既可見
        hciconfig -a   查看hci詳細(xì)信息
        hciconfig hci0 sspmode disable #關(guān)閉簡(jiǎn)易配對(duì)模式 enable為使能簡(jiǎn)易配對(duì)
        hciconfig hci0 sspmode #查看簡(jiǎn)易配對(duì)模式狀態(tài)

        hciconfig hci0 up

        hciconfig hci0 down

         

         

        hciattach命令:

        hciattach /dev/ttyACM1 any   

         

        linux藍(lán)牙配置文件:

        Bluetoothd保存的對(duì)端設(shè)備的信息:
        /var/lib/bluetooth/

        bluetooth配置:
        /etc/bluetooth/

        /usr/lib/systemd/system/bluetooth.service

        /sys/class/bluetooth/

        dbus中系統(tǒng)總線的配置
        /etc/dbus-1/system.d/bluetooth.conf

         

        bluetooth service和bluetoothd進(jìn)程:


        service --status-all | grep blue        -查看是否存在bluetooth service


        ps -ef|grep blue    -查看是否存在bluetoothd進(jìn)程

        service bluetooth start      -開啟bluetooth service

        service bluetooth stop   -停止bluetooth service

         

        停止bluetoothd進(jìn)程方法:
        rfkill block bluetooth
        sudo service bluetooth stop
        rfkill unblock bluetooth

        bluetoothd -n -d - 啟動(dòng)bluetoothd


        *博客內(nèi)容為網(wǎng)友個(gè)人發(fā)布,僅代表博主個(gè)人觀點(diǎn),如有侵權(quán)請(qǐng)聯(lián)系工作人員刪除。



        關(guān)鍵詞: bluetooth

        相關(guān)推薦

        技術(shù)專區(qū)

        關(guān)閉
        主站蜘蛛池模板: 怀来县| 青海省| 萨迦县| 苍溪县| 奎屯市| 永德县| 郎溪县| 永泰县| 黄龙县| 马公市| 杭州市| 牡丹江市| 溆浦县| 尉氏县| 青田县| 泰来县| 凤阳县| 大洼县| 鄂温| 沙坪坝区| 政和县| 黄骅市| 特克斯县| 凌云县| 玉环县| 西吉县| 开封县| 北川| 婺源县| 塘沽区| 南丰县| 乌苏市| 东宁县| 临沂市| 手游| 武川县| 五河县| 双桥区| 麟游县| 宝山区| 青冈县|