Repository navigation
fix(agent): reapply volatile settings on device reconnection and retry disagreeing DPI writes - #1270
Conversation
|
8c24d22 to
da33a42
Compare
|
Fair point on the reclaim — it treated every diverted route in the forced target set as abandoned, and the identity-free reconnect path makes that set every online device. There's no staleness signal available from the agent's side today (a live external consumer on another device looks identical), so rather than guess I've withdrawn that commit from this PR. It's now the two fixes with an unambiguous owner: the reconnection re-apply and the DPI write retry. I'll bring the wheel-route reclaim back separately once there's a defensible staleness check (or scope it to the agent's own startup pass), if that's of interest. |
21e926e to
6cac34c
Compare
|
Rebased onto master (post-#1286). The only change: the new |
0114202 to
61e9c6a
Compare
|
Rebased onto master (a92aa43, v0.8.6) after the orchestrator split. No functional change: the forced re-apply budget, the refresh path and the two entry points stay in |
…ection A mouse waking from a nap re-establishes its receiver link and comes back with firmware-default volatile settings (sensor DPI, SmartShift, wheel mode). The re-apply relied on an offline→online transition between snapshots — but a nap short enough that no reconciliation observed the device offline produces no transition at all, and the one write a reconnect did get could race the link still stabilizing, leaving the wrong DPI live until the next nap. The firmware's own reconnection broadcast (0x1d4b WirelessDeviceStatus) already reaches the inventory watcher; it now also survives the settle drain and forces a volatile re-apply on the snapshot that follows, like a system wake but with a single link-race confirming pass instead of the boot ladder. Plain offline→online reconnects queue the same single confirm, and forced re-apply requests coalesce keeping the larger budget.
Firmware still drowsy from a link re-establishment can ACK setSensorDpi yet keep the old value. The read-back already caught the mismatch but only warned; a single re-write now disambiguates the two silent-failure shapes: a dropped write lands on the retry, while a value the device clamps deterministically comes back unchanged again and keeps the existing warning.
61e9c6a to
8a62d23
Compare
|
Rebased onto current master ( |
Summary
Two related fixes to the volatile-settings re-apply path, found while instrumenting an MX Master 4 on a Bolt receiver (macOS 15.7) over several days of logged use. Standalone — applies to current master, no dependency on the smooth-scroll series.
0x1d4bWirelessDeviceStatus). A mouse waking from a nap re-establishes its link and comes back with firmware-default volatile settings (sensor DPI, SmartShift, wheel mode). The re-apply relied on an offline→online transition between snapshots, but a nap short enough that no reconciliation observed the device offline produced no transition, and the one write a reconnect did get could race the link still stabilising — leaving the wrong DPI live until the next nap. The reconnection broadcast already reaches the inventory watcher; it now survives the settle drain and forces a volatile re-apply on the following snapshot (like a system wake, with a single link-race confirming pass instead of the boot ladder). Forced requests coalesce keeping the larger budget. Verified overnight: after a 12 h nap the DPI was rewritten and read back correct 14.5 s after display resume, with the pre-fix8705warnings gone.setSensorDpiyet keep the old value. The read-back already caught the mismatch but only warned; one re-write now separates the two silent-failure shapes — a dropped write lands on the retry, a value the device clamps deterministically comes back unchanged again and keeps the existing warning.(An earlier revision also reclaimed a stale diverted wheel route on re-apply. It was withdrawn after review: the agent has no signal to tell an abandoned diversion from a live external consumer, and the identity-free reconnect path touches every online device. It will come back separately with an ownership check.)
Test plan
cargo fmt --all --check;cargo clippy --workspace --all-targets -- -D warningson aarch64-apple-darwin andx86_64-pc-windows-gnuforopenlogi-device/openlogi-agent-core;RUSTDOCFLAGS=-D warnings cargo docfor those crates;cargo test -p openlogi-device -p openlogi-agent-core -p openlogi-agent— green. New unit tests cover the forced re-apply request coalescing and budget, the reconnection-broadcast path, and the single DPI retry (dropped write vs deterministic clamp). (One pre-existingtray::test inopenlogi-agentis timing-flaky under parallel execution on master — fix(agent): serialize the macOS tray tests that share NSWorkspace's center #1236 addresses it; passes serially.)