BLE notifications get silently truncated when the negotiated MTU is too small
Maintainer thường phản hồi trong vòng 1 ngày
Một pull request liên quan đã được merge.
- #52 của @Tichael — đã merge
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 55/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- flutter, rust
- Lĩnh vực
- embedded-iot, mobile-dev
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- Rust
- Star
- 1
- Fork
- 0
- Merge trung bình
- 14 giờ 32 phút
- Pull request đã merge (30 ngày)
- 21
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Không có hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của OpenCarControls/firmware
-
e-gmp enhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
OpenCarControls/firmware#75 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
OpenCarControls/firmware#74 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
OpenCarControls/firmware#73 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
OpenCarControls/firmware#72 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
e-gmp enhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
OpenCarControls/firmware#71 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của OpenCarControls/firmware
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
FavioVazquez/mollify#62 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 61/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
fendouai/awesome-deepseek-harness#125 ·
Maintainer thường phản hồi trong vòng 4 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
rust-embedded/heapless#694 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày