add smp_debug_mode config flag to enable debug keys during device init

This commit is contained in:
Markus Jellitsch
2026-04-03 23:03:51 +02:00
parent c3daf4a7e1
commit ee09e6f10d

View File

@@ -558,9 +558,7 @@ class AdvertisingParameters:
) )
primary_advertising_interval_min: float = DEVICE_DEFAULT_ADVERTISING_INTERVAL primary_advertising_interval_min: float = DEVICE_DEFAULT_ADVERTISING_INTERVAL
primary_advertising_interval_max: float = DEVICE_DEFAULT_ADVERTISING_INTERVAL primary_advertising_interval_max: float = DEVICE_DEFAULT_ADVERTISING_INTERVAL
primary_advertising_channel_map: ( primary_advertising_channel_map: hci.HCI_LE_Set_Extended_Advertising_Parameters_Command.ChannelMap = (
hci.HCI_LE_Set_Extended_Advertising_Parameters_Command.ChannelMap
) = (
AdvertisingChannelMap.CHANNEL_37 AdvertisingChannelMap.CHANNEL_37
| AdvertisingChannelMap.CHANNEL_38 | AdvertisingChannelMap.CHANNEL_38
| AdvertisingChannelMap.CHANNEL_39 | AdvertisingChannelMap.CHANNEL_39
@@ -583,9 +581,7 @@ class AdvertisingParameters:
class PeriodicAdvertisingParameters: class PeriodicAdvertisingParameters:
periodic_advertising_interval_min: float = DEVICE_DEFAULT_ADVERTISING_INTERVAL periodic_advertising_interval_min: float = DEVICE_DEFAULT_ADVERTISING_INTERVAL
periodic_advertising_interval_max: float = DEVICE_DEFAULT_ADVERTISING_INTERVAL periodic_advertising_interval_max: float = DEVICE_DEFAULT_ADVERTISING_INTERVAL
periodic_advertising_properties: ( periodic_advertising_properties: hci.HCI_LE_Set_Periodic_Advertising_Parameters_Command.Properties = field(
hci.HCI_LE_Set_Periodic_Advertising_Parameters_Command.Properties
) = field(
default_factory=lambda: hci.HCI_LE_Set_Periodic_Advertising_Parameters_Command.Properties( default_factory=lambda: hci.HCI_LE_Set_Periodic_Advertising_Parameters_Command.Properties(
0 0
) )
@@ -897,9 +893,7 @@ class PeriodicAdvertisingSync(utils.EventEmitter):
options = hci.HCI_LE_Periodic_Advertising_Create_Sync_Command.Options(0) options = hci.HCI_LE_Periodic_Advertising_Create_Sync_Command.Options(0)
if self.filter_duplicates: if self.filter_duplicates:
options |= ( options |= hci.HCI_LE_Periodic_Advertising_Create_Sync_Command.Options.DUPLICATE_FILTERING_INITIALLY_ENABLED
hci.HCI_LE_Periodic_Advertising_Create_Sync_Command.Options.DUPLICATE_FILTERING_INITIALLY_ENABLED
)
await self.device.send_async_command( await self.device.send_async_command(
hci.HCI_LE_Periodic_Advertising_Create_Sync_Command( hci.HCI_LE_Periodic_Advertising_Create_Sync_Command(
@@ -1579,12 +1573,8 @@ class CigParameters:
worst_case_sca: WorstCaseSca = WorstCaseSca.SCA_251_TO_500_PPM worst_case_sca: WorstCaseSca = WorstCaseSca.SCA_251_TO_500_PPM
packing: Packing = Packing.SEQUENTIAL packing: Packing = Packing.SEQUENTIAL
framing: Framing = Framing.UNFRAMED framing: Framing = Framing.UNFRAMED
max_transport_latency_c_to_p: int = ( max_transport_latency_c_to_p: int = DEVICE_DEFAULT_ISO_CIS_MAX_TRANSPORT_LATENCY # Max C->P transport latency, in milliseconds
DEVICE_DEFAULT_ISO_CIS_MAX_TRANSPORT_LATENCY # Max C->P transport latency, in milliseconds max_transport_latency_p_to_c: int = DEVICE_DEFAULT_ISO_CIS_MAX_TRANSPORT_LATENCY # Max C->P transport latency, in milliseconds
)
max_transport_latency_p_to_c: int = (
DEVICE_DEFAULT_ISO_CIS_MAX_TRANSPORT_LATENCY # Max C->P transport latency, in milliseconds
)
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
@@ -2159,6 +2149,7 @@ class DeviceConfiguration:
) )
eatt_enabled: bool = False eatt_enabled: bool = False
gatt_services: list[dict[str, Any]] = field(init=False) gatt_services: list[dict[str, Any]] = field(init=False)
smp_debug_mode: bool = False
def __post_init__(self) -> None: def __post_init__(self) -> None:
self.gatt_services = [] self.gatt_services = []
@@ -2450,9 +2441,7 @@ class Device(utils.CompositeEventEmitter):
self.le_connecting = False self.le_connecting = False
self.disconnecting = False self.disconnecting = False
self.connections = {} # Connections, by connection handle self.connections = {} # Connections, by connection handle
self.pending_connections = ( self.pending_connections = {} # Pending connections, by BD address (BR/EDR only)
{}
) # Pending connections, by BD address (BR/EDR only)
self.sco_links = {} # ScoLinks, by connection handle (BR/EDR only) self.sco_links = {} # ScoLinks, by connection handle (BR/EDR only)
self.cis_links = {} # CisLinks, by connection handle (LE only) self.cis_links = {} # CisLinks, by connection handle (LE only)
self._pending_cis = {} # (CIS_ID, CIG_ID), by CIS_handle self._pending_cis = {} # (CIS_ID, CIG_ID), by CIS_handle
@@ -2571,6 +2560,7 @@ class Device(utils.CompositeEventEmitter):
), ),
), ),
) )
self.smp_manager.debug_mode = self.config.smp_debug_mode
self.l2cap_channel_manager.register_fixed_channel(smp.SMP_CID, self.on_smp_pdu) self.l2cap_channel_manager.register_fixed_channel(smp.SMP_CID, self.on_smp_pdu)