시작 시 블루투스를 활성화하려고 합니다(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

다시 시작한 후에도 bluetoothctl의 전원을 켜려면 rfkill unblock bluetooth를 수동으로 호출해야 합니다. 다음은 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

관련 정보