Ubuntu connects AirPods headphones

Sometimes I want to connect the AirPods2 headset to the Ubuntu computer. After recently reinstalling the system, I encountered a situation where the headset could not be paired. I hereby record the exploration process. I have not tried other AirPods models, and have not tested the equipment (recently purchased AirPods Pro 2nd Generation, after Test, the second generation can also be matched according to this method), the method should be similar.

First, change the control mode to ControllerMode = bredr , the possible values ​​are: "dual", "bredr", "le", if one does not work, try another mode

➜  ~ egrep -v '^#|^$' /etc/bluetooth/main.conf
ControllerMode = bredr

Second, restart the bluetooth service

sudo systemctl restart bluetooth.service

At this point, if your device can be directly identified and matched through the bluetooth page of Gnome Settings, the following steps allmost useless, just take a look.

When the graphical interface cannot be matched, the terminal operation

1. Open the 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 the device through 'scan on', press and hold the match button on the back of AirPods2 while scanning

[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

When there are many devices in the environment, it seems that there is no good way to filter. You need to carefully observe your device name. As shown above, my airpod2 device has been successfully identified.

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

3. 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

Haha, it works !

4. Check the device information (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. When connecting again next time, first query the device address through the devices command, and the address will be remembered for a period of time (the graphical interface connection method should also be used at this time)

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

Check the help information, you can try additional control functions, which will not be demonstrated here:

[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

The above is mainly for the situation when the graphical interface operation is invalid, I hope it will help you

Lastmod: Monday, August 28, 2023

See Also: