Ubuntu连接AirPods耳机
有时想让Ubuntu电脑连接AirPods2耳机,最近重装系统后,遇到无法配对耳机的情况,特此记录下摸索过程,AirPods其他型号没有试过,没设备测试(最近新购买了AirPods Pro 2nd Generation,经测试,二代照这方法也是可以匹配到的),方法应该大同小异。
首先,更改控制模式为ControllerMode = bredr,可能值为: "dual", "bredr", "le", 一种不行的话,换其它模式试试
1 ➜ ~ egrep -v '^#|^$' /etc/bluetooth/main.conf
2 [General]
3 ControllerMode = bredr
4 [Policy]
5 AutoEnable=true
其次,重启bluetooth服务
1 sudo systemctl restart bluetooth.service
此时,如果你的设备,可通过Gnome Settings的bluetooth页直接识别并匹配的话,下面的步骤作用不大,看看就好。
图形界面无法匹配时,终端操作
1. 开启蓝牙交互控制工具(interactive bluetooth control tool)
1 ➜ ~ bluetoothctl
2 Agent registered
3 [CHG] Device F4:F5:DB:65:B0:3B RSSI: -73
4 [CHG] Device 4C:D1:A1:3F:B2:55 RSSI: -79
5 [CHG] Device 94:87:E0:A1:89:49 RSSI: -72
6 [CHG] Device A0:A4:C5:04:43:17 RSSI: -77
7 [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
1 [bluetooth]# scan on
2 Discovery started
3 [NEW] Device 44:66:FC:9C:CC:FC 44-66-FC-9C-CC-FC
4 [NEW] Device C4:E1:A1:AC:C0:6A C4-E1-A1-AC-C0-6A
5 [CHG] Device 00:A6:19:18:52:86 RSSI: -69
6 [NEW] Device 7C:9A:1D:B0:62:02 AirPods
7 [NEW] Device A4:50:46:BA:7F:49 A4-50-46-BA-7F-49
所在环境设备很多的时候,貌似没有什么好的办法过滤,需要仔细观察自己的设备名,如上所示,我的airpod2设备已经成功识别
1 [NEW] Device 7C:9A:1D:B0:62:02 AirPods
3. 连接AirPods2 (connect AirPods2)
1 [bluetooth]# connect 7C:9A:1D:B0:62:02
2 Attempting to connect to 7C:9A:1D:B0:62:02
3 [CHG] Device 7C:9A:1D:B0:62:02 ServicesResolved: yes
4 [CHG] Device 7C:9A:1D:B0:62:02 Paired: yes
5 Connection successful
6 [AirPods]#
connect 貌似会自动 pair,有需要的可以trust。
Haha, it works !
如果报错:
1[bluetooth]# connect C0:95:6D:C0:A3:92
2Attempting to connect to C0:95:6D:C0:A3:92
3Failed to connect: org.bluez.Error.NotReady br-connection-adapter-not-powered
表明你的Ubuntu上的蓝牙开关没打开。
4. 看看设备信息(AirPods2 info)
1 [AirPods]# info 7C:9A:1D:B0:62:02
2 Device 7C:9A:1D:B0:62:02 (public)
3 Name: AirPods
4 Alias: AirPods
5 Class: 0x00240418
6 Icon: audio-headphones
7 Paired: yes
8 Trusted: no
9 Blocked: no
10 Connected: yes
11 LegacyPairing: no
12 UUID: Service Discovery Serve.. (00001000-0000-1000-8000-00805f9b34fb)
13 UUID: Audio Sink (0000110b-0000-1000-8000-00805f9b34fb)
14 UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
15 UUID: A/V Remote Control (0000110e-0000-1000-8000-00805f9b34fb)
16 UUID: Handsfree (0000111e-0000-1000-8000-00805f9b34fb)
17 UUID: PnP Information (00001200-0000-1000-8000-00805f9b34fb)
18 UUID: Vendor specific (74ec2172-0bad-4d01-8f77-997b2be0722a)
19 Modalias: bluetooth:v004Cp200Fd9047
info 信息里面显示 Paired: yes
和 Connected: yes
可以确认已经连上了。
5. 下次再连时,先通过devices命令查询设备地址,地址会被记住一段时间(此时图形界面连接的方式应该也可以使用)
next time, if your devices offline, just get device address, connect it again
1 [AirPods]# devices
2 Device 7C:9A:1D:B0:62:02 AirPods
3 Device AC:49:DB:4E:39:41 mephisto
查看帮助信息,可以试试额外的控制功能,这里不再演示:
1 [AirPods]# help
2 Menu main:
3 Available commands:
4 -------------------
5 advertise Advertise Options Submenu
6 monitor Advertisement Monitor Options Submenu
7 scan Scan Options Submenu
8 gatt Generic Attribute Submenu
9 admin Admin Policy Submenu
10 list List available controllers
11 show [ctrl] Controller information
12 select <ctrl> Select default controller
13 devices List available devices
14 paired-devices List paired devices
15 system-alias <name> Set controller alias
16 reset-alias Reset controller alias
17 power <on/off> Set controller power
18 pairable <on/off> Set controller pairable mode
19 discoverable <on/off> Set controller discoverable mode
20 discoverable-timeout [value] Set discoverable timeout
21 agent <on/off/capability> Enable/disable agent with given capability
22 default-agent Set agent as the default one
23 advertise <on/off/type> Enable/disable advertising with given type
24 set-alias <alias> Set device alias
25 scan <on/off/bredr/le> Scan for devices
26 info [dev] Device information
27 pair [dev] Pair with device
28 cancel-pairing [dev] Cancel pairing with device
29 trust [dev] Trust device
30 untrust [dev] Untrust device
31 block [dev] Block device
32 unblock [dev] Unblock device
33 remove <dev> Remove device
34 connect <dev> Connect device
35 disconnect [dev] Disconnect device
36 menu <name> Select submenu
37 version Display version
38 quit Quit program
39 exit Quit program
40 help Display help about this program
41 export Print environment variables
以上主要针对图形界面操作无效时的状况,希望对你有所帮助
最后修改于: Monday, August 28, 2023
版权申明:
- 未标注来源的内容全部为原创,未经授权请勿转载(因转载后排版往往错乱、内容不可控、无法持续更新等);
- 非营利为目的,演绎本博客任何内容,请以'原文出处'或者'参考链接'等方式给出本站相关网页地址(方便读者)。
相关文章:
- Ubuntu notify-send 定时通知
- Rime输入法引擎和四叶草输入方案
- k8s的startupProbe探针中initialDelaySeconds是否有效
- zfs快照功能测试
- Linux和iPhone互传文件
- Nginx webdav for Joplin
- Ubuntu 安装LDAP客户端
- lvs端部署
- alacritty 终端使用
- 搭建树莓派无线路由器