Skip to content
Merged
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
7 changes: 2 additions & 5 deletions bumble/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -1578,15 +1578,12 @@ class CisParameters:

def __post_init__(self) -> None:
# For unidirectional CIS (e.g., Central-to-Peripheral only), the unused direction's
# SDU size is 0. If SDU size is 0, the corresponding retransmission count and PHY
# must also be set to 0. Otherwise, some controllers will reject the parameters
# with error 0x30 (Parameter Out Of Mandatory Range).
# SDU size is 0. If SDU size is 0, we set RTN to 0 as well for maintaining
# compatibility with older firmware that has error 0x30 bug.
if self.max_sdu_c_to_p == 0:
self.rtn_c_to_p = 0
self.phy_c_to_p = hci.PhyBit(0)
if self.max_sdu_p_to_c == 0:
self.rtn_p_to_c = 0
self.phy_p_to_c = hci.PhyBit(0)

cig_id: int
cis_parameters: list[CisParameters]
Expand Down
4 changes: 2 additions & 2 deletions tests/device_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -604,15 +604,15 @@ def test_cis_parameters_unidirectional():
assert cis_c2p.rtn_c_to_p != 0
assert cis_c2p.phy_c_to_p != hci.PhyBit(0)
assert cis_c2p.rtn_p_to_c == 0
assert cis_c2p.phy_p_to_c == hci.PhyBit(0)
assert cis_c2p.phy_p_to_c != hci.PhyBit(0)

# Test P2C unidirectional (C to P not used)
cis_p2c = CigParameters.CisParameters(cis_id=2, max_sdu_c_to_p=0)
assert cis_p2c.max_sdu_p_to_c != 0
assert cis_p2c.rtn_p_to_c != 0
assert cis_p2c.phy_p_to_c != hci.PhyBit(0)
assert cis_p2c.rtn_c_to_p == 0
assert cis_p2c.phy_c_to_p == hci.PhyBit(0)
assert cis_p2c.phy_c_to_p != hci.PhyBit(0)


# -----------------------------------------------------------------------------
Expand Down
Loading