确保运行sdptool browse local
会出现以下错误:
Failed to connect to SDP server on FF:FF:FF:00:00:00: No such file or directory
事实证明,罪魁祸首是bluetoothd
蓝牙守护程序。与SDP一起bluetoothd
使用时,出于某些愚蠢的原因,要求使用不推荐使用的功能,因此要解决此问题,必须在兼容模式下使用bluetoothd -C
(或bluetooth --compat
)启动该守护程序。
查找位置bluetooth.service
:
systemctl status bluetooth.service
然后编辑bluetooth.service
并寻找
ExecStart=/usr/libexec/bluetooth/bluetoothd
追加--compat
到此行的末尾,保存,然后运行
service bluetooth start
如果一切顺利,您应该能够成功运行
sudo sdptool browse local
最后,重置适配器:
sudo hciconfig -a hci0 reset
现在一切正常
只是让人们知道,我相信最新BlueZ
版本在我的系统中被破坏了。我下载,编译并安装了5.35版本,但没有任何效果。我拨到5.34,还是一样。我还注意到,蓝牙适配器在启用后会自动关闭3-4分钟,
sudo hciconfig hci0 up # hci0 is the bt adapter
我使用一个USB蓝牙加密狗进行测试。它没有像内置适配器那样自动关闭,但是问题仍然存在。然后我曾经apt-get
重新安装bluez
,
apt-get install --reinstall bluez
突然之间一切恢复正常。