Fix false locks: escalate duty when updates stall, probe before locking
BlueZ dedupes identical RSSI values, so a stationary phone can go quiet in the event stream while in range. At the 2% present duty cycle the ~1Hz beacon was caught less often than presence_timeout, causing Present/Suspect flapping and locks after 60s of silence with the phone at -60 dBm. - Present: step up to the Suspect duty once the last sighting ages past half of presence_timeout, without leaving Present - Lock path: attempt a 3s LE connect to the phone first; success cancels the lock and returns to Present, failure locks as before
This commit is contained in:
1 parent
426342eb10
commit
43a79d8a43
4 files changed
+133
-18
No files matched your search
@@ -28,14 +28,20 @@ The daemon adapts it to a small state machine:
|
||||
```
|
||||
|
||||
- **Present**: fresh advertisement updates with RSSI above `rssi_lock`, or an
|
||||
active connection to the device.
|
||||
active connection to the device. If updates go quiet — a stationary phone
|
||||
produces identical RSSI values, which BlueZ dedupes — the radio steps up to
|
||||
the Suspect duty after half of `presence_timeout_secs`, without leaving
|
||||
Present.
|
||||
- **Suspect**: high-duty re-check so a few dropped beacons don't lock you out.
|
||||
- **Bootstrapping**: the daemon never locks before it has seen the phone at
|
||||
least once, so you can boot with the phone in another room.
|
||||
- **Locked**: no unlock; the next sighting just returns to Present.
|
||||
|
||||
Locking goes through `loginctl lock-session` (works with GNOME, KDE, Sway,
|
||||
...), configurable via `lock_command`.
|
||||
...), configurable via `lock_command`. Before locking, the daemon attempts a
|
||||
short (3s) LE connection to the paired phone: a phone in range accepts it,
|
||||
which cancels the lock — silence in the advertisement stream alone is not
|
||||
proof of absence.
|
||||
|
||||
## Requirements
|
||||
|
||||
@@ -112,12 +118,13 @@ See `config.toml.example`; every knob is documented there. Highlights:
|
||||
|
||||
## Known trade-offs (v1)
|
||||
|
||||
- Presence is inferred from advertisement property updates. If BlueZ
|
||||
suppresses updates for identical RSSI values (its property cache dedupes),
|
||||
a *perfectly* stationary phone in a perfectly stationary room can look
|
||||
absent; the default `presence_timeout_secs = 15` plus real-world RSSI
|
||||
jitter makes this unlikely, but `--dry-run` on your hardware is the
|
||||
arbiter. The AdvertisementMonitor roadmap removes this class of problem.
|
||||
- Presence is inferred from advertisement property updates. BlueZ dedupes
|
||||
identical RSSI values (its property cache suppresses unchanged values), so
|
||||
a stationary phone can go quiet in the event stream while in range. Two
|
||||
countermeasures: the radio escalates duty while updates are stalled (see
|
||||
Present above), and the lock decision is gated on a 3s LE connect probe.
|
||||
`--dry-run` on your hardware remains the arbiter. The AdvertisementMonitor
|
||||
roadmap removes this class of problem.
|
||||
- While the screen is locked the daemon keeps low-duty scanning to notice
|
||||
the phone's return (rearming only; it never unlocks).
|
||||
|
||||
|
||||
Reference in new issue
Block a user