"连接超时(100)"尝试设置蓝牙PAN时

时间:2017-08-10 15:25:50

标签: bluetooth embedded embedded-linux raspberry-pi3 bluez

我试图在两个Linux系统之间设置蓝牙PAN。我在两台运行BlueZ 5.23的Raspberry Pi 3之间工作。但是,当我尝试连接运行BlueZ 4.101的其他Linux系统时,我收到此错误:

pand[27746]: Connect to B8:27:EB:6C:CE:26 failed. Connection timed out(110)

我已经成功地让两个BlueZ 4.101系统相互通信,但是当我试图让它与我的Pi3 NAP通话时,它始终失败并出现错误。不幸的是,旧版本的BlueZ运行在一个非常小的嵌入式系统上,我无法轻松地在其上运行hcidump。但是,我确实有两个不同尝试与Pi3交谈的hcidump输出:

这是从另一个Pi3连接的成功尝试:

HCI sniffer - Bluetooth packet analyzer ver 5.45 btsnoop version: 1 datalink type: 1002
> HCI Event: Connect Request (0x04) plen 10
    bdaddr B8:27:EB:99:1C:22 class 0x000000 type ACL < HCI Command: Accept Connection Request (0x01|0x0009) plen 7
    bdaddr B8:27:EB:99:1C:22 role 0x00
    Role: Master
> HCI Event: Command Status (0x0f) plen 4
    Accept Connection Request (0x01|0x0009) status 0x00 ncmd 1
> HCI Event: Role Change (0x12) plen 8
    status 0x00 bdaddr B8:27:EB:99:1C:22 role 0x00
    Role: Master
> HCI Event: Connect Complete (0x03) plen 11
    status 0x00 handle 12 bdaddr B8:27:EB:99:1C:22 type ACL encrypt 0x00 < HCI Command: Read Remote Supported Features (0x01|0x001b) plen 2
    handle 12
> HCI Event: Command Status (0x0f) plen 4
    Read Remote Supported Features (0x01|0x001b) status 0x00 ncmd 1
> HCI Event: Read Remote Supported Features (0x0b) plen 11
    status 0x00 handle 12
    Features: 0xbf 0xfe 0xcf 0xfe 0xdb 0xff 0x7b 0x87 < HCI Command: Read Remote Extended Features (0x01|0x001c) plen 3
    handle 12 page 1
> HCI Event: Command Status (0x0f) plen 4
    Read Remote Extended Features (0x01|0x001c) status 0x00 ncmd 1
> HCI Event: Read Remote Extended Features (0x23) plen 13
    status 0x00 handle 12 page 1 max 2
    Features: 0x03 0x00 0x00 0x00 0x00 0x00 0x00 0x00 < HCI Command: Remote Name Request (0x01|0x0019) plen 10
    bdaddr B8:27:EB:99:1C:22 mode 2 clkoffset 0x0000 < ACL data: handle 12 flags 0x00 dlen 10
    L2CAP(s): Info req: type 2
> HCI Event: Max Slots Change (0x1b) plen 3
    handle 12 slots 5
> HCI Event: Command Status (0x0f) plen 4
    Remote Name Request (0x01|0x0019) status 0x00 ncmd 1
> ACL data: handle 12 flags 0x02 dlen 10
    L2CAP(s): Info req: type 2 < ACL data: handle 12 flags 0x00 dlen 16
    L2CAP(s): Info rsp: type 2 result 0
      Extended feature mask 0x02b8
        Enhanced Retransmission mode
        Streaming mode
        FCS Option
        Fixed Channels
        Unicast Connectless Data Reception
> HCI Event: Remote Name Req Complete (0x07) plen 255
    status 0x00 bdaddr B8:27:EB:99:1C:22 name 'raspberrypi'
> ACL data: handle 12 flags 0x02 dlen 16
    L2CAP(s): Info rsp: type 2 result 0
      Extended feature mask 0x02b8
        Enhanced Retransmission mode
        Streaming mode
        FCS Option
        Fixed Channels
        Unicast Connectless Data Reception < ACL data: handle 12 flags 0x00 dlen 10
    L2CAP(s): Info req: type 3
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 12 packets 2
> ACL data: handle 12 flags 0x02 dlen 10
    L2CAP(s): Info req: type 3 < ACL data: handle 12 flags 0x00 dlen 20
    L2CAP(s): Info rsp: type 3 result 0
      Fixed channel list 0x00000006
        L2CAP Signalling Channel
        L2CAP Connless
> ACL data: handle 12 flags 0x02 dlen 20
    L2CAP(s): Info rsp: type 3 result 0
      Fixed channel list 0x00000006
        L2CAP Signalling Channel
        L2CAP Connless
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 12 packets 2
> ACL data: handle 12 flags 0x02 dlen 12
    L2CAP(s): Connect req: psm 1 scid 0x0040 < ACL data: handle 12 flags 0x00 dlen 16
    L2CAP(s): Connect rsp: dcid 0x0040 scid 0x0040 result 0 status 0
      Connection successful < ACL data: handle 12 flags 0x00 dlen 23
    L2CAP(s): Config req: dcid 0x0040 flags 0x00 clen 11
      RFC 0x00 (Basic)

这是从运行BlueZ 4.101的系统连接失败的尝试:

> HCI Event: Connect Request (0x04) plen 10
    bdaddr 00:07:80:C0:D8:73 class 0x000000 type ACL
< HCI Command: Accept Connection Request (0x01|0x0009) plen 7
    bdaddr 00:07:80:C0:D8:73 role 0x00
    Role: Master
> HCI Event: Command Status (0x0f) plen 4
    Accept Connection Request (0x01|0x0009) status 0x00 ncmd 1
> HCI Event: Role Change (0x12) plen 8
    status 0x00 bdaddr 00:07:80:C0:D8:73 role 0x00
    Role: Master
> HCI Event: Connect Complete (0x03) plen 11
    status 0x00 handle 11 bdaddr 00:07:80:C0:D8:73 type ACL encrypt 0x00
< HCI Command: Read Remote Supported Features (0x01|0x001b) plen 2
    handle 11
> HCI Event: Command Status (0x0f) plen 4
    Read Remote Supported Features (0x01|0x001b) status 0x00 ncmd 1
> HCI Event: Read Remote Supported Features (0x0b) plen 11
    status 0x00 handle 11
    Features: 0xff 0xff 0x8f 0xfe 0xdb 0xff 0x5b 0x87
< HCI Command: Read Remote Extended Features (0x01|0x001c) plen 3
    handle 11 page 1
> HCI Event: Command Status (0x0f) plen 4
    Read Remote Extended Features (0x01|0x001c) status 0x00 ncmd 1
> HCI Event: Read Remote Extended Features (0x23) plen 13
    status 0x00 handle 11 page 1 max 1
    Features: 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00
< HCI Command: Remote Name Request (0x01|0x0019) plen 10
    bdaddr 00:07:80:C0:D8:73 mode 2 clkoffset 0x0000
< ACL data: handle 11 flags 0x00 dlen 10
    L2CAP(s): Info req: type 2
> HCI Event: Command Status (0x0f) plen 4
    Remote Name Request (0x01|0x0019) status 0x00 ncmd 1
> HCI Event: Max Slots Change (0x1b) plen 3
    handle 11 slots 5
> ACL data: handle 11 flags 0x02 dlen 16
    L2CAP(s): Info rsp: type 2 result 0
      Extended feature mask 0x00b8
        Enhanced Retransmission mode
        Streaming mode
        FCS Option
        Fixed Channels
< ACL data: handle 11 flags 0x00 dlen 10
    L2CAP(s): Info req: type 3
> HCI Event: Number of Completed Packets (0x13) plen 5
    handle 11 packets 2
> ACL data: handle 11 flags 0x02 dlen 20
    L2CAP(s): Info rsp: type 3 result 0
      Fixed channel list 0x00000002
        L2CAP Signalling Channel
> HCI Event: Remote Name Req Complete (0x07) plen 255
    status 0x00 bdaddr 00:07:80:C0:D8:73 name 'BT111'
> HCI Event: Disconn Complete (0x05) plen 4
    status 0x00 handle 11 reason 0x13
    Reason: Remote User Terminated Connection

没有时间戳,但最后到Disconn Complete事件的所有事情发生得非常快,然后暂停了大约30秒。

显然,4.101上的PANU正在等待什么,但我不知道什么,我不知道在哪里寻找它可能是什么。我在转储中看到的唯一其他差异是:

  • 手柄是11合1和12在另一个。
  • Read Remote Extended Features事件返回不同的功能集。 (0x03后跟7 0字节,而不是0x01)
  • 在其L2CAP扩展功能掩码中成功支持Unicast Connectless Data Reception的那个。

我认为不同的句柄并不重要。我用谷歌搜索了扩展功能的解码器环,但是找不到任何看似映射到我所看到的内容的东西。不过有点不同。也许这就是神奇的一点。

我还注意到pi-pi连接使用了SDP,并且sdpd没有在我的小型嵌入式系统上运行。

我可以找到Unicast Connectless Data Reception的唯一引用是在PTS提交中。我现在对BT认证不感兴趣。

无论如何,似乎我需要蓝牙专家(我不是)来解释发生了什么以及为什么我的连接无法正常工作。

1 个答案:

答案 0 :(得分:0)

事实证明,问题是两台设备没有配对。配对覆盆子pi让一切运行良好。

为了让嵌入式主板与pi配对,我必须在/etc/bluetooth/hcid.conf中使用适当的配置运行bluetoothd,运行hciconfig hci0 piscan,然后从pi中运行蓝牙:

scan on
scan off # after waiting until I saw the device's mac
pair <MAC address>
trust <MAC address>