
5 年後,我的筆記型電腦狀況良好(仍然)。
但我的內建藍牙不再像以前那樣了(由於它的廣泛使用)並且在啟動時幾乎無法加載。由於廣泛使用,我選擇購買一個 10 美元的藍牙棒,它接替了內建藍牙棒的工作。
然而,內置的大多不亮,但有時仍會發出火花。有時它真的很煩人,因為它只會破壞我的設定並覆蓋一些東西。
我的問題:如何確保內建藍牙永久停用,而 USB 裝置仍然能夠發送我的音訊/指點裝置/...。
系統:Linux Mint 18(基礎:Ubuntu 16.04)
lsusb 輸出:
jeroen@laptop ~ $ lsusb
Bus 002 Device 002: ID 5986:02ac Acer, Inc
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 002: ID 138a:0018 Validity Sensors, Inc. Fingerprint scanner
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
(Built-in BT) Bus 003 Device 004: ID 0a5c:21b4 Broadcom Corp. BCM2070 Bluetooth 2.1 + EDR
(USB-BT) Bus 003 Device 006: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 008 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 007 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 006 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 005 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
更新:測試輸出
(根據德克特的要求)
jeroen@laptop ~ $ sudo hcitool dev
Devices:
hci0 00:1B:DC:0F:73:5D
hci1 CC:52:AF:A8:71:B5
## Plugged out the USB-BT dongle
jeroen@laptop ~ $ sudo hcitool dev
Devices:
hci1 CC:52:AF:A8:71:B5
## Plugged in the USB-BT dongle
jeroen@laptop ~ $ sudo rfkill list
0: phy0: Wireless LAN
Soft blocked: no
Hard blocked: no
1: brcmwl-0: Wireless LAN
Soft blocked: no
Hard blocked: no
4: hp-wifi: Wireless LAN
Soft blocked: no
Hard blocked: no
5: hp-bluetooth: Bluetooth
Soft blocked: no
Hard blocked: no
6: hci1: Bluetooth
Soft blocked: no
Hard blocked: no
8: hci0: Bluetooth
Soft blocked: no
Hard blocked: no
jeroen@laptop ~ $ sudo rfkill block 5
jeroen@laptop ~ $ sudo rfkill list
0: phy0: Wireless LAN
Soft blocked: no
Hard blocked: no
1: brcmwl-0: Wireless LAN
Soft blocked: no
Hard blocked: no
4: hp-wifi: Wireless LAN
Soft blocked: no
Hard blocked: no
5: hp-bluetooth: Bluetooth
Soft blocked: no
Hard blocked: no
6: hci1: Bluetooth
Soft blocked: no
Hard blocked: no
8: hci0: Bluetooth
Soft blocked: no
Hard blocked: no
jeroen@laptop ~ $ sudo rfkill block 6
jeroen@laptop ~ $ sudo rfkill list
0: phy0: Wireless LAN
Soft blocked: no
Hard blocked: no
1: brcmwl-0: Wireless LAN
Soft blocked: no
Hard blocked: no
4: hp-wifi: Wireless LAN
Soft blocked: no
Hard blocked: no
5: hp-bluetooth: Bluetooth
Soft blocked: no
Hard blocked: no
6: hci1: Bluetooth
Soft blocked: yes
Hard blocked: no
8: hci0: Bluetooth
Soft blocked: no
Hard blocked: no
jeroen@laptop ~ $ sudo rfkill block 8
jeroen@laptop ~ $ sudo rfkill list
0: phy0: Wireless LAN
Soft blocked: no
Hard blocked: no
1: brcmwl-0: Wireless LAN
Soft blocked: no
Hard blocked: no
4: hp-wifi: Wireless LAN
Soft blocked: no
Hard blocked: no
5: hp-bluetooth: Bluetooth
Soft blocked: no
Hard blocked: no
6: hci1: Bluetooth
Soft blocked: yes
Hard blocked: no
8: hci0: Bluetooth
Soft blocked: yes
Hard blocked: no
jeroen@laptop ~ $ sudo rfkill unblock 8
jeroen@laptop ~ $ sudo rfkill list
0: phy0: Wireless LAN
Soft blocked: no
Hard blocked: no
1: brcmwl-0: Wireless LAN
Soft blocked: no
Hard blocked: no
4: hp-wifi: Wireless LAN
Soft blocked: no
Hard blocked: no
5: hp-bluetooth: Bluetooth
Soft blocked: no
Hard blocked: no
6: hci1: Bluetooth
Soft blocked: no
Hard blocked: no
8: hci0: Bluetooth
Soft blocked: no
Hard blocked: no
jeroen@laptop ~ $ sudo rfkill unblock 6
jeroen@laptop ~ $ sudo rfkill list
0: phy0: Wireless LAN
Soft blocked: no
Hard blocked: no
1: brcmwl-0: Wireless LAN
Soft blocked: no
Hard blocked: no
4: hp-wifi: Wireless LAN
Soft blocked: no
Hard blocked: no
5: hp-bluetooth: Bluetooth
Soft blocked: no
Hard blocked: no
6: hci1: Bluetooth
Soft blocked: no
Hard blocked: no
8: hci0: Bluetooth
Soft blocked: no
Hard blocked: no
jeroen@laptop ~ $ sudo rfkill unblock 5
jeroen@laptop ~ $ sudo rfkill list
0: phy0: Wireless LAN
Soft blocked: no
Hard blocked: no
1: brcmwl-0: Wireless LAN
Soft blocked: no
Hard blocked: no
4: hp-wifi: Wireless LAN
Soft blocked: no
Hard blocked: no
5: hp-bluetooth: Bluetooth
Soft blocked: no
Hard blocked: no
6: hci1: Bluetooth
Soft blocked: no
Hard blocked: no
8: hci0: Bluetooth
Soft blocked: no
Hard blocked: no
答案1
您可以建立udev
規則來停用內部藍牙。
首先透過運行並找到正確的行來找到您想要停用的 USB 裝置idVendor
。例如,在我的系統上,這是我想要停用的適配器的匹配行:idProduct
lsusb
Bus 004 Device 006: ID 0b05:179c ASUSTek Computer, Inc. Bluetooth Adapter
然後將以下內容放入 中/etc/udev/rules.d/81-bluetooth-hci.rules
,記下上面的0b05
和值:179c
SUBSYSTEM=="usb", ATTRS{idVendor}=="0b05", ATTRS{idProduct}=="179c", ATTR{authorized}="0"
此時,您可以重新啟動,您的裝置不應再顯示在 的輸出中hciconfig -a
,並且您插入的任何其他藍牙裝置(假設它不是同一供應商+產品ID!)將顯示為hci0
。
如果您不想重新啟動,您可以嘗試重新初始化設備,首先拔掉任何其他藍牙適配器,然後以 root 身份運行:
udevadm trigger
rmmod btusb
現在插入新的藍牙適配器並享受保留的正常運行時間(或者如果不起作用,請重新啟動!)。
解決方案找到於詢問Ubuntu。
答案2
選項 1:使用rfkill
.
這將禁用被封鎖的裝置上的傳輸,並且通常還會使驅動程式處於「關閉」狀態。rfkill help
對於命令,rfkill list
列出可以 rfkill 的設備,rfkill block <index>|<type>
以阻止它。您可能需要一個索引,並且我不知道索引是否在引導之間保持一致,因此您可能需要使用 等編寫一個小腳本grep
以cut
確保安全。您可能需要安裝該命令的軟體包rfkill
。
編輯:如果您擔心更改索引,請執行以下操作
HCI=`hcitool dev | grep '00:11:22:33:44:55' | cut -f2`
INDEX=`rfkill list | grep $HCI | cut -d: -f1`
(但當然是你的內部藍牙適配器的MAC位址),並且$INDEX
應該包含它的索引。我無法對此進行測試,因為我沒有具有多個藍牙適配器的硬體。
另一種方法是使用烏德夫為已知適配器建立特殊名稱的規則,但這可能比使用上面兩行更難弄清楚。
最後,除了使用之外別無選擇殺戮核心功能可以完全停用藍牙無線電,儘管我不知道可能還有其他命令列介面。
選項2:黑名單內核模組
如果啟動後內建藍牙裝置處於停用狀態,且核心驅動程式已編譯為模組,則可以透過將其列入黑名單來阻止驅動程式載入和啟用該裝置。用於lsmod
列出目前載入的模組,並在啟動後查看dmesg
系統日誌以識別內建藍牙裝置的驅動程式。將其列入黑名單取決於您使用的發行版,例如在 Debian(也可能是 Ubuntu)上,創建一個/etc/modprobe.d/
包含行blacklist <modulname>
.man modprobe.d
詳情請參閱。
如果內建藍牙裝置在啟用狀態下啟動,將驅動程式列入黑名單將阻止您使用它,但如果它損壞,它仍然可能會傳輸內容。