Keep passive scans continuous and support instant batched updates - #1558
Open
rmounce wants to merge 3 commits into
Open
Keep passive scans continuous and support instant batched updates#1558rmounce wants to merge 3 commits into
rmounce wants to merge 3 commits into
Conversation
Co-authored-by: Codex <codex@openai.com>
Co-authored-by: Codex <codex@openai.com>
Co-authored-by: Codex <codex@openai.com>
rmounce
marked this pull request as ready for review
July 20, 2026 12:57
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR contains three intentionally separate commits that improve passive HCI scanning and low-latency measurement delivery:
The commits are kept separate so the scanner lifecycle, instant delivery, and multi-report parser work can be split into smaller PRs if preferred during review.
Motivation and root cause
Restarting the HCI scanner after every aggregation period creates avoidable scan downtime. With
period: 1, a TP-Link UB500 was repeatedly closing and reopening its HCI socket and losing advertisements.After continuous scanning and instant updates were enabled, matched captures identified a second UB500-specific loss mechanism. The adapter commonly emits LE Extended Advertising Report events containing two to five reports.
BleParser.parse_raw_data()assumed exactly one report and rejected the complete HCI event whenever its total length exceeded the first report's length.Behavior
period.hci_inactivity_timeoutdefaults to 60 seconds and accepts0to disable recovery.time.monotonic()and is tracked per HCI adapter before packet recognition or duplicate filtering.bt_auto_restartrecovery path.measurement_updatedefaults toperiodic;instantpublishes each parser-accepted packet without mean or median filtering.default,periodic, andinstantvalues follow the existing override/inheritance pattern.0x02) and extended (0x0D) batched HCI events are split into individual reports before using the existing advertisement parser.Existing periodic aggregation remains the default for backward compatibility.
Validation
git diff --checkpassed.-71errors occurred during validation.Configuration example
PR description drafted by OpenAI Codex.