fix: use version of bt-hci with command complete fix (#4186)

* fix: use version of bt-hci with command complete fix

* Use a version of bt-hci that properly parses command complete event.
* Remove workaround in esp-radio ble controller

* Update esp-radio/CHANGELOG.md

Co-authored-by: Dániel Buga <bugadani@gmail.com>

* fix: use trouble-host supporting newer bt-hci

---------

Co-authored-by: Dániel Buga <bugadani@gmail.com>
This commit is contained in:
Ulf Lilleengen 2025-09-26 14:19:18 +02:00 committed by GitHub
parent a6a6747409
commit 9930c10747
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 6 additions and 22 deletions

View File

@ -46,7 +46,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Updated radio related drivers to ESP-IDF 5.5.1 (#4113)
- Event handlers are now passed the event by reference (#4113)
- Some build-time configuration options have been replaced by runtime options in `WifiConfig` (#4121)
- Update bt-hci version with flash usage improvements (#4146)
- Update to bt-hci version with flash usage improvements (#4146, #4165)
### Fixed

View File

@ -76,7 +76,7 @@ smoltcp = { version = "0.12.0", default-features = false, features = [
"socket-raw",
], optional = true }
embassy-net-driver = { version = "0.2.0", optional = true }
bt-hci = { version = "0.5.0", optional = true }
bt-hci = { version = "0.6.0", optional = true }
# Logging interfaces, they are mutually exclusive so they need to be behind separate features.
defmt = { version = "1.0.1", optional = true }

View File

@ -180,23 +180,7 @@ pub(crate) mod asynch {
match ControllerToHostPacket::from_hci_bytes_complete(data) {
Ok(p) => Ok(Some(p)),
Err(e) => {
if e == bt_hci::FromHciBytesError::InvalidSize {
use bt_hci::{PacketKind, event::EventPacketHeader};
// Some controllers emit a suprious command complete event at startup.
let (kind, data) =
PacketKind::from_hci_bytes(data).map_err(|_| BleConnectorError::Unknown)?;
if kind == PacketKind::Event {
let (header, _) = EventPacketHeader::from_hci_bytes(data)
.map_err(|_| BleConnectorError::Unknown)?;
const COMMAND_COMPLETE: u8 = 0x0E;
if header.code == COMMAND_COMPLETE && header.params_len < 4 {
return Ok(None);
}
}
}
warn!("[hci] error parsing packet: {:?}", e);
Err(BleConnectorError::Unknown)
}
}

View File

@ -25,7 +25,7 @@ esp-radio = { path = "../../../esp-radio", features = [
"unstable",
] }
log = "0.4.27"
trouble-host = { version = "0.3.0", features = [
trouble-host = { version = "0.4.0", features = [
"default-packet-pool-mtu-255",
"derive",
"scan",
@ -89,4 +89,4 @@ lto = "fat"
codegen-units = 1
[package.metadata.cargo-machete]
ignored = ["embassy-sync"]
ignored = ["embassy-sync"]

View File

@ -5,7 +5,7 @@ edition = "2024"
publish = false
[dependencies]
bt-hci = "0.5.0"
bt-hci = "0.6.0"
embassy-executor = "0.9.0"
embassy-futures = "0.1"
embassy-time = "0.5.0"
@ -26,7 +26,7 @@ esp-radio = { path = "../../../esp-radio", features = [
] }
heapless = "0.9.1"
log = "0.4.27"
trouble-host = { version = "0.3.0", features = [
trouble-host = { version = "0.4.0", features = [
"default-packet-pool-mtu-255",
"derive",
"scan",