今天给大家带来一篇关于在统信UOS上启用/禁用蓝牙的文章,通过systemctl关闭蓝牙服务以及rfkill工具禁用蓝牙的方法实现,接下来一起看看吧。
1、查看系统信息
uos@uos-PC:~/Desktop$ uname -a
Linux uos-PC 4.19.0-arm64-desktop #6030 SMP Tue Jun 27 15:28:10 CST 2023 aarch64 GNU/Linux
uos@uos-PC:~/Desktop$ cat /etc/os-version
[Version]
SystemName=UOS Desktop
SystemName[zh_CN]=统信桌面操作系统
ProductType=Desktop
ProductType[zh_CN]=桌面
EditionName=Professional
EditionName[zh_CN]=专业版
MajorVersion=20
MinorVersion=1060
OsBuild=11014.100.100
2、查看蓝牙状态
3、停止蓝牙服务并禁用开机自启
uos@uos-PC:~/Desktop$ sudo systemctl stop bluetooth.service
请输入密码:
验证成功
uos@uos-PC:~/Desktop$ sudo systemctl disable bluetooth.service
Synchronizing state of bluetooth.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install disable bluetooth
insserv: warning: current start runlevel(s) (empty) of script `bluetooth' overrides LSB defaults (2 3 4 5).
insserv: warning: current stop runlevel(s) (0 1 2 3 4 5 6) of script `bluetooth' overrides LSB defaults (0 1 6).
Removed /etc/systemd/system/dbus-org.bluez.service.
Removed /etc/systemd/system/bluetooth.target.wants/bluetooth.service.
uos@uos-PC:~/Desktop$
4、查看蓝牙信息已经不存在
5、启用蓝牙服务并设置开机自启
uos@uos-PC:~/Desktop$ sudo systemctl enable bluetooth.service
Synchronizing state of bluetooth.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable bluetooth
insserv: warning: current start runlevel(s) (empty) of script `bluetooth' overrides LSB defaults (2 3 4 5).
insserv: warning: current stop runlevel(s) (0 1 2 3 4 5 6) of script `bluetooth' overrides LSB defaults (0 1 6).
Created symlink /etc/systemd/system/dbus-org.bluez.service → /lib/systemd/system/bluetooth.service.
Created symlink /etc/systemd/system/bluetooth.target.wants/bluetooth.service → /lib/systemd/system/bluetooth.service.
uos@uos-PC:~/Desktop$ sudo systemctl start bluetooth.service
uos@uos-PC:~/Desktop$
6、蓝牙服务正常
7、使用rfkill禁用蓝牙
rfkill是一个可以启用和禁用Linux内核中无线设备(包括Wi-Fi、蓝牙等)的工具,这是一个临时的方法,如果需要长久禁用,可以搭配由硬件开关或BIOS设置控制。
uos@uos-PC:~/Desktop$ rfkill list
1: hci0: Bluetooth
Soft blocked: no
Hard blocked: no
uos@uos-PC:~/Desktop$ sudo rfkill block 1
uos@uos-PC:~/Desktop$
8、蓝牙信息置灰无法点击开启
9、取消禁用蓝牙
uos@uos-PC:~/Desktop$ sudo rfkill unblock 0
uos@uos-PC:~/Desktop$ rfkill list
0: hci0: Bluetooth
Soft blocked: no
Hard blocked: no
uos@uos-PC:~/Desktop$
10、蓝牙信息正常,可以点击开启