Ubuntu 20.04 蓝牙耳机无法配对

Ubuntu 20.04 蓝牙耳机无法配对

Ubuntu

name@laptop:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.1 LTS
Release:    20.04
Codename:   focal

name@laptop:~$ uname -a
Linux laptop 5.4.0-62-generic #70-Ubuntu SMP Tue Jan 12 12:45:47 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

USB 蓝牙

Bus 004 Device 003: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)

配置

name@laptop:~$ cat /etc/bluetooth/input.conf 
# Configuration file for the input service

# This section contains options which are not specific to any
# particular interface
[General]

# Set idle timeout (in minutes) before the connection will
# be disconnect (defaults to 0 for no timeout)
IdleTimeout=0

# Enable HID protocol handling in userspace input profile
# Defaults to false (HIDP handled in HIDP kernel module)
#UserspaceHID=true

# Limit HID connections to bonded devices
# The HID Profile does not specify that devices must be bonded, however some
# platforms may want to make sure that input connections only come from bonded
# device connections. Several older mice have been known for not supporting
# pairing/encryption.
# Defaults to false to maximize device compatibility.
#ClassicBondedOnly=true

# LE upgrade security
# Enables upgrades of security automatically if required.
# Defaults to true to maximize device compatibility.
#LEAutoSecurity=true

name@laptop:~$ cat /etc/bluetooth/main.conf 
[General]

# Default adaper name
# Defaults to 'BlueZ X.YZ'
#Name = BlueZ

# Default device class. Only the major and minor device class bits are
# considered. Defaults to '0x000000'.
#Class = 0x000100

# How long to stay in discoverable mode before going back to non-discoverable
# The value is in seconds. Default is 180, i.e. 3 minutes.
# 0 = disable timer, i.e. stay discoverable forever
DiscoverableTimeout = 30

# How long to stay in pairable mode before going back to non-discoverable
# The value is in seconds. Default is 0.
# 0 = disable timer, i.e. stay pairable forever
#PairableTimeout = 0

# Automatic connection for bonded devices driven by platform/user events.
# If a platform plugin uses this mechanism, automatic connections will be
# enabled during the interval defined below. Initially, this feature
# intends to be used to establish connections to ATT channels. Default is 60.
#AutoConnectTimeout = 60

# Use vendor id source (assigner), vendor, product and version information for
# DID profile support. The values are separated by ":" and assigner, VID, PID
# and version.
# Possible vendor id source values: bluetooth, usb (defaults to usb)
#DeviceID = bluetooth:1234:5678:abcd

# Do reverse service discovery for previously unknown devices that connect to
# us. This option is really only needed for qualification since the BITE tester
# doesn't like us doing reverse SDP for some test cases (though there could in
# theory be other useful purposes for this too). Defaults to 'true'.
#ReverseServiceDiscovery = true

# Enable name resolving after inquiry. Set it to 'false' if you don't need
# remote devices name and want shorter discovery cycle. Defaults to 'true'.
#NameResolving = true

# Enable runtime persistency of debug link keys. Default is false which
# makes debug link keys valid only for the duration of the connection
# that they were created for.
#DebugKeys = false

# Restricts all controllers to the specified transport. Default value
# is "dual", i.e. both BR/EDR and LE enabled (when supported by the HW).
# Possible values: "dual", "bredr", "le"
ControllerMode = bredr

# Enables Multi Profile Specification support. This allows to specify if
# system supports only Multiple Profiles Single Device (MPSD) configuration
# or both Multiple Profiles Single Device (MPSD) and Multiple Profiles Multiple
# Devices (MPMD) configurations.
# Possible values: "off", "single", "multiple"
#MultiProfile = off

# Permanently enables the Fast Connectable setting for adapters that
# support it. When enabled other devices can connect faster to us,
# however the tradeoff is increased power consumptions. This feature
# will fully work only on kernel version 4.1 and newer. Defaults to
# 'false'.
FastConnectable = true

[Policy]

# The ReconnectUUIDs defines the set of remote services that should try
# to be reconnected to in case of a link loss (link supervision
# timeout). The policy plugin should contain a sane set of values by
# default, but this list can be overridden here. By setting the list to
# empty the reconnection feature gets disabled.
#ReconnectUUIDs=00001112-0000-1000-8000-00805f9b34fb, 0000111f-0000-1000-8000-00805f9b34fb, 0000110a-0000-1000-8000-00805f9b34fb

# ReconnectAttempts define the number of attempts to reconnect after a link
# lost. Setting the value to 0 disables reconnecting feature.
#ReconnectAttempts=7

# ReconnectIntervals define the set of intervals in seconds to use in between
# attempts.
# If the number of attempts defined in ReconnectAttempts is bigger than the
# set of intervals the last interval is repeated until the last attempt.
#ReconnectIntervals=1, 2, 4, 8, 16, 32, 64

# AutoEnable defines option to enable all controllers when they are found.
# This includes adapters present on start as well as adapters that are plugged
# in later on. Defaults to 'false'.
AutoEnable=true

name@laptop:~$ cat /etc/bluetooth/network.conf 
# Configuration file for the network service

[General]

# Disable link encryption: default=false
# DisableSecurity=true

耳机可以与我的 Android 手机配合使用。但无法与 Ubuntu 配合使用。

Bluedio H2 New(black)

尝试配对

name@laptop:~$ sudo bluetoothctl 
Agent registered
[CHG] Controller 00:1A:7D:DA:71:10 Pairable: yes
[bluetooth]# list
Controller 00:1A:7D:DA:71:10 laptop [default]
[bluetooth]# select 00:1A:7D:DA:71:10 
[bluetooth]# agent on 
Agent is already registered
[bluetooth]# default-agent 
Default agent request successful
[bluetooth]# show 00:1A:7D:DA:71:10 
Controller 00:1A:7D:DA:71:10 (public)
    Name: laptop
    Alias: laptop
    Class: 0x000c0104
    Powered: yes
    Discoverable: yes
    DiscoverableTimeout: 0x00000000
    Pairable: yes
    UUID: Audio Source              (0000110a-0000-1000-8000-00805f9b34fb)
    UUID: Headset                   (00001108-0000-1000-8000-00805f9b34fb)
    UUID: Headset AG                (00001112-0000-1000-8000-00805f9b34fb)
    UUID: PnP Information           (00001200-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: Audio Sink                (0000110b-0000-1000-8000-00805f9b34fb)
    Modalias: usb:v1D6Bp0246d0535
    Discovering: no
[bluetooth]# scan on
Failed to start discovery: org.bluez.Error.InProgress
[bluetooth]# devices
Device 1F:47:3F:3F:C0:5E H2
[bluetooth]# scan off
Failed to stop discovery: org.bluez.Error.InProgress
[bluetooth]# info 1F:47:3F:3F:C0:5E 
Device 1F:47:3F:3F:C0:5E (public)
    Name: H2
    Alias: H2
    Class: 0x00240404
    Icon: audio-card
    Paired: no
    Trusted: yes
    Blocked: no
    Connected: no
    LegacyPairing: no
[bluetooth]# pair 1F:47:3F:3F:C0:5E 
Attempting to pair with 1F:47:3F:3F:C0:5E
Failed to pair: org.bluez.Error.AuthenticationCanceled
[bluetooth]# 

消息

name@laptop:~$ dmesg | grep -i bluetooth
[   16.903869] Bluetooth: Core ver 2.22
[   16.903900] Bluetooth: HCI device and connection manager initialized
[   16.903905] Bluetooth: HCI socket layer initialized
[   16.903907] Bluetooth: L2CAP socket layer initialized
[   16.903911] Bluetooth: SCO socket layer initialized
[ 1123.168832] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[ 1123.168836] Bluetooth: BNEP filters: protocol multicast
[ 1123.168853] Bluetooth: BNEP socket layer initialized
[ 1123.280483] Bluetooth: RFCOMM TTY layer initialized
[ 1123.280507] Bluetooth: RFCOMM socket layer initialized
[ 1123.280522] Bluetooth: RFCOMM ver 1.11
[ 1730.024587] Bluetooth: hci0: command 0x0401 tx timeout
[ 1777.448773] Bluetooth: hci0: command 0x0405 tx timeout
[ 1898.121350] Bluetooth: hci0: command 0x0408 tx timeout
[ 1903.049352] Bluetooth: hci0: command 0x0401 tx timeout

name@laptop:~$ dmesg | grep -i 'usb 4-3'
[ 1121.664846] usb 4-3: new full-speed USB device number 3 using ohci-pci
[ 1121.863415] usb 4-3: New USB device found, idVendor=0a12, idProduct=0001, bcdDevice=25.20
[ 1121.863424] usb 4-3: New USB device strings: Mfr=0, Product=2, SerialNumber=0
[ 1121.863429] usb 4-3: Product: CSR8510 A10

dmesg 2

[ 1121.664846] usb 4-3: new full-speed USB device number 3 using ohci-pci
[ 1121.863415] usb 4-3: New USB device found, idVendor=0a12, idProduct=0001, bcdDevice=25.20
[ 1121.863424] usb 4-3: New USB device strings: Mfr=0, Product=2, SerialNumber=0
[ 1121.863429] usb 4-3: Product: CSR8510 A10
[ 1123.021845] usbcore: registered new interface driver btusb
[ 1123.168832] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[ 1123.168836] Bluetooth: BNEP filters: protocol multicast
[ 1123.168853] Bluetooth: BNEP socket layer initialized
[ 1123.189898] NET: Registered protocol family 38
[ 1123.280483] Bluetooth: RFCOMM TTY layer initialized
[ 1123.280507] Bluetooth: RFCOMM socket layer initialized
[ 1123.280522] Bluetooth: RFCOMM ver 1.11
[ 1730.024587] Bluetooth: hci0: command 0x0401 tx timeout
[ 1777.448773] Bluetooth: hci0: command 0x0405 tx timeout
[ 1898.121350] Bluetooth: hci0: command 0x0408 tx timeout
[ 1903.049352] Bluetooth: hci0: command 0x0401 tx timeout

HC配置

name@laptop:~$ sudo hciconfig -a
hci0:   Type: Primary  Bus: USB
    BD Address: 00:1A:7D:DA:71:10  ACL MTU: 310:4  SCO MTU: 64:8
    UP RUNNING PSCAN ISCAN 
    RX bytes:714 acl:0 sco:0 events:52 errors:0
    TX bytes:3124 acl:0 sco:0 commands:52 errors:0
    Features: 0xff 0xff 0x8f 0xfa 0xdb 0xff 0x5b 0x87
    Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3 
    Link policy: RSWITCH HOLD SNIFF PARK 
    Link mode: SLAVE ACCEPT 
Can't read local name on hci0: Connection timed out (110)

name@laptop:~$ sudo hciconfig hci0 piscan
Can't set scan mode on hci0: Connection timed out (110)

usb 设备

T:  Bus=04 Lev=01 Prnt=01 Port=02 Cnt=02 Dev#=  4 Spd=12  MxCh= 0
D:  Ver= 2.00 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs=  1
P:  Vendor=0a12 ProdID=0001 Rev=25.20
S:  Product=CSR8510 A10
C:  #Ifs= 2 Cfg#= 1 Atr=a0 MxPwr=100mA
I:  If#=0x0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
I:  If#=0x1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb

杀戮

name@laptop:~$ sudo rfkill list
1: hci0: Bluetooth
    Soft blocked: no
    Hard blocked: no

宝塔面板

terminal 1
name@laptop:~$ sudo hciconfig hci0 down
name@laptop:~$ sudo hciconfig hci0 up
Can't init device hci0: Connection timed out (110)
name@laptop:~$ 

terminal2
name@laptop:~$ sudo btmon 
[sudo] пароль до name: 
Bluetooth monitor ver 5.53
= Note: Linux version 5.4.0-62-generic (x86_64)                        0.409168
= Note: Bluetooth subsystem version 2.22                               0.409175
= New Index: 00:1A:7D:DA:71:10 (Primary,USB,hci0)               [hci0] 0.409178
@ MGMT Open: bluetoothd (privileged) version 1.14             {0x0001} 0.409181
@ MGMT Open: btmon (privileged) version 1.14                  {0x0002} 0.409218
@ RAW Open: hciconfig (privileged) version 2.22              {0x0003} 12.005247
@ RAW Close: hciconfig                                       {0x0003} 12.005303
@ RAW Open: hciconfig (privileged) version 2.22              {0x0003} 18.308064
= Open Index: 00:1A:7D:DA:71:10                                [hci0] 18.374266
< HCI Command: Reset (0x03|0x0003) plen 0                   #1 [hci0] 18.374345
= Close Index: 00:1A:7D:DA:71:10                               [hci0] 28.425934
@ RAW Close: hciconfig                                       {0x0003} 28.429311

/sys/内核/调试/usb/设备

T:  Bus=04 Lev=01 Prnt=01 Port=02 Cnt=02 Dev#=  4 Spd=12   MxCh= 0
D:  Ver= 2.00 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs=  1
P:  Vendor=0a12 ProdID=0001 Rev=25.20
S:  Product=CSR8510 A10
C:* #Ifs= 2 Cfg#= 1 Atr=a0 MxPwr=100mA
I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E:  Ad=83(I) Atr=03(Int.) MxPS=  16 Ivl=1ms
E:  Ad=01(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=81(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E:  Ad=02(O) Atr=01(Isoc) MxPS=   0 Ivl=1ms
E:  Ad=82(I) Atr=01(Isoc) MxPS=   0 Ivl=1ms
I:  If#= 1 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E:  Ad=02(O) Atr=01(Isoc) MxPS=   9 Ivl=1ms
E:  Ad=82(I) Atr=01(Isoc) MxPS=   9 Ivl=1ms
I:  If#= 1 Alt= 2 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E:  Ad=02(O) Atr=01(Isoc) MxPS=  17 Ivl=1ms
E:  Ad=82(I) Atr=01(Isoc) MxPS=  17 Ivl=1ms
I:  If#= 1 Alt= 3 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E:  Ad=02(O) Atr=01(Isoc) MxPS=  25 Ivl=1ms
E:  Ad=82(I) Atr=01(Isoc) MxPS=  25 Ivl=1ms
I:  If#= 1 Alt= 4 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E:  Ad=02(O) Atr=01(Isoc) MxPS=  33 Ivl=1ms
E:  Ad=82(I) Atr=01(Isoc) MxPS=  33 Ivl=1ms
I:  If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E:  Ad=02(O) Atr=01(Isoc) MxPS=  49 Ivl=1ms
E:  Ad=82(I) Atr=01(Isoc) MxPS=  49 Ivl=1ms

连接蓝牙时 btmon

问题:

  1. 无法启动发现:org.bluez.Error.InProgress
  2. 无法停止发现:org.bluez.Error.InProgress
  3. 配对失败:org.bluez.Error.AuthenticationCanceled
  4. 命令 0x0401 tx 超时
  5. 无法读取 hci0 上的本地名称:连接超时(110)
  6. 无法在 hci0 上设置扫描模式:连接超时(110)

也许有同样的问题

相关内容