当我们想要在Ubantu系统(可能别的系统也会遇到)中打开蓝牙的时候,可能会提示:
1.没有检测到蓝牙适配器 / 蓝牙守护进程未启动 / BlueZ未运行 等等信息。
这时我们可以用命令:
systemctl status bluetooth.service
来检查我们的蓝牙服务是否处于运行状态。
如果提示:
● bluetooth.service - Bluetooth service
Loaded: loaded(/usr/lib/systemd/system/bluetooth.service; disabled; vendor preset: disabled)
Active: inactive (dead)
Docs: man:bluetoothd(8)
那么很明显我们的蓝牙服务已经失效,需要激活一下,激活也很简单,只需要两行命令即可。
sudo modprobe btusb
sudo systemctl start bluetooth.service
sudo systemctl enable bluetooth.service
sudo modprobe btusb //加载通用的蓝牙驱动程序
sudo systemctl start bluetooth.service //启动蓝牙服务
sudo systemctl enable bluetooth.service //使蓝牙服务开机自启
此时再用我们的检测命令,就能看到:

完成~
2021/10/26
更新两种蓝牙错误情况:
2.rfkill报错
使用命令查询蓝牙状态
systemctl status bluetooth.service
会看到报错提示:
Failed to set mode:Blocked through rfkill(0x12)
//这种情况大致可以理解为蓝牙被rfkill设备(/dev/rfkill?)阻止/封锁了
解决方法为:
sudo rfkill unblock bluetooth
sudo systemctl restart bluetooth
sudo rfkill unblock bluetooth //使得rfkill解除对蓝牙服务的封锁
sudo systemctl start bluetooth.service //重启蓝牙服务
3.hci0设备报错
使用命令查询蓝牙状态
systemctl status bluetooth.service
会看到
loadin LTKs timed out for hci0
解决方法为:
sudo hciconfig hci0 down
sudo rmmod btusb
sudo modprobe btusb
sudo hciconfig hci0 up
sudo systemctl restart bluetooth.service
sudo hciconfig hci0 down //配置hci0蓝牙设备关闭
sudo rmmod btusb //移除btusb蓝牙模块
sudo modprobe btusb //重新加载btusb蓝牙模块
sudo hciconfig hci0 up //配置hci0蓝牙设备启动
sudo systemctl start bluetooth.service //重启蓝牙服务
4万+

被折叠的 条评论
为什么被折叠?



