kurisaW / Summer-of-Open-Source

记录开源之夏
MIT License
5 stars 0 forks source link

【报错信息】No adapter available for new connection establishment #18

Closed kurisaW closed 1 year ago

kurisaW commented 1 year ago

在esp-matter下的example/light工程下,使用chip-tool 进行WIFI设备的调试,但是提示No adapter available for new connection establishment

报错日志 ```bash root@kurisaw-virtual-machine:/home/kurisaw/Desktop/esp/esp-matter/connectedhomeip/connectedhomeip# out/debug/chip-tool pairing ble-wifi 0x7283 507 h1144919 20202021 3840 [1683373191.779599][126514:126514] CHIP:DL: ChipLinuxStorage::Init: Using KVS config file: /tmp/chip_kvs [1683373191.832839][126514:126514] CHIP:DL: ChipLinuxStorage::Init: Using KVS config file: /tmp/chip_factory.ini [1683373191.840524][126514:126514] CHIP:DL: ChipLinuxStorage::Init: Using KVS config file: /tmp/chip_config.ini [1683373191.841617][126514:126514] CHIP:DL: ChipLinuxStorage::Init: Using KVS config file: /tmp/chip_counters.ini [1683373191.874888][126514:126514] CHIP:DL: writing settings to file (/tmp/chip_counters.ini-OaEbjq) [1683373191.875416][126514:126514] CHIP:DL: renamed tmp file to file (/tmp/chip_counters.ini) [1683373191.875874][126514:126514] CHIP:DL: NVS set: chip-counters/reboot-count = 38 (0x26) [1683373191.876415][126514:126514] CHIP:DL: Got Ethernet interface: ens33 [1683373191.876825][126514:126514] CHIP:DL: Found the primary Ethernet interface:ens33 [1683373191.877428][126514:126514] CHIP:DL: Failed to get WiFi interface [1683373191.877498][126514:126514] CHIP:DL: Failed to reset WiFi statistic counts [1683373191.878333][126514:126514] CHIP:IN: UDP::Init bind&listen port=0 [1683373191.878630][126514:126514] CHIP:IN: UDP::Init bound to port=54632 [1683373191.878675][126514:126514] CHIP:IN: UDP::Init bind&listen port=0 [1683373191.879647][126514:126514] CHIP:IN: UDP::Init bound to port=34175 [1683373191.879699][126514:126514] CHIP:IN: BLEBase::Init - setting/overriding transport [1683373191.879742][126514:126514] CHIP:IN: TransportMgr initialized [1683373191.880004][126514:126514] CHIP:FP: Initializing FabricTable from persistent storage [1683373191.881647][126514:126514] CHIP:TS: Last Known Good Time: 2023-05-06T16:48:59 [1683373191.897961][126514:126514] CHIP:FP: Fabric index 0x1 was retrieved from storage. Compressed FabricId 0x73A1A947D4C599EA, FabricId 0x0000000000000001, NodeId 0x000000000001B669, VendorId 0xFFF1 [1683373191.903689][126514:126514] CHIP:ZCL: Using ZAP configuration... [1683373191.905667][126514:126514] CHIP:CTL: System State Initialized... [1683373191.905823][126514:126514] CHIP:CTL: Stopping commissioning discovery over DNS-SD [1683373191.912822][126514:126514] CHIP:CTL: Setting attestation nonce to random value [1683373191.912898][126514:126514] CHIP:CTL: Setting CSR nonce to random value [1683373191.913018][126514:126514] CHIP:IN: UDP::Init bind&listen port=5550 [1683373191.913173][126514:126514] CHIP:IN: UDP::Init bound to port=5550 [1683373191.913217][126514:126514] CHIP:IN: UDP::Init bind&listen port=5550 [1683373191.913352][126514:126514] CHIP:IN: UDP::Init bound to port=5550 [1683373191.916007][126514:126514] CHIP:IN: TransportMgr initialized [1683373191.916563][126514:126516] CHIP:DL: CHIP task running [1683373191.916757][126514:126516] CHIP:DL: HandlePlatformSpecificBLEEvent 32784 [1683373191.921157][126514:126516] CHIP:CTL: Stopping commissioning discovery over DNS-SD [1683373191.921239][126514:126516] CHIP:CTL: Setting attestation nonce to random value [1683373191.921379][126514:126516] CHIP:CTL: Setting CSR nonce to random value [1683373191.991787][126514:126516] CHIP:CTL: Generating NOC [1683373192.014939][126514:126516] CHIP:FP: Validating NOC chain [1683373192.015600][126514:126516] CHIP:FP: NOC chain validation successful [1683373192.018056][126514:126516] CHIP:FP: Updated fabric at index: 0x1, Node ID: 0x000000000001B669 [1683373192.018146][126514:126516] CHIP:TS: Last Known Good Time: 2023-05-06T16:48:59 [1683373192.018190][126514:126516] CHIP:TS: New proposed Last Known Good Time: 2021-01-01T00:00:00 [1683373192.018233][126514:126516] CHIP:TS: Retaining current Last Known Good Time [1683373192.020310][126514:126516] CHIP:FP: Metadata for Fabric 0x1 persisted to storage. [1683373192.022005][126514:126516] CHIP:TS: Committing Last Known Good Time to storage: 2023-05-06T16:48:59 [1683373192.023637][126514:126516] CHIP:CTL: Joined the fabric at index 1. Fabric ID is 0x0000000000000001 (Compressed Fabric ID: 73A1A947D4C599EA) [1683373192.023811][126514:126516] CHIP:IN: UDP::Init bind&listen port=5550 [1683373192.023965][126514:126516] CHIP:IN: UDP::Init bound to port=5550 [1683373192.024020][126514:126516] CHIP:IN: UDP::Init bind&listen port=5550 [1683373192.024708][126514:126516] CHIP:IN: UDP::Init bound to port=5550 [1683373192.024790][126514:126516] CHIP:IN: TransportMgr initialized [1683373192.062145][126514:126516] CHIP:CTL: Setting wifi credentials from parameters [1683373192.062257][126514:126516] CHIP:CTL: Setting attestation nonce to random value [1683373192.062715][126514:126516] CHIP:CTL: Setting CSR nonce to random value [1683373192.063067][126514:126516] CHIP:CTL: Commission called for node ID 0x0000000000007283 [1683373192.063378][126514:126516] CHIP:DL: Long dispatch time: 147 ms, for event type 2 [1683373192.095178][126514:126515] CHIP:DL: TRACE: Bus acquired for name C-ee32 [1683373192.138735][126514:126515] CHIP:DL: FAIL: NULL apEndpoint->mpAdapter in bluezObjectsSetup [1683373192.140087][126514:126516] CHIP:DL: PlatformBlueZInit init success [1683373192.142852][126514:126516] CHIP:DIS: Closing all BLE connections [1683373192.144771][126514:126516] CHIP:BLE: No adapter available for new connection establishment [1683373311.917147][126514:126514] CHIP:CTL: Shutting down the commissioner [1683373311.917245][126514:126514] CHIP:CTL: Stopping commissioning discovery over DNS-SD [1683373311.917354][126514:126514] CHIP:CTL: Shutting down the controller [1683373311.917398][126514:126514] CHIP:IN: Expiring all sessions for fabric 0x1!! [1683373311.917441][126514:126514] CHIP:FP: Forgetting fabric 0x1 [1683373311.917488][126514:126514] CHIP:TS: Pending Last Known Good Time: 2023-05-06T16:48:59 [1683373311.917616][126514:126514] CHIP:TS: Previous Last Known Good Time: 2023-05-06T16:48:59 [1683373311.917661][126514:126514] CHIP:TS: Reverted Last Known Good Time to previous value [1683373311.917727][126514:126514] CHIP:CTL: Shutting down the commissioner [1683373311.917889][126514:126514] CHIP:CTL: Stopping commissioning discovery over DNS-SD [1683373311.917987][126514:126514] CHIP:CTL: Shutting down the controller [1683373311.918029][126514:126514] CHIP:CTL: Shutting down the System State, this will teardown the CHIP Stack [1683373311.918230][126514:126514] CHIP:DMG: All ReadHandler-s are clean, clear GlobalDirtySet [1683373311.918346][126514:126514] CHIP:BLE: BleConnectionDelegate::CancelConnection is not implemented. [1683373311.918392][126514:126514] CHIP:FP: Shutting down FabricTable [1683373311.918437][126514:126514] CHIP:TS: Pending Last Known Good Time: 2023-05-06T16:48:59 [1683373311.918498][126514:126514] CHIP:TS: Previous Last Known Good Time: 2023-05-06T16:48:59 [1683373311.918561][126514:126514] CHIP:TS: Reverted Last Known Good Time to previous value [1683373311.918768][126514:126514] CHIP:DL: writing settings to file (/tmp/chip_counters.ini-cpvgZC) [1683373311.919190][126514:126514] CHIP:DL: renamed tmp file to file (/tmp/chip_counters.ini) [1683373311.919415][126514:126514] CHIP:DL: NVS set: chip-counters/total-operational-hours = 0 (0x0) [1683373311.919459][126514:126514] CHIP:DL: Inet Layer shutdown [1683373311.919501][126514:126514] CHIP:DL: BLE shutdown (process:126514): GLib-GObject-CRITICAL **: 19:41:51.919: g_object_unref: assertion 'G_IS_OBJECT (object)' failed [1683373311.919939][126514:126514] CHIP:DL: System Layer shutdown [1683373311.920263][126514:126514] CHIP:TOO: Run command failure: ../../examples/chip-tool/commands/common/CHIPCommand.cpp:524: CHIP Error 0x00000032: Timeout ```
kurisaW commented 1 year ago

解决方案及分析

参考此issue:

出现这个问题是说明没有多余的蓝牙适配器为chip-tool提供服务,这里我使用的虚拟机设备,一般来说,在虚拟机的USB设备中打开与主机共享蓝牙设备,然后使用主机的蓝牙来为chip-tool提供服务能够解决问题。

1.查看下蓝牙状态:

sudo systemctl status bluetooth

7e8b531f8b4be994ed272cf2e69703c

如果未运行,请执行:

sudo systemctl enable bluetooth
sudo systemctl start bluetooth

2.蓝牙管理命令:bluetoothctl

f317485b56bddddeb83865f094419a7

3.确认蓝牙适配器已经被识别并启用

可以使用以下命令检查:

hciconfig -a

LRHC%H77T8AU FZ_V$F@(Q6

根据提示信息我们可以得知我的蓝牙适配器名为"hci0",并且状态为 "DOWN",因此我们需要启用该蓝牙适配器。

4.启用蓝牙适配器

sudo hciconfig hci0 up

虽然在虚拟机设置中选用与主机共享蓝牙设备,但在ubuntu22.04中还是无法找到蓝牙设备,而我的ubuntu20.04则可以搜索到设备,具体原因还没有找到,因此我选择使用购买一个支持linux的蓝牙适配器,如果你有相似的情况并且成功修复的话,欢迎给出解决办法!

kurisaW commented 1 year ago

对此issue已有成功案例: