BV1AL 之無所不記

2020-02-28

Linux連接藍牙耳機

用手機(安鳳)連接藍牙耳機很簡單,但是在Linux環境似乎不太簡單,所以就來記一下
連接步驟,以下單純是用文字模式指令,沒用到圖型介面程式。

1. rfkill list 檢查 Bluetooth 有沒有被 block ?
2. 以一般 user 執行 systemctl status bluetooth 檢查藍牙有沒有開啟
3. 以一般 user 執行 pulseaudio --start (或是先 -k 再 --start)
4. 以一般 user 執行 bluetoothctl 會出現 [bluetooth]# 提示符號
5. 下令 power on
6. 下令 scan on, 會看到藍牙裝置的 MAC 跟名稱,例如 70:26:xx:xx:xx:xx SONY WH-1000XM2 頭戴式耳機
7. 下令 pair 70:26:xx:xx:xx:xx 進行配對,會出現
   Attempting to pair with 70:26:xx:xx:xx:xx
成功的話會出現
ServicesResolved: yes
Paired: yes
Pairing successful
如果出現
ServicesResolved: no
Paired: no
就再試一次看看,直到顯示 yes
8. 下令 connect 70:26:xx:xx:xx:xx 連接耳機,會出現
   Attempting to connect to 70:26:xx:xx:xx:xx
   成功的話會出現
   Connected: yes
   [CHG] Device 70:26:xx:xx:xx:xx Name: WH-1000XM2
   [CHG] Device 70:26:xx:xx:xx:xx Alias: WH-1000XM2
   [CHG] Device 70:26:xx:xx:xx:xx Connected: no
   [CHG] Device 70:26:xx:xx:xx:xx Connected: yes
   Connection successful
   [NEW] Primary Service
   提示符號也會由 [bluetooth]# 變成
   [WH-1000XM2]#
9. 如果它又出現 Connected: no
   就再執行 connect 70:26:xx:xx:xx:xx 直到出現 Connection successful
   這時候耳機原本不斷閃藍燈會變很久才閃一次藍燈,就可以從電腦撥放音機給它了
10.如果不想聽耳機,就從提示符號 [WH-1000XM2]# 下令 power off
   然後長按耳機的電源鍵關耳機,等要用時再長按耳機電源開機,然後電腦這邊
   在提示符號下令 power on, 就會顯示 Connection successful
11.如果它又出現 Connected: no 就再下令一次 connect 70:26:xx:xx:xx:xx

不知道是硬體還是軟體問題,有時要 connect 好幾次才會連上,一旦連上之後就很穩定。

標籤: