Skip to content

Unifying receivers no longer retry discovery forever while a paired device is offline - #1506

Merged
lujjjh merged 1 commit into
mainfrom
fix-unifying-receiver-discovery-retry
Nov 11, 2026
Merged

lujjjh merged 1 commit into
mainfrom
fix-unifying-receiver-discovery-retry

Conversation

@lujjjh

@lujjjh lujjjh commented Nov 11, 2026

Copy link
Copy Markdown
Collaborator

Related to #1504, where the retry loop first showed up in a log. It is not the cause of the memory growth reported there.

When a Unifying receiver had a paired device that was offline, LinearMouse never finished discovering the receiver. It logged Receiver inventory is incomplete, retrying and queried every paired slot again, backing off to about once every 18 seconds for as long as the app ran.

Register 0x02 on a Unifying receiver reports the number of paired devices, including offline ones. The code treated it as the number of connected devices, so the check could not pass while any paired device was offline. Two receivers showed this: one with a single pairing and nothing online reported 1, and the one in #1504 with four pairings and one device online reported 4.

Interpret the count as a paired-device count for Unifying receivers, which puts them on the same completeness check Bolt already uses: every paired slot must have a known online or offline state. Lightspeed receivers keep the connected-count interpretation.

Validation (macOS 27.2, Unifying receiver 0xC52B with an ERGO M575 as its only pairing):

  • Before: launching with the mouse on Bluetooth retried 9 times in 70 seconds.
  • After: the same launch completed discovery once and did not retry.
  • After: switching the mouse onto the receiver and back to Bluetooth twice was recognized each time, with no retries.
  • 1,193 app tests passed, including two new ones for a single offline pairing and for four pairings with one device online.
  • swiftformat --lint and swiftlint passed.

🤖 Generated with Claude Code

Register 0x02 on a Unifying receiver reports every paired device,
including offline ones. Reading it as a connected count meant receiver
discovery could never complete while a paired device was offline, so it
retried for as long as the app ran.

Lightspeed receivers keep the connected-count interpretation.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@lujjjh lujjjh added the bug Something isn't working label Nov 11, 2026
@coderabbitai

coderabbitai Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Receiver count handling now distinguishes paired counts for classic receivers from connected counts for other receiver families. Tests cover Unifying receiver counts and inventory completion when paired devices are offline.

Changes: Receiver inventory

Layer / File(s) Summary
Classify receiver counts
LinearMouse/Device/VendorSpecific/Logitech/HIDPP/LogitechHIDPPDeviceMetadataProvider.swift, LinearMouseUnitTests/Device/VendorSpecificDeviceMetadataTests.swift
Classic receiver counts are classified as paired counts; other receiver counts are classified as connected counts. Slot discovery and connection-snapshot collection use this classification. Tests cover receiver product IDs 0xC52B, 0xC532, and 0xC547.
Handle offline paired slots
LinearMouse/Device/ReceiverMonitor.swift, LinearMouseUnitTests/Device/VendorSpecificDeviceMetadataTests.swift
The comment describes presence evidence for Bolt and Unifying paired slots, including offline devices. Inventory tests expect completion when paired devices are offline, and include only connected identities.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Possibly related issues

Possibly related PRs

  • linearmouse/linearmouse#1488 — That PR uses published receiver identities for logical-device matching, scheme selection, and the device picker. This PR changes when those identities are available through receiver inventory completion.
Merge Risk: Minimal · up to 44e2b

Unifying receivers with an offline paired device should complete discovery without endless retries. No actionable merge-blocking risk remains.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title accurately identifies the main change: Unifying receiver discovery no longer retries indefinitely when a paired device is offline.
Description check Passed The description clearly explains the Unifying paired-device count issue, the Lightspeed behavior, the implementation intent, and the validation results. It is directly related to the changeset.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Finishing Touches

Generate docstrings

  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 20c5dbc and 44e2b98.

Files selected for processing: 3

  • LinearMouse/Device/ReceiverMonitor.swift
  • LinearMouse/Device/VendorSpecific/Logitech/HIDPP/LogitechHIDPPDeviceMetadataProvider.swift
  • LinearMouseUnitTests/Device/VendorSpecificDeviceMetadataTests.swift

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 5 remain after this review.

@lujjjh
lujjjh enabled auto-merge (squash) November 11, 2026 14:40
@lujjjh
lujjjh merged commit 342f4a8 into main Nov 11, 2026
2 checks passed
@lujjjh
lujjjh deleted the fix-unifying-receiver-discovery-retry branch November 11, 2026 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant