bluetooth: fix bt bridge would not filter vendor hci cmd

when downloading rtk firmware with vendor hci cmd sending to
bt bridge, which would not filter that hci cmd.

Signed-off-by: chengkai <chengkai@xiaomi.com>
This commit is contained in:
chengkai
2023-12-04 18:06:37 +08:00
committed by Xiang Xiao
parent f0b7f48adf
commit 8e17e1657b
2 changed files with 19 additions and 6 deletions
+18 -6
View File
@@ -133,6 +133,21 @@ static bool bt_filter_set(FAR uint16_t *array, int size, uint16_t old,
return false;
}
static bool bt_filter_ogf_is_valid(uint8_t ogf)
{
switch (ogf)
{
case BT_OGF_BASEBAND:
case BT_OGF_LINK_CTRL:
case BT_OGF_INFO:
case BT_OGF_LE:
case BT_OGF_VS_RTK:
return true;
default:
return false;
}
}
static bool bt_filter_set_handle(FAR uint16_t *handle, int size,
uint16_t old, uint16_t new)
{
@@ -292,8 +307,7 @@ static bool bt_filter_can_recv(FAR struct bt_filter_s *filter,
evt = (FAR void *)&buffer[2];
ogf = evt->opcode >> 10;
if (BT_OGF_BASEBAND == ogf || BT_OGF_LINK_CTRL == ogf
|| BT_OGF_INFO == ogf || BT_OGF_LE == ogf)
if (bt_filter_ogf_is_valid(ogf))
{
return bt_filter_free_opcode(filter, evt->opcode);
}
@@ -314,8 +328,7 @@ static bool bt_filter_can_recv(FAR struct bt_filter_s *filter,
stat = (FAR void *)&buffer[2];
ogf = stat->opcode >> 10;
if (BT_OGF_BASEBAND == ogf || BT_OGF_LINK_CTRL == ogf
|| BT_OGF_INFO == ogf || BT_OGF_LE == ogf)
if (bt_filter_ogf_is_valid(ogf))
{
return bt_filter_free_opcode(filter, stat->opcode);
}
@@ -372,8 +385,7 @@ static bool bt_filter_can_send(FAR struct bt_filter_s *filter,
break;
}
if (BT_OGF_BASEBAND == ogf || BT_OGF_LINK_CTRL == ogf
|| BT_OGF_INFO == ogf || BT_OGF_LE == ogf)
if (bt_filter_ogf_is_valid(ogf))
{
if (!bt_filter_alloc_opcode(filter, opcode))
{