在學習bluetoothctl命令時,執行bluetoothctl,然后執行show,提示No default controller available。
1. 執行hciconfig,發現有hci0,並且處於UP狀態
2. 執行hcitool lescan,可以進行掃描。
3. 執行ps -ef|grep blue,有bluetoothd進程
4. 執行service --status-all | grep blue ,發現有bluetooth service。
后來發現,bluetoothd進程是系統自帶的bluez執行的進程,而我執行的bluetoothctl是自己編譯的bluez,難道是因為bluez版本問題?
解決方法:
1. 停止bluetoothd
rfkill block bluetooth
sudo service bluetooth stop
rfkill unblock bluetooth
2. 啟動自己編譯的bluetoothd
./bluetoothd -n -d &
然后在執行./bluetoothctl, 就能檢測到hci設備了。