samples: bluetooth: hci_uart: Fix command len calculation

Due to a historical error introduced during an hci_uart refactor, the
get_len() function was using the wrong HCI H4 packet identifier for
commands. Instead of using H4_CMD (0x01) it was trying to match
BT_BUF_CMD (0x00).

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
This commit is contained in:
Carles Cufi 2021-09-07 17:03:17 +02:00 committed by Carles Cufí
commit 0552d329c8

View file

@ -78,7 +78,7 @@ static bool valid_type(uint8_t type)
static uint32_t get_len(const uint8_t *hdr_buf, uint8_t type)
{
switch (type) {
case BT_BUF_CMD:
case H4_CMD:
return ((const struct bt_hci_cmd_hdr *)hdr_buf)->param_len;
case H4_ISO:
return sys_le16_to_cpu(((const struct bt_hci_iso_data_hdr *)hdr_buf)->slen);