diff --git a/CHANGELOG.md b/CHANGELOG.md index aa74c8e0e..7ccb0268e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -41,6 +41,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - GAP: allow to disable link supervision timeout - HFP HF: only emit single event for RING and AG Status updates - HFP AG: fix audio connection setup for in-band ringtone on incoming connection +- HFP: fix audio connection setup by HF if codec negotiation is supported ### Changed - HCI: config I2S for BCM Controllers if `ENABLE_SCO_OVER_PCM`, reduce bit clock to 256/512 kHz @@ -67,7 +68,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. events instead of callback, and `RFCOMM_DATA_PACKET` for received data - HSP AG: emit HSP_SUBEVENT_BUTTON_PRESSED instead of audio connection setup/release - Examples: use `btstack_event.h` getters instead of direct array access, use enum to compare status codes -- HFP: provide acl_handle in events to identify connection +- HFP: provide acl_handle in events to identify connection - HCI Transport: extract convenience function declaration for h4, h5, em9304_spi, and usb into separate hci_transport_{type}.h - GATT Client: Use ATT_READ_REQUEST for first blob of Read Long Characteristic and Read Long Characteristic Descriptor - HID: Move `src/classic/hid.h` into `src` and prefix with `btstack_` to use it with BLE and avoid name clashes diff --git a/src/classic/hfp_ag.c b/src/classic/hfp_ag.c index 3c83ea395..528294cc5 100644 --- a/src/classic/hfp_ag.c +++ b/src/classic/hfp_ag.c @@ -553,6 +553,7 @@ static int codecs_exchange_state_machine(hfp_connection_t * hfp_connection){ case HFP_CMD_TRIGGER_CODEC_CONNECTION_SETUP: hfp_connection->codecs_state = HFP_CODECS_RECEIVED_TRIGGER_CODEC_EXCHANGE; + hfp_connection->establish_audio_connection = 1; hfp_ag_send_ok(hfp_connection->rfcomm_cid); return 1; diff --git a/src/classic/hfp_hf.c b/src/classic/hfp_hf.c index c2d8f0e58..699d279f6 100644 --- a/src/classic/hfp_hf.c +++ b/src/classic/hfp_hf.c @@ -1335,7 +1335,6 @@ void hfp_hf_establish_audio_connection(hci_con_handle_t acl_handle){ if (hfp_connection->state >= HFP_W2_DISCONNECT_SCO) return; hfp_connection->trigger_codec_exchange = 0; - hfp_connection->establish_audio_connection = 1; if (!has_codec_negotiation_feature(hfp_connection)){ log_info("no codec negotiation feature, using NBS"); hfp_connection->codecs_state = HFP_CODECS_EXCHANGED; @@ -1343,6 +1342,7 @@ void hfp_hf_establish_audio_connection(hci_con_handle_t acl_handle){ hfp_connection->codec_confirmed = hfp_connection->suggested_codec; hfp_connection->negotiated_codec = hfp_connection->suggested_codec; hfp_init_link_settings(hfp_connection, hfp_hf_esco_s4_supported(hfp_connection)); + hfp_connection->establish_audio_connection = 1; hfp_connection->state = HFP_W4_SCO_CONNECTED; } else { switch (hfp_connection->codecs_state){