我搜索了很多次以寻找这个问题的答案。我找到的大多数答案都是包含使用文件禁用相应设备的命令rc.local
。我尝试了这种方法,但不幸的是它不起作用。每次启动时我的蓝牙和背光仍然处于“打开”状态。
这是我的文件的当前状态/etc/rc.local
:
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
sh '/home/<myusername>/Documents/boff.sh'
sh '/home/<myusername>/Documents/dbl.sh'
exit 0
文件权限为:
-rwxr-xr-x 1 root root 378 Mar 6 17:21 /etc/rc.local
其boff.sh
内容如下:
#!/bin/sh
echo '0' > /sys/devices/platform/dell-laptop/leds/dell\:\:kbd_backlight/brightness
其dbl.sh
内容如下:
#!/bin/sh
rfkill block bluetooth
这些文件的权限是:
-rwxrwxrwx 1 <my username> <my username> 93 Mar 6 17:21 Documents/boff.sh
-rwxrwxrwx 1 <my username> <my username> 33 Mar 6 17:18 Documents/dbl.sh
这就是lsusb
结果
Bus 003 Device 007: ID 0bda:5754 Realtek Semiconductor Corp.
Bus 003 Device 006: ID 0bda:0129 Realtek Semiconductor Corp. RTS5129 Card Reader Controller
Bus 003 Device 005: ID 04f3:2012 Elan Microelectronics Corp.
Bus 003 Device 004: ID 8087:07dc Intel Corp.
Bus 003 Device 003: ID 046d:c535 Logitech, Inc.
Bus 003 Device 002: ID 8087:8000 Intel Corp.
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 002: ID 0781:5567 SanDisk Corp. Cruzer Blade
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
答案1
删除您添加的两行/etc/rc.local
并添加
sleep 20
echo '0' > /sys/devices/platform/dell-laptop/leds/dell::kbd_backlight/brightness
保存,退出文本编辑器并重新启动
对于蓝牙,我们可以使用 udev 规则在启动时阻止蓝牙
gksudo gedit /etc/udev/rules.d/81-bluetooth.rules
并复制以下内容
SUBSYSTEM=="usb", ATTRS{idVendor}=="8087", ATTRS{idProduct}=="07dc", RUN+="/usr/sbin/rfkill block bluetooth"
保存并退出