diff --git a/bumble/device.py b/bumble/device.py index f3b431c5..b39299cb 100644 --- a/bumble/device.py +++ b/bumble/device.py @@ -5442,7 +5442,7 @@ async def create_cs_config( role: int = hci.CsRole.INITIATOR, rtt_type: int = hci.RttType.AA_ONLY, cs_sync_phy: int = hci.CsSyncPhy.LE_1M, - channel_map: bytes = b'\x54\x55\x55\x54\x55\x55\x55\x55\x55\x15', + channel_map: bytes = b'\x54\x55\x55\x54\x55\x55\x55\x55\x55\x05', channel_map_repetition: int = 0x01, channel_selection_type: int = hci.HCI_LE_CS_Create_Config_Command.ChannelSelectionType.ALGO_3B, ch3c_shape: int = hci.HCI_LE_CS_Create_Config_Command.Ch3cShape.HAT, diff --git a/tests/device_test.py b/tests/device_test.py index 3efe4db1..c148fa4d 100644 --- a/tests/device_test.py +++ b/tests/device_test.py @@ -16,6 +16,7 @@ # Imports # ----------------------------------------------------------------------------- import asyncio +import inspect import functools import logging import os @@ -693,6 +694,25 @@ async def test_power_on_default_static_address_should_not_be_any(): assert devices[0].static_address != Address.ANY_RANDOM +# ----------------------------------------------------------------------------- +def test_cs_channel_map_excludes_forbidden_channels(): + forbidden = {0, 1, 23, 24, 25, 76, 77, 78, 79} + default_map = inspect.signature(Device.create_cs_config).parameters[ + 'channel_map' + ].default + + enabled = { + byte_idx * 8 + bit + for byte_idx, byte in enumerate(default_map) + for bit in range(8) + if byte & (1 << bit) + } + + assert enabled.isdisjoint(forbidden), ( + f"Default channel_map enables forbidden CS channels: {enabled & forbidden}" + ) + + # ----------------------------------------------------------------------------- def test_gatt_services_with_gas_and_gatt(): device = Device(host=Host(None, None))