diff --git a/src/l2cap.c b/src/l2cap.c index 16f2c5f7a..74faa29d9 100644 --- a/src/l2cap.c +++ b/src/l2cap.c @@ -2463,9 +2463,26 @@ static void l2cap_acl_handler(uint8_t packet_type, uint16_t channel, uint8_t *pa uint16_t control = little_endian_read_16(packet, COMPLETE_L2CAP_HEADER); uint8_t req_seq = (control >> 8) & 0x3f; if (control & 1){ - // int poll = (control >> 7) & 0x01; - log_info("S-Frame not not implemented yet"); // S-Frame + // int poll = (control >> 7) & 0x01; + l2cap_supervisory_function_t s = (l2cap_supervisory_function_t) ((control >> 2) & 0x03); + l2cap_ertm_tx_packet_state_t * tx_state; + switch (s){ + case L2CAP_SUPERVISORY_FUNCTION_RR_RECEIVER_READY: + tx_state = &l2cap_channel->tx_packets_state[l2cap_channel->tx_read_index]; + if ( ((req_seq - 1) & 0x3f) == tx_state->tx_seq){ + log_info("RR seq %u == seq of oldest tx packet -> packet done", req_seq); + l2cap_channel->tx_read_index++; + if (l2cap_channel->tx_read_index >= l2cap_channel->num_rx_buffers){ + l2cap_channel->tx_read_index = 0; + } + } else { + log_info("RR seq %u != seq of oldest tx packet %u ???", req_seq, tx_state->tx_seq); + } + break; + default: + break; + } break; } else { // I-Frame