Repository navigation
Conversation
macOS presents a mouse behind a Bolt, Unifying or Lightspeed receiver as the receiver itself, so the device matcher saw a different vendor, product, name and serial on the receiver than over Bluetooth and every scheme was written twice. The receiver monitor already resolves the paired device's name, product ID and serial through HID++, and the hardware baseline store already treats that serial as the same device as the Bluetooth one. DeviceMatchCandidates carries the identity a scheme is written against (the resolved paired device when the route is known) and the raw HID identity as a fallback, so schemes written against the receiver keep applying. Scheme.MatchContext carries both, If.isSatisfied accepts either, and the device-specific scheme lookup unions them. When a route resolves and the match identity changes, DeviceManager republishes the device list so the picker and scheme state pick the new identity up. Fixes linearmouse#1075. Co-Authored-By: Claude Fable 5.1 <[email protected]>
…entity Pointer speed and acceleration are read from the matching schemes when a device is added, before the receiver monitor has resolved the paired device. Once the route resolves and the match identity changes, the schemes that now match are read again for that device, so a scheme written over Bluetooth sets the pointer speed on the receiver too. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Settings and hardware configuration paths do not yet handle all new identity candidates consistently.
Get a fresh assessment by requesting another Copilot review.
Review effort: Balanced
Findings: 4
Open (4)
What changed in this PR
Unifies Logitech mouse identities across receiver and Bluetooth connections while preserving receiver-based configurations.
Changes:
- Adds paired-device and receiver fallback matching.
- Refreshes pointer settings when receiver identity resolves.
- Adds tests, diagnostics, and documentation.
| File | Description |
|---|---|
| LinearMouseUnitTests/Model/DeviceMatcherTests.swift | Tests receiver and Bluetooth matching behavior. |
| LinearMouse/Model/Configuration/Scheme/Scheme.swift | Propagates and indexes fallback identities. |
| LinearMouse/Model/Configuration/Scheme/If/If.swift | Matches schemes against either identity. |
| LinearMouse/Model/Configuration/DeviceMatcher.swift | Defines primary and fallback candidates. |
| LinearMouse/Device/DeviceManager.swift | Refreshes settings after identity changes. |
| LinearMouse/Device/Device.swift | Derives match candidates from receiver routes. |
| Documentation/Configuration.md | Documents cross-transport matching. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+37
to
+38
| guard let logicalIdentity, | ||
| logicalIdentity.productID != nil || logicalIdentity.serialNumber != nil |
| primary = DeviceMatcher( | ||
| vendorID: physical.vendorID, | ||
| productID: logicalIdentity.productID, | ||
| productName: logicalIdentity.name, |
| /// The identity a scheme is written against for `device`. | ||
| init(of device: Device) { | ||
| self.init( | ||
| self = device.matchCandidates.primary |
Comment on lines
+218
to
+223
| let candidates = device.matchCandidates.all | ||
| var seen = Set<Int>() | ||
| return candidates | ||
| .flatMap { allDeviceMatcherSpecificSchemes(of: $0) } | ||
| .filter { seen.insert($0.offset).inserted } | ||
| .sorted { $0.offset < $1.offset } |
lujjjh
added a commit
that referenced
this pull request
Nov 1, 2026
…oth (#1488) A device paired to a Logitech receiver is matched by the identity it reports through the receiver (vendor ID, product ID, serial number), with the receiver as a second candidate. On Bolt this is the same identity as over Bluetooth, so schemes written for the mouse over Bluetooth apply through the receiver and the other way round, while schemes written for the receiver keep applying to every device behind it. The device picker lists the devices behind a receiver instead of the receiver, and lists the receiver only while it cannot tell which device is in use. Hardware settings and pointer settings are reapplied when the device behind a receiver changes, and not routed to it after wake until rediscovery confirms it. A new device-wide scheme for a device behind a receiver goes before the receiver's app and display schemes. New conditions for Logitech devices omit the product name when a product ID and serial number are known. Receiver logs show only the last four characters of a serial number. Supersedes #1385. Co-authored-by: Robert Owens <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
Collaborator
|
Thanks for working on this! I ended up taking a different approach to the scheme design in #1488, so this is handled transparently for users. It supersedes this PR, and I've credited you as a co-author. Closing. |
Contributor
Author
|
Awesome!! Just a little annoyance I was dealing with there, glad to chip in. Thanks for the credit. I actually forgot I did the PR. Cheers!
Robert
… On Nov 4, 2026, at 6:06 AM, Jiahao Lu ***@***.***> wrote:
lujjjh
left a comment
(linearmouse/linearmouse#1385)
<#1385 (comment)>
Thanks for working on this! I ended up taking a different approach to the scheme design in #1488 <#1488>, so this is handled transparently for users. It supersedes this PR, and I've credited you as a co-author. Closing.
—
Reply to this email directly, view it on GitHub <#1385?email_source=notifications&email_token=ASXBT3A7WLDN76OZVIDQCOL5XMZVVA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTMNRTGI3TAOJTGM22M4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KYZTPN52GK4S7MNWGSY3L#issuecomment-6632709335>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ASXBT3DJ3LOUAF2BF5PFXCL5XMZVVAVCNFSNUABFKJSXA33TNF2G64TZHMZTONJWGUZTONZYHNEXG43VMU5TKMZZHAZTCMBYGI4KC5QC>.
You are receiving this because you authored the thread.
|
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.

Fixes #1075.
Problem
A Logitech mouse that is used both through a Bolt/Unifying/Lightspeed receiver and over Bluetooth gets two unrelated identities. macOS presents the receiver as the HID device, so on the receiver the matcher sees
VID 0x046D / PID 0xC548 / "USB Receiver" / no serial, while over Bluetooth it seesVID 0x046D / PID 0xB042 / "MX Master 4" / serial 11D5D259(MX Master 4). Every scheme created on one transport is invisible on the other, which reads as "settings reset when I switch" (#1075).What LinearMouse already knew
ReceiverMonitorresolves the paired device behind a monitored receiver through HID++ pairing info: name, product ID and serial (ReceiverLogicalDeviceIdentity).LogitechHardwareTargetKeyalready treats that serial and the Bluetooth-side serial as the same hardware for DPI and Hi-Res Wheel baselines. The config matcher was the one place that ignored it.Change
DeviceMatchCandidates(inDeviceMatcher.swift): the identity a scheme is written against (primary) plus the raw HID identity asfallback. With a resolved receiver route,primaryis the paired device (vendor from the receiver, product ID, name and serial from the identity) andfallbackis the receiver. Without a route, or when the identity carries neither a product ID nor a serial,primaryis the physical identity and there is no fallback.Device.matchCandidatesderives it fromlogitechReceiverRouteSnapshot.DeviceMatcher(of:)returnsprimary;DeviceMatcher.match(with: Device)accepts either candidate.Scheme.MatchContextcarriesdeviceFallback;Scheme.If.isSatisfied(in:)accepts either;[Scheme].allDeviceSpecficSchemes(of:)unions the candidates.DeviceManager.receiverPointingDevicesChangedre-applies pointer speed and acceleration for a device whose match identity changed, since those were read when the device was added and before the route resolved, and republishes the device list soDeviceState, the device picker andSchemeStatepick the new identity up. The route cache key inEventTransformerManageralready includes the matcher, so events rebuild their route on the next event.Documentation/Configuration.mdgains a paragraph under Device matching.Compatibility: a scheme written against the receiver identity (
0xC548 / "USB Receiver") keeps applying through the fallback. When both a receiver-keyed and a mouse-keyed scheme exist they merge in file order, as any two matching schemes do.Tests
LinearMouseUnitTests/Model/DeviceMatcherTests.swift, 9 cases: identity resolution with and without a route, product ID or serial missing, a Bluetooth-written scheme applying through the receiver, a receiver-written scheme still applying, a scheme created through the receiver applying over Bluetooth, a different mouse on the same receiver not matching, and both identities merging.xcodebuild test -only-testing:LinearMouseUnitTests: 850 tests, 0 failures.swiftformat --lint .andswiftlint .clean on the changed files.Verified on hardware
MacBook Pro, macOS 26.6, MX Master 4 paired to both a Logi Bolt receiver on the Mac and Bluetooth. The debug build, launched with the mouse on Bluetooth, added the device as
MX Master 4 (VID=0x046D, PID=0xB042), started the receiver monitor for the Bolt receiver, and applied the existing Bluetooth scheme (pointer speed, DPI 1100, Hi-Res Wheel).After switching the mouse to the Bolt channel, the receiver monitor resolved
slot=2 name=MX Master 4 productID=0xB042 serial=11D5D259, the same product ID and serial macOS reports over Bluetooth. The event transformer rebuilt its route with the merged scheme, the hardware DPI and Hi-Res Wheel were applied through the receiver slot, and after the route resolved the receiver device received the Bluetooth scheme's pointer speed (0.0748) and acceleration (4.0396) in place of the defaults it had at enumeration (0.069 / 3.0). The config file was not changed; both existing schemes remained as written.🤖 Generated with Claude Code