尝试在启动时启用蓝牙(Debian)

尝试在启动时启用蓝牙(Debian)

我已经成功配对并连接了一些设备。为此,我不得不使用 rfkill。

$ sudo bluetoothctl
[bluetooth]# power on
Failed to set power on: org.bluez.Error.Blocked
[bluetooth]# exit
$ sudo rfkill unblock bluetooth
$ sudo bluetoothctl
[bluetooth]# power on
Changing power on succeeded

但是,重启后此功能不再有效。因此,在谷歌搜索后,我尝试创建一项服务。

$ sudo cat /etc/systemd/system/rfkill-unblock.service 
[Unit]
Description=RFKill-Unblock Bluetooth Devices
After=bluetooth.service
Requires=bluetooth.service

[Service]
Type=oneshot
ExecStart=/usr/sbin/rfkill unblock bluetooth
ExecStop=
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

重启后,我仍然需要手动调用 rfkill unblock bluetooth 才能启动 bluetoothctl。以下是 systemctl status 的输出

$ sudo systemctl status rfkill-unblock.service
● rfkill-unblock.service - RFKill-Unblock Bluetooth Devices
   Loaded: loaded (/etc/systemd/system/rfkill-unblock.service; enabled)
   Active: active (exited) since Wed 2015-07-15 02:26:18 UTC; 9min ago
  Process: 286 ExecStart=/usr/sbin/rfkill unblock bluetooth (code=exited, status=0/SUCCESS)
 Main PID: 286 (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/rfkill-unblock.service

我认为还应该注意,我正在使用 ssh 连接到这台机器,因为它被用作媒体中心。

答案1

安装并配置urfkill。这似乎对我有用:

# cat /etc/urfkill/urfkill.conf |grep '^[[:alpha:]]\|\['
[general]
user=root
master_key=true
force_sync=true
persist=true

相关内容