Skip to content

Commit 8e17e16

Browse files
chengkai15xiaoxiang781216
authored andcommitted
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 <[email protected]>
1 parent f0b7f48 commit 8e17e16

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

drivers/wireless/bluetooth/bt_bridge.c

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,21 @@ static bool bt_filter_set(FAR uint16_t *array, int size, uint16_t old,
133133
return false;
134134
}
135135

136+
static bool bt_filter_ogf_is_valid(uint8_t ogf)
137+
{
138+
switch (ogf)
139+
{
140+
case BT_OGF_BASEBAND:
141+
case BT_OGF_LINK_CTRL:
142+
case BT_OGF_INFO:
143+
case BT_OGF_LE:
144+
case BT_OGF_VS_RTK:
145+
return true;
146+
default:
147+
return false;
148+
}
149+
}
150+
136151
static bool bt_filter_set_handle(FAR uint16_t *handle, int size,
137152
uint16_t old, uint16_t new)
138153
{
@@ -292,8 +307,7 @@ static bool bt_filter_can_recv(FAR struct bt_filter_s *filter,
292307
evt = (FAR void *)&buffer[2];
293308
ogf = evt->opcode >> 10;
294309

295-
if (BT_OGF_BASEBAND == ogf || BT_OGF_LINK_CTRL == ogf
296-
|| BT_OGF_INFO == ogf || BT_OGF_LE == ogf)
310+
if (bt_filter_ogf_is_valid(ogf))
297311
{
298312
return bt_filter_free_opcode(filter, evt->opcode);
299313
}
@@ -314,8 +328,7 @@ static bool bt_filter_can_recv(FAR struct bt_filter_s *filter,
314328
stat = (FAR void *)&buffer[2];
315329
ogf = stat->opcode >> 10;
316330

317-
if (BT_OGF_BASEBAND == ogf || BT_OGF_LINK_CTRL == ogf
318-
|| BT_OGF_INFO == ogf || BT_OGF_LE == ogf)
331+
if (bt_filter_ogf_is_valid(ogf))
319332
{
320333
return bt_filter_free_opcode(filter, stat->opcode);
321334
}
@@ -372,8 +385,7 @@ static bool bt_filter_can_send(FAR struct bt_filter_s *filter,
372385
break;
373386
}
374387

375-
if (BT_OGF_BASEBAND == ogf || BT_OGF_LINK_CTRL == ogf
376-
|| BT_OGF_INFO == ogf || BT_OGF_LE == ogf)
388+
if (bt_filter_ogf_is_valid(ogf))
377389
{
378390
if (!bt_filter_alloc_opcode(filter, opcode))
379391
{

include/nuttx/wireless/bluetooth/bt_hci.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@
113113
#define BT_OGF_INFO 0x04
114114
#define BT_OGF_STATUS 0x05
115115
#define BT_OGF_LE 0x08
116+
#define BT_OGF_VS_RTK 0x3f
116117

117118
/* Construct OpCode from OGF and OCF */
118119

0 commit comments

Comments
 (0)