是否可以在登录屏幕时打开蓝牙并使用蓝牙键盘?到目前为止,我只能在登录时启动蓝牙守护进程。我将其添加到 systemd 中systemctl enable bluetooth
,因此当我在我的用户中时它会启动,尽管它默认情况下处于关闭状态,我也想修复它。
我安装了bluez
并bluez-utils
提供了该bluetoothhctl
实用程序。如果这很重要的话,我也将其用作blueman
前端。
答案1
默认情况下,蓝牙适配器重启后不会开机。
所以,如果你想开机后自动开机您需要AutoEnable=true
在配置文件的/etc/bluetooth/main.conf
底部添加以下行[Policy]
:
/etc/bluetooth/main.conf
------------------------------------------------------------------------------
[Policy]
AutoEnable=true
注意:不推荐使用前一种使用 hciconfig hci0 up 的方法。
来源:拱门维基
答案2
就像大多数时候我没有足够仔细地阅读 Arch Wiki 一样。有一节介绍如何在启动后激活设备。
您需要设置 udev 规则并使用/etc/udev/rules.d/10-local.rules
以下代码创建
# Set bluetooth power up
ACTION=="add", KERNEL=="hci0", RUN+="/usr/bin/hciconfig hci0 up"
就是这样...它现在应该可以工作,即使 X 没有运行。
答案3
该解决方案在 OpenSUSE Tumbleweed 上对我有用systemd
:
- 令
bluetooth.service
被 要求multi-user.target
。我使用了一个systemd
嵌入式目录来实现它:
mkdir /etc/systemd/system/bluetooth.service.d
cat > /etc/systemd/system/bluetooth.service.d/multi-user.conf << EOF
[Install]
WantedBy=bluetooth.target multi-user.target
EOF
systemctl enable bluetooth.service
- 安装
bluez-auto-enable-devices
包以生成所需的AutoEnable=true
配置/etc/bluetooth/main.conf
:
zypper in -y bluez-auto-enable-devices
重新启动后,我的蓝牙键盘和鼠标也可以在登录屏幕上使用。无需打开笔记本电脑盖子并使用笔记本电脑键盘进行登录。
答案4
在最新的内核中我必须使用:
# Set bluetooth power up
ACTION=="add", KERNEL=="hci0", RUN+="/bin/bluetoothctl --agent menu power on"