之前用到的文章,怕找不到了,放在這裏備份做參考。
================================================
在電腦上安裝了Ubuntu 18.04與Windows 10雙系統,在藍牙鼠標連接上匹配雙系統很麻煩,主要表現爲藍牙鼠標連接一個操作系統之後再重啓到另一個操作系統就需要把鼠標刪掉重新連接,很是麻煩,不過你可以使用本文介紹的方法處理後就不那麼麻煩了。
請按以下步驟操作:
1.首先在 Windows 10 系統中連上藍牙鼠標,目的是留下連接記錄,方便之後來修改連接值。
2.在 Ubuntu 18.04 系統中連上藍牙鼠標,鼠標連不上的請看後面附上的在Ubuntu 18.04系統中藍牙鼠標連接失敗問題的解決一文。
3.獲取 Ubuntu 18.04 系統中的藍牙配對 linkkey 值。
首先切換到 root 賬戶:su
然後執行:cd /var/lib/bluetooth/
執行(兩個小寫的L),獲得電腦的藍牙地址:ll
cd 這個地址,再次執行 ll,獲得鼠標的藍牙地址:ll
cd 鼠標的藍牙地址,並執行:cat info
找到 [LinkKey],記下這個值:
Key=966B5BDD8EAECD793FC26700B8A6B337
4.再回到 Windows 10 系統,此時藍牙鼠標已經自動連接上了(之前有連接記錄),但是不能操控。這個時候先到微軟官網下載 PSTools 工具
下載 PSTools 完成後解壓到文件夾即可,在文件夾內以管理員身份運行 cmd,執行:PsExec.exe -s -i regedit
找到 HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\BTHPORT\Parameters\Keys\ 下的文件夾,正常情況下是以電腦 mac 地址命名的,找到文件夾內的以藍牙鼠標 mac 地址命名的文件,修改它的值爲之前第三步獲取的 key 的值即可。
5.重新啓動電腦,這時隨便你進入 Ubuntu 18.04,或是進入 Windows 10 系統都能正常使用了。
在Ubuntu 18.04系統中藍牙鼠標連接失敗問題的解決
如果你在Ubuntu 18.04操作系統中有藍牙鼠標連接失敗問題,那就參考下面的解決方法處理。
解決方法
首先在系統終端下輸入:
bluetoothctl
然後輸入:
list
看清除 Controller 的 mac 地址,我的是 AC:2B:6E:91:65:4E,在終端輸入:
select AC:2B:6E:91:65:4E
然後輸入:
show
此時確保你的鼠標配對已打開,處於可被發現狀態,輸入:
scan on
在輸出信息中找到你的鼠標後,即可輸入:
scan off
並記下你鼠標的mac地址,如果你的鼠標連接時要求 pin code,則輸入以下命令,若不用則跳過這一條(當然不確定的話需不需要 pin code 就執行一下,也沒什麼影響的)。
agent on
接下來使用上一條記下的鼠標mac地址,輸入:
pair DC:2C:26:AE:35:41
出現 Pairing successful,即配對成功,中間要求 pin code, 就輸入對應 pin code即可。這時配對成功,但是鼠標還不能操作,依次輸入:
connect DC:2C:26:AE:35:41
trust DC:2C:26:AE:35:41
鼠標即可正常使用了。
參考:Bluetooth Mouse Won't Connect after Reboot - Ubuntu 18.04 LTS
device: Bluetooth Mouse M336/M337/M535
problem: mouse won't pair after restarting computer
resolution:
I have also included them below along with the additional steps I needed to perform.
// open up a command prompt and use the bluetoothctl command
// list the available bluetooth controllers
# bluetoothctl
[bluetooth]# list
Controller 01:23:45:67:89:AB fzidpc73
// choose the controller to work with
[bluetooth]# select 01:23:45:67:89:AB
// show/display the controller details
bluetooth]# show
Controller 01:23:45:67:89:AB
Name: fzidpc73
Alias: fzidpc73-0
Class: 0x000000
Powered: no
Discoverable: no
Pairable: yes
UUID: PnP Information (00001200-0000-1000-8000-00805f9b34fb)
UUID: Generic Access Profile (00001800-0000-1000-8000-00805f9b34fb)
UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)
UUID: A/V Remote Control (0000110e-0000-1000-8000-00805f9b34fb)
UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
Modalias: usb:v1D6Bp0246d0517
Discovering: no
[bluetooth]# power on
[CHG] Controller 01:23:45:67:89:AB Class: 0x000104
Changing power on succeeded
[CHG] Controller 01:23:45:67:89:AB Powered: yes
// scan for bluetooth devices (make sure your mouse is in discovery mode before running this command)
[bluetooth]# scan on
Discovery started
[CHG] Controller 01:23:45:67:89:AB Discovering: yes
[NEW] Device 34:88:5D:87:C0:A6 Bluetooth Mouse M336/M337/M535
[bluetooth]# scan off
Discovery stopped
[CHG] Controller 01:23:45:67:89:AB Discovering: no
// turn the agent on just incase you need to supply a pin code[bluetooth]# agent on
Agent registered
// note that the device might not ask you for a pin code
[bluetooth]# pair 34:88:5D:87:C0:A6
Attempting to pair with 34:88:5D:87:C0:A6
[CHG] Device 34:88:5D:87:C0:A6 Connected: yes
Request PIN code
[agent] Enter PIN code: 1234
[CHG] Device 34:88:5D:87:C0:A6 UUIDs:
00001101-0000-1000-8000-00805f9b34fb
[CHG] Device 34:88:5D:87:C0:A6 Paired: yes
Pairing successful
[CHG] Device 34:88:5D:87:C0:A6 Connected: no
// once you have done this use the following two commands to
// complete setup
[bluetooth]# connect 34:88:5D:87:C0:A6
...
[bluetooth]# trust 34:88:5D:87:C0:A6
...
// your mouse should now work properly even after the computer has been restarted.