首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Bluez不能永久连接到蓝牙LE遥控器“未实现的功能(38)”

Bluez不能永久连接到蓝牙LE遥控器“未实现的功能(38)”
EN

Stack Overflow用户
提问于 2021-06-30 22:03:22
回答 1查看 3.1K关注 0票数 2

我有一个新的恶棍形象:

Linux立体声5.10.17+ #1414星期五4月30日13:16:27 BST2021 armv6l GNU/Linux

我确实把布吕兹更新到了bluez 5.52。已经很有趣的是,我的/var/log/syslog中有以下条目

6月30日23:15:09立体定向bluetoothd557:蓝牙守护进程5.50

这似乎表明,以前安装的5.50版本仍然存在。

我在其他机器上做了同样的设置,然后我就可以让它开始工作了,但这一次似乎有问题。

现在,使用蓝牙can,我可以看到我的设备并对它进行配对,但是连接立即断开:

代码语言:javascript
运行
复制
[bluetooth]# trust 84:EB:18:0C:92:0F 
Changing 84:EB:18:0C:92:0F trust succeeded
[bluetooth]# pair 84:EB:18:0C:92:0F 
Attempting to pair with 84:EB:18:0C:92:0F
[CHG] Device 84:EB:18:0C:92:0F Connected: yes
Failed to pair: org.bluez.Error.AuthenticationFailed
[CHG] Device 84:EB:18:0C:92:0F Connected: no
[bluetooth]# connect 84:EB:18:0C:92:0F 
Attempting to connect to 84:EB:18:0C:92:0F
[CHG] Device 84:EB:18:0C:92:0F Connected: yes
Failed to connect: org.bluez.Error.Failed
[CHG] Device 84:EB:18:0C:92:0F Connected: no

当我签入日志时,我确实看到了以下内容:

代码语言:javascript
运行
复制
Jun 30 23:15:53 stereopida bluetoothd[567]: src/device.c:bonding_request_new() Requesting bonding for 84:EB:18:0C:92:0F
Jun 30 23:15:53 stereopida bluetoothd[567]: src/agent.c:agent_ref() 0x7b62b0: ref=3
Jun 30 23:15:53 stereopida bluetoothd[567]: src/agent.c:agent_unref() 0x7b62b0: ref=2
Jun 30 23:15:53 stereopida bluetoothd[567]: src/adapter.c:suspend_discovery() 
Jun 30 23:15:53 stereopida bluetoothd[567]: src/adapter.c:adapter_bonding_attempt() hci0 bdaddr 84:EB:18:0C:92:0F type 1 io_cap 0x04
Jun 30 23:15:55 stereopida bluetoothd[567]: src/adapter.c:connected_callback() hci0 device 84:EB:18:0C:92:0F connected eir_len 13
Jun 30 23:15:55 stereopida bluetoothd[567]: src/adapter.c:pair_device_complete() Failed (0x03)
Jun 30 23:15:55 stereopida bluetoothd[567]: src/adapter.c:bonding_attempt_complete() hci0 bdaddr 84:EB:18:0C:92:0F type 1 status 0x3
Jun 30 23:15:55 stereopida bluetoothd[567]: src/device.c:device_bonding_complete() bonding 0x7ba428 status 0x03
Jun 30 23:15:55 stereopida bluetoothd[567]: src/device.c:device_bonding_failed() status 3
Jun 30 23:15:55 stereopida bluetoothd[567]: src/agent.c:agent_unref() 0x7b62b0: ref=1
Jun 30 23:15:55 stereopida bluetoothd[567]: src/adapter.c:resume_discovery() 
Jun 30 23:15:55 stereopida bluetoothd[567]: src/adapter.c:dev_disconnected() Device 84:EB:18:0C:92:0F disconnected, reason 0
Jun 30 23:15:55 stereopida bluetoothd[567]: src/adapter.c:adapter_remove_connection() 
Jun 30 23:15:55 stereopida bluetoothd[567]: plugins/policy.c:disconnect_cb() reason 0
Jun 30 23:15:55 stereopida bluetoothd[567]: src/adapter.c:bonding_attempt_complete() hci0 bdaddr 84:EB:18:0C:92:0F type 1 status 0xe
Jun 30 23:15:55 stereopida bluetoothd[567]: src/device.c:device_bonding_complete() bonding (nil) status 0x0e
Jun 30 23:15:55 stereopida bluetoothd[567]: src/device.c:device_bonding_failed() status 14
Jun 30 23:15:55 stereopida bluetoothd[567]: src/adapter.c:resume_discovery() 
Jun 30 23:16:04 stereopida bluetoothd[567]: src/device.c:device_connect_le() Connection attempt to: 84:EB:18:0C:92:0F
Jun 30 23:16:08 stereopida systemd[1]: systemd-hostnamed.service: Succeeded.
Jun 30 23:16:09 stereopida bluetoothd[567]: src/adapter.c:connected_callback() hci0 device 84:EB:18:0C:92:0F connected eir_len 13
Jun 30 23:16:09 stereopida bluetoothd[567]: src/device.c:att_connect_cb() connect error: Function not implemented (38)
Jun 30 23:16:09 stereopida bluetoothd[567]: src/adapter.c:dev_disconnected() Device 84:EB:18:0C:92:0F disconnected, reason 0
Jun 30 23:16:09 stereopida bluetoothd[567]: src/adapter.c:adapter_remove_connection() 
Jun 30 23:16:09 stereopida bluetoothd[567]: plugins/policy.c:disconnect_cb() reason 0
Jun 30 23:16:09 stereopida bluetoothd[567]: src/adapter.c:bonding_attempt_complete() hci0 bdaddr 84:EB:18:0C:92:0F type 1 status 0xe
Jun 30 23:16:09 stereopida bluetoothd[567]: src/device.c:device_bonding_complete() bonding (nil) status 0x0e
Jun 30 23:16:09 stereopida bluetoothd[567]: src/device.c:device_bonding_failed() status 14
Jun 30 23:16:09 stereopida bluetoothd[567]: src/adapter.c:resume_discovery() 
Jun 30 23:16:15 stereopida bluetoothd[567]: src/agent.c:agent_disconnect() Agent :1.20 disconnected
Jun 30 23:16:15 stereopida bluetoothd[567]: src/agent.c:agent_destroy() agent :1.20
Jun 30 23:16:15 stereopida bluetoothd[567]: src/agent.c:agent_unref() 0x7b62b0: ref=0

在我的/etc/bluetooth/main.conf文件中,我确实做了以下更改:

代码语言:javascript
运行
复制
DiscoverableTimeout = 0
PairableTimeout = 0
ControllerMode = le
Privacy = off

我bluetooth.service中的bluetooth.service部分确实更改为以下内容:

代码语言:javascript
运行
复制
ExecStart=/usr/lib/bluetooth/bluetoothd --noplugin=sap -E 

加特工具

代码语言:javascript
运行
复制
sudo gatttool -b 84:EB:18:0C:92:0F --interactive
[84:EB:18:0C:92:0F][LE]> connect
Attempting to connect to 84:EB:18:0C:92:0F
Error: connect error: Function not implemented (38)

贝特蒙

当我使用Gattool连接时,这是sudo btmon的输出

代码语言:javascript
运行
复制
 sudo btmon
Bluetooth monitor ver 5.52
= Note: Linux version 5.10.17+ (armv6l)                                                                                                                                                            0.137356
= Note: Bluetooth subsystem version 2.22                                                                                                                                                           0.137373
= New Index: B8:27:EB:BD:CA:1B (Primary,UART,hci0)                                                                                                                                          [hci0] 0.137378
= Open Index: B8:27:EB:BD:CA:1B                                                                                                                                                             [hci0] 0.137386
= Index Info: B8:27:EB:BD:CA:1B (Broadcom Corporation)                                                                                                                                      [hci0] 0.137390
@ MGMT Open: bluetoothd (privileged) version 1.18                                                                                                                                         {0x0001} 0.137396
@ MGMT Open: btmon (privileged) version 1.18                                                                                                                                              {0x0002} 0.139895
< HCI Command: LE Set Scan Parameters (0x08|0x000b) plen 7                                                                                                                               #1 [hci0] 9.320332
        Type: Passive (0x00)
        Interval: 60.000 msec (0x0060)
        Window: 60.000 msec (0x0060)
        Own address type: Public (0x00)
        Filter policy: Ignore not in white list (0x01)
> HCI Event: Command Complete (0x0e) plen 4                                                                                                                                              #2 [hci0] 9.321695
      LE Set Scan Parameters (0x08|0x000b) ncmd 1
        Status: Success (0x00)
< HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2                                                                                                                                   #3 [hci0] 9.321835
        Scanning: Enabled (0x01)
        Filter duplicates: Enabled (0x01)
> HCI Event: Command Complete (0x0e) plen 4                                                                                                                                              #4 [hci0] 9.324626
      LE Set Scan Enable (0x08|0x000c) ncmd 1
        Status: Success (0x00)
> HCI Event: LE Meta Event (0x3e) plen 25                                                                                                                                               #5 [hci0] 11.847196
      LE Advertising Report (0x02)
        Num reports: 1
        Event type: Connectable undirected - ADV_IND (0x00)
        Address type: Public (0x00)
        Address: 84:EB:18:0C:92:0F (Texas Instruments)
        Data length: 13
        Flags: 0x05
          LE Limited Discoverable Mode
          BR/EDR Not Supported
        Appearance: Human Interface Device (0x03c0)
        16-bit Service UUIDs (partial): 2 entries
          Human Interface Device (0x1812)
          Battery Service (0x180f)
        RSSI: -72 dBm (0xb8)
< HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2                                                                                                                                  #6 [hci0] 11.847369
        Scanning: Disabled (0x00)
        Filter duplicates: Disabled (0x00)
> HCI Event: Command Complete (0x0e) plen 4                                                                                                                                             #7 [hci0] 11.851192
      LE Set Scan Enable (0x08|0x000c) ncmd 1
        Status: Success (0x00)
< HCI Command: LE Create Connection (0x08|0x000d) plen 25                                                                                                                               #8 [hci0] 11.851310
        Scan interval: 60.000 msec (0x0060)
        Scan window: 60.000 msec (0x0060)
        Filter policy: White list is not used (0x00)
        Peer address type: Public (0x00)
        Peer address: 84:EB:18:0C:92:0F (Texas Instruments)
        Own address type: Public (0x00)
        Min connection interval: 30.00 msec (0x0018)
        Max connection interval: 50.00 msec (0x0028)
        Connection latency: 0 (0x0000)
        Supervision timeout: 420 msec (0x002a)
        Min connection length: 0.000 msec (0x0000)
        Max connection length: 0.000 msec (0x0000)
> HCI Event: Command Status (0x0f) plen 4                                                                                                                                               #9 [hci0] 11.852722
      LE Create Connection (0x08|0x000d) ncmd 1
        Status: Success (0x00)
> HCI Event: LE Meta Event (0x3e) plen 19                                                                                                                                              #10 [hci0] 11.869896
      LE Connection Complete (0x01)
        Status: Success (0x00)
        Handle: 64
        Role: Master (0x00)
        Peer address type: Public (0x00)
        Peer address: 84:EB:18:0C:92:0F (Texas Instruments)
        Connection interval: 48.75 msec (0x0027)
        Connection latency: 0 (0x0000)
        Supervision timeout: 420 msec (0x002a)
        Master clock accuracy: 0x00
@ MGMT Event: Device Connected (0x000b) plen 26                                                                                                                                   {0x0002} [hci0] 11.869988
        LE Address: 84:EB:18:0C:92:0F (Texas Instruments)
        Flags: 0x00000000
        Data length: 13
        Flags: 0x05
          LE Limited Discoverable Mode
          BR/EDR Not Supported
        Appearance: Human Interface Device (0x03c0)
        16-bit Service UUIDs (partial): 2 entries
          Human Interface Device (0x1812)
          Battery Service (0x180f)
@ MGMT Event: Device Connected (0x000b) plen 26                                                                                                                                   {0x0001} [hci0] 11.869988
        LE Address: 84:EB:18:0C:92:0F (Texas Instruments)
        Flags: 0x00000000
        Data length: 13
        Flags: 0x05
          LE Limited Discoverable Mode
          BR/EDR Not Supported
        Appearance: Human Interface Device (0x03c0)
        16-bit Service UUIDs (partial): 2 entries
          Human Interface Device (0x1812)
          Battery Service (0x180f)
< HCI Command: LE Read Remote Used Features (0x08|0x0016) plen 2                                                                                                                       #11 [hci0] 11.870350
        Handle: 64
> HCI Event: Command Status (0x0f) plen 4                                                                                                                                              #12 [hci0] 11.877612
      LE Read Remote Used Features (0x08|0x0016) ncmd 1
        Status: Success (0x00)
> HCI Event: LE Meta Event (0x3e) plen 12                                                                                                                                              #13 [hci0] 12.210580
      LE Read Remote Used Features (0x04)
        Status: Connection Failed to be Established (0x3e)
        Handle: 64
        Features: 0x1f 0x00 0x00 0x08 0x00 0x00 0x00 0x00
          LE Encryption
          Connection Parameter Request Procedure
          Extended Reject Indication
          Slave-initiated Features Exchange
          LE Ping
          Remote Public Key Validation
< HCI Command: Disconnect (0x01|0x0006) plen 3                                                                                                                                         #14 [hci0] 12.210756
        Handle: 64
        Reason: Remote User Terminated Connection (0x13)
> HCI Event: Disconnect Complete (0x05) plen 4                                                                                                                                         #15 [hci0] 12.214327
        Status: Success (0x00)
        Handle: 64
        Reason: Connection Failed to be Established (0x3e)
@ MGMT Event: Device Disconnected (0x000c) plen 8                                                                                                                                 {0x0002} [hci0] 12.214426
        LE Address: 84:EB:18:0C:92:0F (Texas Instruments)
        Reason: Unspecified (0x00)
@ MGMT Event: Device Disconnected (0x000c) plen 8                                                                                                                                 {0x0001} [hci0] 12.214426
        LE Address: 84:EB:18:0C:92:0F (Texas Instruments)
        Reason: Unspecified (0x00)
> HCI Event: Command Status (0x0f) plen 4                                                                                                                                              #16 [hci0] 12.214351
      Disconnect (0x01|0x0006) ncmd 1
        Status: Invalid HCI Command Parameters (0x12)

更新2:使用DBUS

我试图使用dbus-python-script进行连接,但得到了错误:

创建设备失败: org.bluez.Error.AuthenticationFailed

这是该尝试的btmon输出:

代码语言:javascript
运行
复制
$ sudo btmon
Bluetooth monitor ver 5.52
= Note: Linux version 5.10.17+ (armv6l)                                                     0.495323
= Note: Bluetooth subsystem version 2.22                                                    0.495341
= New Index: B8:27:EB:BD:CA:1B (Primary,UART,hci0)                                   [hci0] 0.495350
= Open Index: B8:27:EB:BD:CA:1B                                                      [hci0] 0.495355
= Index Info: B8:27:EB:BD:CA:1B (Broadcom Corporation)                               [hci0] 0.495361
@ MGMT Open: bluetoothd (privileged) version 1.18                                  {0x0001} 0.495370
@ MGMT Open: btmon (privileged) version 1.18                                       {0x0002} 0.495742
@ MGMT Command: Pair Device (0x0019) plen 8                                 {0x0001} [hci0] 7.479710
        LE Address: 84:EB:18:0C:92:0F (Texas Instruments)
        Capability: KeyboardDisplay (0x04)
< HCI Command: LE Set Scan Parameters (0x08|0x000b) plen 7                        #1 [hci0] 7.482368
        Type: Passive (0x00)
        Interval: 60.000 msec (0x0060)
        Window: 60.000 msec (0x0060)
        Own address type: Public (0x00)
        Filter policy: Ignore not in white list (0x01)
> HCI Event: Command Complete (0x0e) plen 4                                       #2 [hci0] 7.482814
      LE Set Scan Parameters (0x08|0x000b) ncmd 1
        Status: Success (0x00)
< HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2                            #3 [hci0] 7.482909
        Scanning: Enabled (0x01)
        Filter duplicates: Enabled (0x01)
> HCI Event: Command Complete (0x0e) plen 4                                       #4 [hci0] 7.483658
      LE Set Scan Enable (0x08|0x000c) ncmd 1
        Status: Success (0x00)
> HCI Event: LE Meta Event (0x3e) plen 25                                         #5 [hci0] 7.501439
      LE Advertising Report (0x02)
        Num reports: 1
        Event type: Connectable undirected - ADV_IND (0x00)
        Address type: Public (0x00)
        Address: 84:EB:18:0C:92:0F (Texas Instruments)
        Data length: 13
        Flags: 0x05
          LE Limited Discoverable Mode
          BR/EDR Not Supported
        Appearance: Human Interface Device (0x03c0)
        16-bit Service UUIDs (partial): 2 entries
          Human Interface Device (0x1812)
          Battery Service (0x180f)
        RSSI: -55 dBm (0xc9)
< HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2                            #6 [hci0] 7.501585
        Scanning: Disabled (0x00)
        Filter duplicates: Disabled (0x00)
> HCI Event: Command Complete (0x0e) plen 4                                       #7 [hci0] 7.505073
      LE Set Scan Enable (0x08|0x000c) ncmd 1
        Status: Success (0x00)
< HCI Command: LE Create Connection (0x08|0x000d) plen 25                         #8 [hci0] 7.505187
        Scan interval: 60.000 msec (0x0060)
        Scan window: 60.000 msec (0x0060)
        Filter policy: White list is not used (0x00)
        Peer address type: Public (0x00)
        Peer address: 84:EB:18:0C:92:0F (Texas Instruments)
        Own address type: Public (0x00)
        Min connection interval: 30.00 msec (0x0018)
        Max connection interval: 50.00 msec (0x0028)
        Connection latency: 0 (0x0000)
        Supervision timeout: 420 msec (0x002a)
        Min connection length: 0.000 msec (0x0000)
        Max connection length: 0.000 msec (0x0000)
> HCI Event: Command Status (0x0f) plen 4                                         #9 [hci0] 7.505940
      LE Create Connection (0x08|0x000d) ncmd 1
        Status: Success (0x00)
> HCI Event: LE Meta Event (0x3e) plen 19                                        #10 [hci0] 7.525258
      LE Connection Complete (0x01)
        Status: Success (0x00)
        Handle: 64
        Role: Master (0x00)
        Peer address type: Public (0x00)
        Peer address: 84:EB:18:0C:92:0F (Texas Instruments)
        Connection interval: 48.75 msec (0x0027)
        Connection latency: 0 (0x0000)
        Supervision timeout: 420 msec (0x002a)
        Master clock accuracy: 0x00
@ MGMT Event: Device Connected (0x000b) plen 26                             {0x0002} [hci0] 7.525347
        LE Address: 84:EB:18:0C:92:0F (Texas Instruments)
        Flags: 0x00000000
        Data length: 13
        Flags: 0x05
          LE Limited Discoverable Mode
          BR/EDR Not Supported
        Appearance: Human Interface Device (0x03c0)
        16-bit Service UUIDs (partial): 2 entries
          Human Interface Device (0x1812)
          Battery Service (0x180f)
@ MGMT Event: Device Connected (0x000b) plen 26                             {0x0001} [hci0] 7.525347
        LE Address: 84:EB:18:0C:92:0F (Texas Instruments)
        Flags: 0x00000000
        Data length: 13
        Flags: 0x05
          LE Limited Discoverable Mode
          BR/EDR Not Supported
        Appearance: Human Interface Device (0x03c0)
        16-bit Service UUIDs (partial): 2 entries
          Human Interface Device (0x1812)
          Battery Service (0x180f)
< HCI Command: LE Read Remote Used Features (0x08|0x0016) plen 2                 #11 [hci0] 7.525694
        Handle: 64
> HCI Event: Command Status (0x0f) plen 4                                        #12 [hci0] 7.527893
      LE Read Remote Used Features (0x08|0x0016) ncmd 1
        Status: Success (0x00)
> HCI Event: LE Meta Event (0x3e) plen 12                                        #13 [hci0] 7.837849
      LE Read Remote Used Features (0x04)
        Status: Connection Failed to be Established (0x3e)
        Handle: 64
        Features: 0x1f 0x00 0x00 0x08 0x00 0x00 0x00 0x00
          LE Encryption
          Connection Parameter Request Procedure
          Extended Reject Indication
          Slave-initiated Features Exchange
          LE Ping
          Remote Public Key Validation
@ MGMT Event: Command Complete (0x0001) plen 10                             {0x0001} [hci0] 7.837949
      Pair Device (0x0019) plen 7
        Status: Failed (0x03)
        LE Address: 84:EB:18:0C:92:0F (Texas Instruments)
> HCI Event: Disconnect Complete (0x05) plen 4                                   #14 [hci0] 7.843837
        Status: Success (0x00)
        Handle: 64
        Reason: Connection Failed to be Established (0x3e)
@ MGMT Event: Device Disconnected (0x000c) plen 8                           {0x0002} [hci0] 7.843928
        LE Address: 84:EB:18:0C:92:0F (Texas Instruments)
        Reason: Unspecified (0x00)
@ MGMT Event: Device Disconnected (0x000c) plen 8                           {0x0001} [hci0] 7.843928
        LE Address: 84:EB:18:0C:92:0F (Texas Instruments)
        Reason: Unspecified (0x00)

杀虫器

代码语言:javascript
运行
复制
sudo hcidump
HCI sniffer - Bluetooth packet analyzer ver 5.50
device: hci0 snap_len: 1500 filter: 0xffffffff
< HCI Command: LE Set Scan Parameters (0x08|0x000b) plen 7
    type 0x00 (passive)
    interval 60.000ms window 60.000ms
    own address: 0x00 (Public) policy: white list only
> HCI Event: Command Complete (0x0e) plen 4
    LE Set Scan Parameters (0x08|0x000b) ncmd 1
    status 0x00
< HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2
    value 0x01 (scanning enabled)
    filter duplicates 0x01 (enabled)
> HCI Event: Command Complete (0x0e) plen 4
    LE Set Scan Enable (0x08|0x000c) ncmd 1
    status 0x00
> HCI Event: LE Meta Event (0x3e) plen 25
    LE Advertising Report
      ADV_IND - Connectable undirected advertising (0)
      bdaddr 84:EB:18:0C:92:0F (Public)
      Flags: 0x05
      Unknown type 0x19 with 2 bytes data
      Shortened service classes: 0x1812 0x180f
      RSSI: -74
< HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2
    value 0x00 (scanning disabled)
    filter duplicates 0x00 (disabled)
> HCI Event: Command Complete (0x0e) plen 4
    LE Set Scan Enable (0x08|0x000c) ncmd 1
    status 0x00
< HCI Command: LE Create Connection (0x08|0x000d) plen 25
    bdaddr 84:EB:18:0C:92:0F type 0
    interval 96 window 96 initiator_filter 0
    own_bdaddr_type 0 min_interval 24 max_interval 40
    latency 0 supervision_to 42 min_ce 0 max_ce 0
> HCI Event: Command Status (0x0f) plen 4
    LE Create Connection (0x08|0x000d) status 0x00 ncmd 1
> HCI Event: LE Meta Event (0x3e) plen 19
    LE Connection Complete
      status 0x00 handle 64, role master
      bdaddr 84:EB:18:0C:92:0F (Public)
< HCI Command: LE Read Remote Used Features (0x08|0x0016) plen 2
> HCI Event: Command Status (0x0f) plen 4
    LE Read Remote Used Features (0x08|0x0016) status 0x00 ncmd 1
> HCI Event: LE Meta Event (0x3e) plen 12
    LE Read Remote Used Features Complete
      status 0x3e handle 64
      Error: Connection Failed to be Established
< HCI Command: Disconnect (0x01|0x0006) plen 3
    handle 64 reason 0x13
    Reason: Remote User Terminated Connection
> HCI Event: Disconn Complete (0x05) plen 4
    status 0x00 handle 64 reason 0x3e
    Reason: Connection Failed to be Established
> HCI Event: Command Status (0x0f) plen 4
    Disconnect (0x01|0x0006) status 0x12 ncmd 1
    Error: Invalid HCI Command Parameters
EN

回答 1

Stack Overflow用户

发布于 2021-07-08 11:50:18

让我们先确认一下这个。配对连接是两件完全不同的事情。如果不先配对,就不能进行连接。

现在正在使用蓝牙can,我可以看到我的设备并对它进行配对,但是连接立即被丢弃:

这个假设是错误的,你根本无法配对你的设备。我们可以从bluetoothctl和日志的输出中了解这一点。

Failed to pair: org.bluez.Error.AuthenticationFailed

src/adapter.c:pair_device_complete() Failed (0x03)

您将得到这个[CHG] Device 84:EB:18:0C:92:0F Connected: yes,即使您失败了配对。从问题标签,它似乎是试图建立一个蓝牙连接树莓Pi,但你设置ControllerMode = le。但是你也提到了,你已经用其他设备做了这件事,这让我很困惑。

我脑子里没有什么解决办法。一个接一个地试试:

如果您的设备是蓝牙经典,则connect.

  • Remove设置ControllerMode = dual,而不是BLE。如果它是一个BLE设备,则

  • 尝试使用gatttool(在5.50中工作):sudo gatttool -b 84:EB:18:0C:92:0F --interactive然后从源安装。不错的指南可用here.configure --enable-tools,以便您也可以尝试btgatt-client工具。(我从未尝试过这一点,但似乎possible).

  • Make肯定没有达到最大连接数。

  • 对于所有蓝牙连接,我总是使用D-Bus API,而不是使用命令行工具。但这并不是微不足道的。下面是一个很好的例子,available.

code

,我在其他机器上做了同样的设置,然后我可以让它开始工作,但这一次似乎出现了问题。

尝试另一个具有相同Pi的设备,弱连接也可能是原因之一。

如果这些没有帮助,请共享sudo btmon的输出。

更新

现在我们确定这是一个BLE设备,问题是外围(您的BLE远程)没有响应central (Pi) Status: Connection Failed to be Established (0x3e)

这将带我们进入我建议的6解决方案,@Emil here.很好地解释了这个问题。我也会引用已给出的答案(想想主人/中央(Pi)、奴隶/外围(BLE Remote)):

“未能建立连接”意味着,在主服务器发送CONNECT_IND以响应ADV_IND之后,从服务器似乎不响应主发送的任何数据包。这要么是由于某些硬件或固件故障、信号质量差,要么是外围设备使用白色列表来忽略来自不需要的设备的连接。没有发生此错误的其他原因。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68202067

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档