Ubuntu連接AirPods耳機

有時想讓Ubuntu電腦連接AirPods2耳機,最近重裝系統後,遇到無法配對耳機的情況,特此記錄下摸索過程,AirPods其他型號沒有試過,沒設備測試(最近新購買了AirPods Pro 2nd Generation,經測試,二代照這方法也是可以匹配到的),方法應該大同小異。

首先,更改控制模式爲ControllerMode = bredr,可能值爲: "dual", "bredr", "le", 一種不行的話,換其它模式試試

➜  ~ egrep -v '^#|^$' /etc/bluetooth/main.conf
[General]
ControllerMode = bredr
[Policy]
AutoEnable=true

其次,重啓bluetooth服務

sudo systemctl restart bluetooth.service

此時,如果你的設備,可通過Gnome Settings的bluetooth頁直接識別並匹配的話,下面的步驟作用不大,看看就好。

圖形界面無法匹配時,終端操作

1. 開啓藍牙交互控制工具(interactive bluetooth control tool)

➜  ~ bluetoothctl 
Agent registered
[CHG] Device F4:F5:DB:65:B0:3B RSSI: -73
[CHG] Device 4C:D1:A1:3F:B2:55 RSSI: -79
[CHG] Device 94:87:E0:A1:89:49 RSSI: -72
[CHG] Device A0:A4:C5:04:43:17 RSSI: -77
[CHG] Device B4:CB:57:16:D5:80 RSSI: -82

2. 掃描設備 scan on, 掃描的時候按住AirPods2背後的匹配按鈕

when you begin scan devices, remeber press the AirPods2 button on the back

[bluetooth]# scan on
Discovery started
[NEW] Device 44:66:FC:9C:CC:FC 44-66-FC-9C-CC-FC
[NEW] Device C4:E1:A1:AC:C0:6A C4-E1-A1-AC-C0-6A
[CHG] Device 00:A6:19:18:52:86 RSSI: -69
[NEW] Device 7C:9A:1D:B0:62:02 AirPods
[NEW] Device A4:50:46:BA:7F:49 A4-50-46-BA-7F-49

所在環境設備很多的時候,貌似沒有什麼好的辦法過濾,需要仔細觀察自己的設備名,如上所示,我的airpod2設備已經成功識別

[NEW] Device 7C:9A:1D:B0:62:02 AirPods

3. 連接AirPods2 (connect AirPods2)

[bluetooth]# connect 7C:9A:1D:B0:62:02
Attempting to connect to 7C:9A:1D:B0:62:02
[CHG] Device 7C:9A:1D:B0:62:02 ServicesResolved: yes
[CHG] Device 7C:9A:1D:B0:62:02 Paired: yes
Connection successful
[AirPods]# 

Haha, it works !

4. 看看設備信息(AirPods2 info)

[AirPods]# info 7C:9A:1D:B0:62:02
Device 7C:9A:1D:B0:62:02 (public)
    Name: AirPods
    Alias: AirPods
    Class: 0x00240418
    Icon: audio-headphones
    Paired: yes
    Trusted: no
    Blocked: no
    Connected: yes
    LegacyPairing: no
    UUID: Service Discovery Serve.. (00001000-0000-1000-8000-00805f9b34fb)
    UUID: Audio Sink                (0000110b-0000-1000-8000-00805f9b34fb)
    UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
    UUID: A/V Remote Control        (0000110e-0000-1000-8000-00805f9b34fb)
    UUID: Handsfree                 (0000111e-0000-1000-8000-00805f9b34fb)
    UUID: PnP Information           (00001200-0000-1000-8000-00805f9b34fb)
    UUID: Vendor specific           (74ec2172-0bad-4d01-8f77-997b2be0722a)
    Modalias: bluetooth:v004Cp200Fd9047

5. 下次再連時,先通過devices命令查詢設備地址,地址會被記住一段時間(此時圖形界面連接的方式應該也可以使用)

next time, if your devices offline, just get device address, connect it again

[AirPods]# devices
Device 7C:9A:1D:B0:62:02 AirPods
Device AC:49:DB:4E:39:41 mephisto

查看幫助信息,可以試試額外的控制功能,這裏不再演示:

[AirPods]# help
Menu main:
Available commands:
-------------------
advertise                                         Advertise Options Submenu
monitor                                           Advertisement Monitor Options Submenu
scan                                              Scan Options Submenu
gatt                                              Generic Attribute Submenu
admin                                             Admin Policy Submenu
list                                              List available controllers
show [ctrl]                                       Controller information
select <ctrl>                                     Select default controller
devices                                           List available devices
paired-devices                                    List paired devices
system-alias <name>                               Set controller alias
reset-alias                                       Reset controller alias
power <on/off>                                    Set controller power
pairable <on/off>                                 Set controller pairable mode
discoverable <on/off>                             Set controller discoverable mode
discoverable-timeout [value]                      Set discoverable timeout
agent <on/off/capability>                         Enable/disable agent with given capability
default-agent                                     Set agent as the default one
advertise <on/off/type>                           Enable/disable advertising with given type
set-alias <alias>                                 Set device alias
scan <on/off/bredr/le>                            Scan for devices
info [dev]                                        Device information
pair [dev]                                        Pair with device
cancel-pairing [dev]                              Cancel pairing with device
trust [dev]                                       Trust device
untrust [dev]                                     Untrust device
block [dev]                                       Block device
unblock [dev]                                     Unblock device
remove <dev>                                      Remove device
connect <dev>                                     Connect device
disconnect [dev]                                  Disconnect device
menu <name>                                       Select submenu
version                                           Display version
quit                                              Quit program
exit                                              Quit program
help                                              Display help about this program
export                                            Print environment variables

以上主要針對圖形界面操作無效時的狀況,希望對你有所幫助

最後修改於: Monday, August 28, 2023

相關文章: