Skip to content

Commit c55fcb5

Browse files
chengkai15xiaoxiang781216
authored andcommitted
bluetooth:fix bt bridge acl data connect handle not match
bt bridge filter would not match when ACL in data head with Packet_Boundary_Flag 0b10. in that case connect handle is the first 3 octets of the packet, which not match BT_HCI_EVT_LE_CONN_COMPLETE hci event alloc handle. Signed-off-by: chengkai <[email protected]>
1 parent a9db2f1 commit c55fcb5

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

drivers/wireless/bluetooth/bt_bridge.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,15 +117,15 @@ static const uint8_t g_bt_filter_ble_evt_table[] =
117117
****************************************************************************/
118118

119119
static bool bt_filter_set(FAR uint16_t *array, int size, uint16_t old,
120-
uint16_t new, uint16_t mask)
120+
uint16_t new)
121121
{
122122
int i;
123123

124124
for (i = 0; i < size; i++)
125125
{
126126
if (array[i] == old)
127127
{
128-
array[i] = new & mask;
128+
array[i] = new;
129129
return true;
130130
}
131131
}
@@ -136,7 +136,7 @@ static bool bt_filter_set(FAR uint16_t *array, int size, uint16_t old,
136136
static bool bt_filter_set_handle(FAR uint16_t *handle, int size,
137137
uint16_t old, uint16_t new)
138138
{
139-
return bt_filter_set(handle, size, old, new, 0xfff);
139+
return bt_filter_set(handle, size, old, new);
140140
}
141141

142142
static bool bt_filter_alloc_handle(FAR struct bt_filter_s *filter,
@@ -163,7 +163,7 @@ static bool bt_filter_has_handle(FAR struct bt_filter_s *filter,
163163
static bool bt_filter_set_opcode(FAR uint16_t *opcode, int size,
164164
uint16_t old, uint16_t new)
165165
{
166-
return bt_filter_set(opcode, size, old, new, 0xffff);
166+
return bt_filter_set(opcode, size, old, new);
167167
}
168168

169169
static bool bt_filter_alloc_opcode(FAR struct bt_filter_s *filter,
@@ -335,7 +335,11 @@ static bool bt_filter_can_recv(FAR struct bt_filter_s *filter,
335335
{
336336
FAR struct bt_hci_acl_hdr_s *acl = (FAR void *)&buffer[0];
337337

338-
return bt_filter_has_handle(filter, acl->handle);
338+
/* When in HCI ACL Data packets, connection handle is
339+
* the first 3 octets of the packet
340+
*/
341+
342+
return bt_filter_has_handle(filter, acl->handle & 0x0fff);
339343
}
340344

341345
return true;

0 commit comments

Comments
 (0)