蓝牙无法自动连接

蓝牙无法自动连接

我使用的是 Ubuntu 14.04,一切运行正常。但决定升级到 16.04。(真是个错误!)

现在我的耳机无法再连接到机器了。这有点奇怪。它有时能用,有时根本就不能用。

当我打开耳机时,它会尝试连接几次然后放弃。以下是日志:

Bluetooth monitor ver 5.37
= New Index: 00:09:DD:50:23:47 (BR/EDR,USB,hci0)                                                                                                                                                                             [hci0] 0.768776
= Open Index: 00:09:DD:50:23:47                                                                                                                                                                                              [hci0] 0.768778
= Index Info: 00:09:DD:50:23:47 (Cambridge Silicon Radio)                                                                                                                                                                    [hci0] 0.768778
> HCI Event: Connect Request (0x04) plen 10                                                                                                                                                                                  [hci0] 9.812387
        Address: 00:0D:FD:35:78:D1 (Huges Hi-Tech Inc.,)
        Class: 0x240404
          Major class: Audio/Video (headset, speaker, stereo, video, vcr)
          Minor class: Wearable Headset Device
          Rendering (Printing, Speaker)
          Audio (Speaker, Microphone, Headset)
        Link type: ACL (0x01)
< HCI Command: Accept Connection Request (0x01|0x0009) plen 7                                                                                                                                                                [hci0] 9.812416
        Address: 00:0D:FD:35:78:D1 (Huges Hi-Tech Inc.,)
        Role: Master (0x00)
> HCI Event: Command Status (0x0f) plen 4                                                                                                                                                                                    [hci0] 9.816389
      Accept Connection Request (0x01|0x0009) ncmd 1
        Status: Success (0x00)
> HCI Event: Role Change (0x12) plen 8                                                                                                                                                                                       [hci0] 9.975428
        Status: Success (0x00)
        Address: 00:0D:FD:35:78:D1 (Huges Hi-Tech Inc.,)
        Role: Master (0x00)
> HCI Event: Connect Complete (0x03) plen 11                                                                                                                                                                                [hci0] 10.003463
        Status: Success (0x00)
        Handle: 42
        Address: 00:0D:FD:35:78:D1 (Huges Hi-Tech Inc.,)
        Link type: ACL (0x01)
        Encryption: Disabled (0x00)
< HCI Command: Read Remote Supported Features (0x01|0x001b) plen 2                                                                                                                                                          [hci0] 10.003643
        Handle: 42
> HCI Event: Page Scan Repetition Mode Change (0x20) plen 7                                                                                                                                                                 [hci0] 10.005383
        Address: 00:0D:FD:35:78:D1 (Huges Hi-Tech Inc.,)
        Page scan repetition mode: R1 (0x01)
> HCI Event: Command Status (0x0f) plen 4                                                                                                                                                                                   [hci0] 10.006375
      Read Remote Supported Features (0x01|0x001b) ncmd 0
        Status: Success (0x00)
> HCI Event: Max Slots Change (0x1b) plen 3                                                                                                                                                                                 [hci0] 10.025427
        Handle: 42
        Max slots: 5
> HCI Event: Command Status (0x0f) plen 4                                                                                                                                                                                   [hci0] 10.030425
      NOP (0x00|0x0000) ncmd 1
        Status: Success (0x00)
> HCI Event: Read Remote Supported Features (0x0b) plen 11                                                                                                                                                                  [hci0] 10.045425
        Status: Success (0x00)
        Handle: 42
        Features: 0xff 0xfe 0x0f 0x86 0x8b 0xa9 0x00 0x00
          3 slot packets
          5 slot packets
          Encryption
          Slot offset
          Timing accuracy
          Role switch
          Hold mode
          Sniff mode
          Power control requests
          Channel quality driven data rate (CQDDR)
          SCO link
          HV2 packets
          HV3 packets
          u-law log synchronous data
          A-law log synchronous data
          CVSD synchronous data
          Paging parameter negotiation
          Power control
          Transparent synchronous data
          Enhanced Data Rate ACL 2 Mbps mode
          Enhanced Data Rate ACL 3 Mbps mode
          Extended SCO link (EV3 packets)
          EV4 packets
          EV5 packets
          AFH capable slave
          3-slot Enhanced Data Rate ACL packets
          5-slot Enhanced Data Rate ACL packets
          AFH capable master
          Enhanced Data Rate eSCO 2 Mbps mode
          3-slot Enhanced Data Rate eSCO packets
< HCI Command: Remote Name Request (0x01|0x0019) plen 10                                                                                                                                                                    [hci0] 10.045568
        Address: 00:0D:FD:35:78:D1 (Huges Hi-Tech Inc.,)
        Page scan repetition mode: R2 (0x02)
        Page scan mode: Mandatory (0x00)
        Clock offset: 0x0000
< ACL Data TX: Handle 42 flags 0x02 dlen 10                                                                                                                                                                                 [hci0] 10.045584
      L2CAP: Information Request (0x0a) ident 1 len 2
        Type: Extended features supported (0x0002)
> HCI Event: Command Status (0x0f) plen 4                                                                                                                                                                                   [hci0] 10.049382
      Remote Name Request (0x01|0x0019) ncmd 1
        Status: Success (0x00)
> HCI Event: Number of Completed Packets (0x13) plen 5                                                                                                                                                                      [hci0] 10.052379
        Num handles: 1
        Handle: 42
        Count: 1
> ACL Data RX: Handle 42 flags 0x02 dlen 16                                                                                                                                                                                 [hci0] 10.062426
      L2CAP: Information Response (0x0b) ident 1 len 8
        Type: Extended features supported (0x0002)
        Result: Success (0x0000)
        Features: 0x00000000
> HCI Event: Remote Name Req Complete (0x07) plen 255                                                                                                                                                                       [hci0] 10.090378
        Status: Success (0x00)
        Address: 00:0D:FD:35:78:D1 (Huges Hi-Tech Inc.,)
        Name: Motorola S305
@ Device Connected: 00:0D:FD:35:78:D1 (0) flags 0x0000
        0e 09 4d 6f 74 6f 72 6f 6c 61 20 53 33 30 35 04  ..Motorola S305.
        0d 04 04 24                                      ...$
> HCI Event: Link Key Request (0x17) plen 6                                                                                                                                                                                 [hci0] 10.117428
        Address: 00:0D:FD:35:78:D1 (Huges Hi-Tech Inc.,)
< HCI Command: Link Key Request Reply (0x01|0x000b) plen 22                                                                                                                                                                 [hci0] 10.117558
        Address: 00:0D:FD:35:78:D1 (Huges Hi-Tech Inc.,)
        Link key: 8c794e46252db0e365fc8a05d5cc0fc2
> HCI Event: Command Complete (0x0e) plen 10                                                                                                                                                                                [hci0] 10.127423
      Link Key Request Reply (0x01|0x000b) ncmd 1
        Status: Success (0x00)
        Address: 00:0D:FD:35:78:D1 (Huges Hi-Tech Inc.,)
> ACL Data RX: Handle 42 flags 0x02 dlen 12                                                                                                                                                                                 [hci0] 10.242377
      L2CAP: Connection Request (0x02) ident 2 len 4
        PSM: 1 (0x0001)
        Source CID: 64
> HCI Event: Encryption Change (0x08) plen 4                                                                                                                                                                                [hci0] 10.242396
        Status: Success (0x00)
        Handle: 42
        Encryption: Enabled with E0 (0x01)
< ACL Data TX: Handle 42 flags 0x02 dlen 16                                                                                                                                                                                 [hci0] 10.242499
      L2CAP: Connection Response (0x03) ident 2 len 8
        Destination CID: 64
        Source CID: 64
        Result: Connection successful (0x0000)
        Status: No further information available (0x0000)
< ACL Data TX: Handle 42 flags 0x02 dlen 12                                                                                                                                                                                 [hci0] 10.242511
      L2CAP: Configure Request (0x04) ident 2 len 4
        Destination CID: 64
        Flags: 0x0000
> HCI Event: Number of Completed Packets (0x13) plen 5                                                                                                                                                                      [hci0] 10.248419
        Num handles: 1
        Handle: 42
        Count: 1
> HCI Event: Number of Completed Packets (0x13) plen 5                                                                                                                                                                      [hci0] 10.249372
        Num handles: 1
        Handle: 42
        Count: 1
> ACL Data RX: Handle 42 flags 0x02 dlen 16                                                                                                                                                                                 [hci0] 10.257424
      L2CAP: Configure Request (0x04) ident 3 len 8
        Destination CID: 64
        Flags: 0x0000
        Option: Maximum Transmission Unit (0x01) [mandatory]
          MTU: 48
< ACL Data TX: Handle 42 flags 0x02 dlen 18                                                                                                                                                                                 [hci0] 10.257557
      L2CAP: Configure Response (0x05) ident 3 len 10
        Source CID: 64
        Flags: 0x0000
        Result: Success (0x0000)
        Option: Maximum Transmission Unit (0x01) [mandatory]
          MTU: 48
> ACL Data RX: Handle 42 flags 0x02 dlen 14                                                                                                                                                                                 [hci0] 10.260373
      L2CAP: Configure Response (0x05) ident 2 len 6
        Source CID: 64
        Flags: 0x0000
        Result: Success (0x0000)
> HCI Event: Number of Completed Packets (0x13) plen 5                                                                                                                                                                      [hci0] 10.263420
        Num handles: 1
        Handle: 42
        Count: 1
> ACL Data RX: Handle 42 flags 0x02 dlen 24                                                                                                                                                                                 [hci0] 10.273419
      Channel: 64 len 20 [PSM 1 mode 0] {chan 0}
      SDP: Service Search Attribute Request (0x06) tid 1 len 15
        Search pattern: [len 7]
          Sequence (6) with 5 bytes [8 extra bits] len 7
            UUID (3) with 4 bytes [0 extra bits] len 5
              Handsfree Audio Gateway (0x0000111f)
        Max record count: 38
        Attribute list: [len 5]
          Sequence (6) with 3 bytes [8 extra bits] len 5
            Unsigned Integer (1) with 2 bytes [0 extra bits] len 3
              0x0004
        Continuation state: 0
< ACL Data TX: Handle 42 flags 0x02 dlen 14                                                                                                                                                                                 [hci0] 10.273695
      Channel: 64 len 10 [PSM 1 mode 0] {chan 0}
      SDP: Service Search Attribute Response (0x07) tid 1 len 5
        Attribute bytes: 2
        Continuation state: 0
> HCI Event: Number of Completed Packets (0x13) plen 5                                                                                                                                                                      [hci0] 10.279418
        Num handles: 1
        Handle: 42
        Count: 1
> ACL Data RX: Handle 42 flags 0x02 dlen 12                                                                                                                                                                                 [hci0] 10.287414
      L2CAP: Disconnection Request (0x06) ident 4 len 4
        Destination CID: 64
        Source CID: 64
< ACL Data TX: Handle 42 flags 0x02 dlen 12                                                                                                                                                                                 [hci0] 10.287547
      L2CAP: Disconnection Response (0x07) ident 4 len 4
        Destination CID: 64
        Source CID: 64
> HCI Event: Number of Completed Packets (0x13) plen 5                                                                                                                                                                      [hci0] 10.293420
        Num handles: 1
        Handle: 42
        Count: 1
> HCI Event: Disconnect Complete (0x05) plen 4                                                                                                                                                                              [hci0] 10.704410
        Status: Success (0x00)
        Handle: 42
        Reason: Remote User Terminated Connection (0x13)
@ Device Disconnected: 00:0D:FD:35:78:D1 (0) reason 3

这会重复几次才会放弃但如果我使用 bluetoothctl 手动连接到耳机,那么 ubuntu 就会直接连接到它。(不幸的是,日志不适合可用的问题空间)在此初始连接之后,如果我通过关闭和打开耳机来断开/重新连接,它似乎可以工作......

有什么想法吗?谢谢!

更新: 现在它运行正常,无需安装 blueman 或 gnome-bluetooth。BlueZ 和 PulseAudio 已安装。我将我的 conf 文件中的内容放在这里,希望将来能对某些人有所帮助。(我只放了我更改的设置)

蓝牙/main.conf

DiscoverableTimeout = 0
AutoEnable=true

pulseaudio/default.pa

# automatically switch to newly-connected devices
load-module module-switch-on-connec

我不太明白为什么一开始它不起作用。这很奇怪,因为我认为我以前也有同样的设置。一旦蓝牙设备连接,我就使用脚本切换到 a2dp(我不确定这是否在 16.05 中得到修复,但它在 14.04 中是一个问题)

相关内容