centurion: seed child headset kind via pairing_info

The construction-time kind=headset seeding only covered the direct
create_device path. G522-style devices reach a CenturionReceiver,
whose notify_devices() builds the headset as a child Device with
device_info=None and sets dev.centurion=True only after __init__ —
so the __init__ guard never fired and the child kept kind=None.

Set kind=headset in the pairing_info dict the receiver already passes
into Device.__init__, which covers the bridge path. Both paths now
seed the kind offline.
This commit is contained in:
Ken Sanislo 2026-05-15 21:07:47 -07:00
parent f22b542daf
commit 96311f4eec
2 changed files with 17 additions and 1 deletions

View File

@ -35,6 +35,7 @@ from solaar import configuration
from . import base
from . import exceptions
from . import hidpp10
from . import hidpp10_constants
from .centurion_constants import CenturionCoreFeature
from .common import Alert
from .common import Battery
@ -376,7 +377,7 @@ class CenturionReceiver:
# Create child Device with receiver=self, number=1
pairing_info = {
"wpid": self.product_id,
"kind": None,
"kind": hidpp10_constants.DEVICE_KIND.headset, # every Centurion-transport device so far is a headset
"serial": None,
"polling": None,
"power_switch": None,

View File

@ -1213,6 +1213,21 @@ def test_centurion_receiver_container_with_device():
recv[2]
def test_centurion_receiver_child_device_kind_headset():
"""notify_devices() seeds the headset child with kind=headset via pairing_info,
so the headphone icon shows even when the headset is powered off at startup."""
info = FakeCenturionDeviceInfo(product="PRO X 2 LIGHTSPEED")
recv = CenturionReceiver(FakeLowLevel(), 0x99, info)
recv._pending = False
recv._dongle_features = []
recv.notify_devices()
child = recv[1]
child.online = False
assert child.kind == "headset"
def test_centurion_receiver_enable_connection_notifications():
"""CenturionReceiver.enable_connection_notifications() returns False."""
info = FakeCenturionDeviceInfo()