mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-04-07 16:20:19 +00:00
l2cap-ertm: emit L2CAP_EVENT_ERTM_BUFFER_RELEASED for remote without ERTM support only if ERTM was requested by client
This commit is contained in:
parent
bd539f2b3e
commit
dae3b2ab07
15
src/l2cap.c
15
src/l2cap.c
@ -2902,11 +2902,11 @@ static void l2cap_signaling_handler_dispatch(hci_con_handle_t handle, uint8_t *
|
|||||||
// outgoing connection
|
// outgoing connection
|
||||||
if (channel->state == L2CAP_STATE_WAIT_OUTGOING_EXTENDED_FEATURES){
|
if (channel->state == L2CAP_STATE_WAIT_OUTGOING_EXTENDED_FEATURES){
|
||||||
|
|
||||||
// verify ERTM requirements
|
// if ERTM was requested, but is not listed in extended feature mask:
|
||||||
if ((channel->mode == L2CAP_CHANNEL_MODE_ENHANCED_RETRANSMISSION) && ((connection->l2cap_state.extended_feature_mask & 0x08) == 0)){
|
if ((channel->mode == L2CAP_CHANNEL_MODE_ENHANCED_RETRANSMISSION) && ((connection->l2cap_state.extended_feature_mask & 0x08) == 0)){
|
||||||
// bail if ERTM was requested but is not supported
|
|
||||||
if (channel->ertm_mandatory){
|
if (channel->ertm_mandatory){
|
||||||
// channel closed
|
// bail if ERTM is mandatory
|
||||||
channel->state = L2CAP_STATE_CLOSED;
|
channel->state = L2CAP_STATE_CLOSED;
|
||||||
// map l2cap connection response result to BTstack status enumeration
|
// map l2cap connection response result to BTstack status enumeration
|
||||||
l2cap_handle_channel_open_failed(channel, L2CAP_CONNECTION_RESPONSE_RESULT_ERTM_NOT_SUPPORTED);
|
l2cap_handle_channel_open_failed(channel, L2CAP_CONNECTION_RESPONSE_RESULT_ERTM_NOT_SUPPORTED);
|
||||||
@ -2914,11 +2914,12 @@ static void l2cap_signaling_handler_dispatch(hci_con_handle_t handle, uint8_t *
|
|||||||
btstack_linked_list_remove(&l2cap_channels, (btstack_linked_item_t *) channel);
|
btstack_linked_list_remove(&l2cap_channels, (btstack_linked_item_t *) channel);
|
||||||
l2cap_free_channel_entry(channel);
|
l2cap_free_channel_entry(channel);
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// fallback to Basic mode
|
||||||
|
l2cap_emit_simple_event_with_cid(channel, L2CAP_EVENT_ERTM_BUFFER_RELEASED);
|
||||||
|
channel->mode = L2CAP_CHANNEL_MODE_BASIC;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
// fallback to Basic mode
|
|
||||||
l2cap_emit_simple_event_with_cid(channel, L2CAP_EVENT_ERTM_BUFFER_RELEASED);
|
|
||||||
channel->mode = L2CAP_CHANNEL_MODE_BASIC;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// respond to connection request
|
// respond to connection request
|
||||||
|
Loading…
x
Reference in New Issue
Block a user