我已經成功配對並連接了一些設備。為了做到這一點,我必須使用 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