Solaar/lib/solaar/cli
Ken Sanislo 0a31711b3a Add CLI --slot unpair for Lightspeed receivers
Adds Receiver.force_unpair_slot(), a low-level method that writes the
RECEIVER_PAIRING unpair register (action 0x03) for a given slot regardless
of cache state, bypassing may_unpair and re_pairs gates. Intended for
clearing stale pairings on Lightspeed receivers where Solaar cannot read
the slot's pairing info or the device is no longer reachable on RF.

Extends the `solaar unpair` CLI with three new flags:
  --receiver <name>   select which receiver to target
  --slot <N>          target a specific slot number directly
  --dry-run           print what would happen without issuing the write

The --slot path is gated to Lightspeed receivers only (by receiver_kind)
so Unifying/Bolt/Nano behavior is unchanged. It populates the cache first
and prints the current slot contents so the user can confirm what is
about to be cleared, but does not refuse based on active/offline state —
the explicit --slot N is treated as sufficient intent.

Verified end-to-end on a C547 dual-slot Lightspeed receiver: stale slot
cleared, RECEIVER_INFO sub-registers 0x21/0x31 went to None, connection
count register dropped from 2 to 1, running solaar daemon picked up the
change in real time via the existing DJ pairing notification hook.

Covered by 5 unit tests against a mocked Receiver: empty slot, stale
sentinel, active device invalidation, register write failure, closed
handle.
2026-04-14 10:38:11 -07:00
..
__init__.py Add CLI --slot unpair for Lightspeed receivers 2026-04-14 10:38:11 -07:00
config.py cli: allow to change LED settings 2025-12-21 18:03:53 -05:00
pair.py cli: correctly handle timeout in Bolt discovery 2026-01-18 14:21:56 -05:00
probe.py Rewrote string concatenation/format with f strings 2025-01-29 08:40:14 -05:00
profiles.py cli: better error messages for solaar profile 2025-11-19 13:50:54 -05:00
show.py centurion: support PRO X 2 LIGHTSPEED headphones Centurion features (#3150) 2026-04-14 11:43:23 -04:00
unpair.py Add CLI --slot unpair for Lightspeed receivers 2026-04-14 10:38:11 -07:00