tools/hci_throughput: fix supported octets info

This commit is contained in:
Jakub
2022-06-22 10:04:26 +02:00
committed by Szymon Janc
parent b8d1180bf6
commit b2d682bf51
2 changed files with 7 additions and 4 deletions
+2
View File
@@ -31,6 +31,8 @@ HCI_COMMAND_PACKET = 0x01
HCI_ACL_DATA_PACKET = 0x02
HCI_EVENT_PACKET = 0x04
L2CAP_HDR_BYTES = 4
HCI_EV_CODE_DISCONN_CMP = 0x05
HCI_EV_CODE_CMD_CMP = 0x0e
HCI_EV_CODE_CMD_STATUS = 0x0f
+5 -4
View File
@@ -422,10 +422,11 @@ class HCI_Commands():
hci.max_data_len.set(*struct.unpack("<BHHHH",
current_ev.return_parameters))
logging.info(f"Suggested Max Data Len: {hci.max_data_len}")
if (hci.num_of_bytes_to_send > hci.max_data_len.supported_max_tx_octets - 4):
logging.critical(f"Number of bytes to send: {hci.num_of_bytes_to_send}\
not supported. Closing.")
raise SystemExit("Number of bytes to send not supported. Closing.")
if (hci.num_of_bytes_to_send > hci.max_data_len.supported_max_tx_octets - hci.L2CAP_HDR_BYTES):
logging.critical(f"Number of data bytes to send + 4 bytes of L2CAP header: {hci.num_of_bytes_to_send + 4} "
f"exceeds allowed value of: {hci.max_data_len.supported_max_tx_octets}. Closing.")
raise SystemExit(f"Number of data bytes to send + 4 bytes of L2CAP header: {hci.num_of_bytes_to_send + 4} "
f"exceeds allowed value of: {hci.max_data_len.supported_max_tx_octets}. Closing.")
return status()
elif ocf == hci.OCF_LE_READ_PHY: