diff --git a/src/hci.c b/src/hci.c index b27ed3d70..a8d5859dc 100644 --- a/src/hci.c +++ b/src/hci.c @@ -2542,6 +2542,8 @@ static void hci_handle_remote_features_page_0(hci_connection_t * conn, const uin if (features[7] & (1<<7)){ conn->remote_supported_features[0] |= 2; } + // SCO packet types + conn->remote_supported_sco_packets = hci_sco_packet_types_for_features(features); } static void hci_handle_remote_features_page_1(hci_connection_t * conn, const uint8_t * features){ @@ -7820,6 +7822,12 @@ bool hci_remote_esco_supported(hci_con_handle_t con_handle){ return (connection->remote_supported_features[0] & 1) != 0; } +uint16_t hci_remote_sco_packet_types(hci_con_handle_t con_handle){ + hci_connection_t * connection = hci_connection_for_handle(con_handle); + if (!connection) return 0; + return connection->remote_supported_sco_packets; +} + static bool hci_ssp_supported(hci_connection_t * connection){ const uint8_t mask = BONDING_REMOTE_SUPPORTS_SSP_CONTROLLER | BONDING_REMOTE_SUPPORTS_SSP_HOST; return (connection->bonding_flags & mask) == mask; diff --git a/src/hci.h b/src/hci.h index e17dad002..8b34ff199 100644 --- a/src/hci.h +++ b/src/hci.h @@ -556,6 +556,9 @@ typedef struct { link_key_type_t link_key_type; #ifdef ENABLE_CLASSIC + // remote supported SCO packets based on remote supported features mask + uint16_t remote_supported_sco_packets; + // remote supported features /* bit 0 - eSCO */ /* bit 1 - extended features */ @@ -1614,9 +1617,16 @@ void hci_disconnect_security_block(hci_con_handle_t con_handle); /** * Query if remote side supports eSCO + * @param con_handle */ bool hci_remote_esco_supported(hci_con_handle_t con_handle); +/** + * Query remote supported SCO packets based on remote supported features + * @param con_handle + */ +uint16_t hci_remote_sco_packet_types(hci_con_handle_t con_handle); + /** * Emit current HCI state. Called by daemon */ diff --git a/test/hfp/mock.c b/test/hfp/mock.c index 9ab159e6b..8d6ee8fd8 100644 --- a/test/hfp/mock.c +++ b/test/hfp/mock.c @@ -408,6 +408,10 @@ bool gap_secure_connection(hci_con_handle_t con_handle){ return true; } +uint16_t hci_remote_sco_packet_types(hci_con_handle_t con_handle){ + UNUSED(con_handle); + return SCO_PACKET_TYPES_ALL; +} uint16_t hci_usable_sco_packet_types(void){ return SCO_PACKET_TYPES_ALL; }