BLE notifications get silently truncated when the negotiated MTU is too small
I maintainer di solito rispondono entro 1 giorno
Una pull request collegata è già stata integrata.
- #52 di @Tichael — integrata
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 55/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- flutter, rust
- Ambito
- embedded-iot, mobile-dev
Direzione di ricerca
Start with the BLE TX task in boards/esp/src/ble/transport.rs around lines 638 and 666, then check how trouble-host handles notifications in gatt::assemble and how the mobile app handles the requested MTU in mobile-app/lib/providers/ble_connection_provider.dart. The issue suggests waiting for the MTU exchange event and checking each payload against the negotiated MTU; done means oversized messages are never silently truncated and a small MTU is logged on both sides.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Problem
BLE messages aren't fragmented: every message must fit in one ATT packet, at most ble.payload.max_message_bytes (244 bytes, from an ATT MTU of 247). The firmware never checks the MTU that was actually negotiated:
- After the link is encrypted, the TX task sleeps 500 ms and assumes the MTU exchange is done by then (
boards/esp/src/ble/transport.rs:638). Nothing confirms it. - trouble-host 0.6 trims a notification to the connection's ATT MTU without returning an error (
gatt::assembleintrouble-host-0.6.0/src/gatt.rs:644). Sonotify(...)attransport.rs:666reports success while the app receives a cut-off protobuf it can't decode. - The app requests
kBleAttMtu(mobile-app/lib/providers/ble_connection_provider.dart:219). When it gets less, it only logs a warning.
When it happens
The MTU exchange takes longer than 500 ms, or the phone negotiates less than 247. Some Android phones do; iOS picks its own MTU, which matters if iOS is ever supported. State updates near the worst-case size are then lost silently.
Ideas
- Wait for the MTU-exchange event instead of sleeping.
- Before each notify, compare the payload with
conn.raw().att_mtu() - 3and drop or log anything that doesn't fit, rather than sending a truncated message. - Longer term: BLE fragmentation (https://github.com/OpenCarControls/contracts/issues/5) removes the limit.
Done when
No message is ever sent truncated, and an MTU that's too small is visible in the logs on both sides.
- Lingua principale
- Rust
- Stelle
- 1
- Fork
- 0
- Merge medio
- 10h 56m
- PR unite (30g)
- 15
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di OpenCarControls/firmware
-
Clean up E-GMP leftoversForse già presa @Tichael l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
OpenCarControls/firmware#34 ·
I maintainer di solito rispondono entro 1 giorno
-
BLE: send the current state when the app subscribesForse già presa @Tichael l’ha presa oggi. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
OpenCarControls/firmware#58 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
OpenCarControls/firmware#55 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
OpenCarControls/firmware#54 ·
I maintainer di solito rispondono entro 1 giorno
-
First-setup pairing window is too short and stays open after the first bondForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertaenhancement
Difficoltà 4/5 3-5 giorni Idoneità per principianti 55/100
OpenCarControls/firmware#53 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di OpenCarControls/firmware
Issue simili
-
bug: workspace access hint suggests a --subject command that fails for hyphen-leading OIDC subjectsAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
type: bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
`last_error_thread_local_then_global` fails when it runs beside the `lumen_event_detail` testApertaA-FFI C-Testing D-Straightforward S-Ready
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno
-
docs priority:P3 size:XS
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
I maintainer di solito rispondono entro 1 giorno
-
Appimage ConventionsApertaenhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno