尝试设置蓝牙PAN时出现“连接超时(100)”

问题描述:

我试图在两个Linux系统之间设置蓝牙PAN。我已经在两个Raspberry Pi 3s之间工作,都运行BlueZ 5.23。然而,当我尝试连接一个不同的Linux系统中运行的BlueZ 4.101,我得到这个错误:尝试设置蓝牙PAN时出现“连接超时(100)”

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

我已经成功地得到了2周的BlueZ 4.101系统相互交谈,但一直未能与错误,当我尝试让它与我的Pi3 NAP交谈。不幸的是,老版本的BlueZ运行在一个非常小的嵌入式系统上,我无法轻松地在其上运行hcidump。然而,我确实有hcidump输出两个不同的尝试去跟PI3:

这是一次成功的尝试从另一个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 

有没有时间标记,但一切都交给在最后发生的很快,那么它停顿约30秒的Disconn Complete事件。

显然,4.101上的PANU正在等待某件事,但我不知道该怎么做,也不知道该在哪里寻找它。我在转储中看到的唯一其他区别是:

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

我认为手柄的不同并不重要。我搜索了解扩展功能的解码器环,但没有找到任何看起来像它映射到我所看到的东西。虽然有1位的差异。也许这就是魔术。

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

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

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

事实证明,问题是两个设备没有配对。与树莓派配对让一切运行良好。

为了得到嵌入板配对到PI,我不得不在其上具有适当的配置在/etc/bluetooth/hcid.conf运行bluetoothd,运行hciconfig hci0 piscan,并在bluetoothctl来自PI运行此:

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