mirror of
https://github.com/apache/nuttx.git
synced 2026-05-30 21:36:28 +08:00
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:
@@ -133,6 +133,21 @@ static bool bt_filter_set(FAR uint16_t *array, int size, uint16_t old,
|
|||||||
return false;
|
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,
|
static bool bt_filter_set_handle(FAR uint16_t *handle, int size,
|
||||||
uint16_t old, uint16_t new)
|
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];
|
evt = (FAR void *)&buffer[2];
|
||||||
ogf = evt->opcode >> 10;
|
ogf = evt->opcode >> 10;
|
||||||
|
|
||||||
if (BT_OGF_BASEBAND == ogf || BT_OGF_LINK_CTRL == ogf
|
if (bt_filter_ogf_is_valid(ogf))
|
||||||
|| BT_OGF_INFO == ogf || BT_OGF_LE == ogf)
|
|
||||||
{
|
{
|
||||||
return bt_filter_free_opcode(filter, evt->opcode);
|
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];
|
stat = (FAR void *)&buffer[2];
|
||||||
ogf = stat->opcode >> 10;
|
ogf = stat->opcode >> 10;
|
||||||
|
|
||||||
if (BT_OGF_BASEBAND == ogf || BT_OGF_LINK_CTRL == ogf
|
if (bt_filter_ogf_is_valid(ogf))
|
||||||
|| BT_OGF_INFO == ogf || BT_OGF_LE == ogf)
|
|
||||||
{
|
{
|
||||||
return bt_filter_free_opcode(filter, stat->opcode);
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (BT_OGF_BASEBAND == ogf || BT_OGF_LINK_CTRL == ogf
|
if (bt_filter_ogf_is_valid(ogf))
|
||||||
|| BT_OGF_INFO == ogf || BT_OGF_LE == ogf)
|
|
||||||
{
|
{
|
||||||
if (!bt_filter_alloc_opcode(filter, opcode))
|
if (!bt_filter_alloc_opcode(filter, opcode))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -113,6 +113,7 @@
|
|||||||
#define BT_OGF_INFO 0x04
|
#define BT_OGF_INFO 0x04
|
||||||
#define BT_OGF_STATUS 0x05
|
#define BT_OGF_STATUS 0x05
|
||||||
#define BT_OGF_LE 0x08
|
#define BT_OGF_LE 0x08
|
||||||
|
#define BT_OGF_VS_RTK 0x3f
|
||||||
|
|
||||||
/* Construct OpCode from OGF and OCF */
|
/* Construct OpCode from OGF and OCF */
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user