hci: provide remote usable sco packet types

This commit is contained in:
Matthias Ringwald 2023-06-01 11:48:18 +02:00
parent 800d8642f5
commit 5f52069457
3 changed files with 22 additions and 0 deletions

View File

@ -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;

View File

@ -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
*/

View File

@ -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;
}