Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bumble/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
20 changes: 20 additions & 0 deletions tests/device_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
# Imports
# -----------------------------------------------------------------------------
import asyncio
import inspect
import functools
import logging
import os
Expand Down Expand Up @@ -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))
Expand Down
Loading