diff --git a/CHANGELOG.md b/CHANGELOG.md index 353ace151..42e0bb703 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Added - L2CAP: emit L2CAP_EVENT_ERTM_BUFFER_RELEASED if ERTM buffer not needed/used anymore +- L2CAP: add fcs_option to ERTM config l2cap_ertm_config_t ## Changes December 2018 diff --git a/example/avrcp_browsing_client.c b/example/avrcp_browsing_client.c index fc05fea19..79dd8b979 100644 --- a/example/avrcp_browsing_client.c +++ b/example/avrcp_browsing_client.c @@ -127,6 +127,7 @@ static l2cap_ertm_config_t ertm_config = { 144, // l2cap ertm mtu 4, 4, + 0, // No FCS }; diff --git a/src/classic/goep_client.c b/src/classic/goep_client.c index ad6e776fa..44d1a5fa4 100644 --- a/src/classic/goep_client.c +++ b/src/classic/goep_client.c @@ -112,6 +112,7 @@ static l2cap_ertm_config_t ertm_config = { 512, // l2cap ertm mtu 2, 2, + 0, // No FCS }; #endif diff --git a/src/l2cap.c b/src/l2cap.c index e17a23c9f..6043003bb 100644 --- a/src/l2cap.c +++ b/src/l2cap.c @@ -408,7 +408,9 @@ static uint16_t l2cap_setup_options_ertm_request(l2cap_channel_t * channel, uint config_options[pos++] = 2; // length little_endian_store_16(config_options, pos, channel->local_mtu); pos += 2; - // + + // Issue: iOS (e.g. 10.2) uses "No FCS" as default while Core 5.0 specifies "FCS" as default + // Workaround: try to actively negotiate FCS option config_options[pos++] = L2CAP_CONFIG_OPTION_TYPE_FRAME_CHECK_SEQUENCE; config_options[pos++] = 1; // length config_options[pos++] = channel->fcs_option; @@ -521,10 +523,7 @@ static void l2cap_ertm_configure_channel(l2cap_channel_t * channel, l2cap_ertm_c pos += ertm_config->num_rx_buffers * channel->local_mps; channel->tx_packets_data = &buffer[pos]; - // Issue: iOS (e.g. 10.2) uses "No FCS" as default while Core 5.0 specifies "FCS" as default - // Workaround: try to actively negotiate "No FCS" and fall back to "FCS" if "No FCS" is rejected - // This works as iOS accepts the "No FCS" request, hence the default value is only used on non-iOS devices - channel->fcs_option = 0; + channel->fcs_option = ertm_config->fcs_option; } uint8_t l2cap_create_ertm_channel(btstack_packet_handler_t packet_handler, bd_addr_t address, uint16_t psm, diff --git a/src/l2cap.h b/src/l2cap.h index a9bbf5f24..fe14a752d 100644 --- a/src/l2cap.h +++ b/src/l2cap.h @@ -159,6 +159,9 @@ typedef struct { // Number of packets that can be received out of order (-> our tx_window size) uint8_t num_rx_buffers; + // Frame Check Sequence (FCS) Option + uint8_t fcs_option; + } l2cap_ertm_config_t; // info regarding an actual channel