Repository navigation
Logitech: key a device on its unit id alone, so its cable shares the receiver's icon - #253
Open
Willshaper wants to merge 1 commit into
Open
Willshaper wants to merge 1 commit into
Willshaper wants to merge 1 commit into
Conversation
…receiver's icon With two receivers of the same product id plugged in (a G502 X PLUS and a G915 both use 046D:C547), e9369da gave each device a key that carries its receiver's instance: `logitech:<instance>:<unit id>`. The same device on its USB cable has no receiver and keeps the plain `logitech:<unit id>`, so plugging the mouse in to charge showed two icons: the charging one from the cable, and a greyed "device asleep" copy from the receiver for five minutes. The "charging wins" merge in poll() never saw them as one device. The unit id (feature 0x0003) is the device's own serial: the same on any receiver and on the cable, and different for two devices of the same model, so it is now the key on its own. Only the fallback key of a device without a unit id (receiver product id and slot) still gains the instance, because two receivers of the same kind have the same slot numbers. - tests: the two-receiver test put one unit id on both receivers, which no two real devices share; it now uses two, and a new test covers two receivers whose devices report no unit id - tests: two receivers of the same kind, then the mouse moves from its receiver to the cable: one icon, online and charging (fails before this change) - CHANGELOG entry under [Unreleased] Tested on hardware: a G502 X PLUS (receiver 046D:C547, cable 046D:C095) next to a G915 on a second C547 receiver. Before, the diagnostics showed `logitech:<instance>:<unit id>` on the receiver and `logitech:<unit id>` on the cable; with this change the cable poll gives the plain unit-id key and there is only one G502 entry.
This was referenced Oct 20, 2026
Contributor
|
Thank you, @Willshaper. Reviewed: no blocking issues. A missing or all-zero unit id still falls back to the slot key with the receiver instance, so it does not merge two devices. Mutations that put the prefix back fail Notes:
|
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.
The problem
With two Logitech receivers of the same product id plugged in, a device shows two icons while it charges on its cable: the charging one from the cable, and a greyed "last known value, device asleep" copy from the receiver that stays for five minutes.
Seen with a G502 X PLUS and a G915, which both use a
046D:C547receiver. Since e9369da, two receivers of the same kind make the device key carry the receiver's instance (logitech:<instance>:<unit id>). The cable has no receiver, so the same mouse on the cable keeps the plainlogitech:<unit id>. Because the keys differ, the "charging wins" merge inpoll()never treats them as one device.The fix
The unit id (feature
0x0003) is the device's own serial. It is the same on any receiver and on the cable, and differs between two devices of the same model, so it is now the key on its own. Only the fallback key of a device that reports no unit id (receiver product id + slot) still gains the instance, since two receivers of the same kind have the same slot numbers.Users with a single receiver keep the keys they have now. Users with two receivers of the same kind go back to the plain unit-id keys they had before 1.11.0, so a rename, hide, icon or alert level set since then on such a device has to be set again (noted in the CHANGELOG).
Tests
test_two_identical_receivers_get_two_iconsput the same unit id on both receivers, which no two real devices share. It now uses two different unit ids and expects both plain keys.test_two_identical_receivers_without_unit_ids_get_two_icons: devices without a unit id still get distinct, instance-prefixed slot keys.test_mouse_on_its_cable_keeps_one_icon: two receivers of the same kind, then the mouse moves from its receiver to the cable. Expects one icon, online and charging. It fails onmain('logitech:7&aaaa&0:C15E09CD' != 'logitech:C15E09CD').python -m unittest discover -s tests: 603 tests, OK.Checklist (CONTRIBUTING)
0x0003read.046D:C547, cable046D:C095) next to a G915 on a secondC547receiver. Before this change, the diagnostics showed the mouse aslogitech:<instance>:<unit id>on the receiver andlogitech:<unit id>on the cable. With it, the cable poll gives the same plain key and there is only one G502 entry.providers/logitech.py/tests/test_logitech.py. Logitech: read HID++ 1.0 devices through the old battery registers (#159), unit tests #180's new register-battery path builds its own slot key with the instance prefix, which matches what this PR keeps for devices without a unit id.