mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-01-05 21:59:45 +00:00
hfp_hf, hsp_hs: use eSCO params in accept sco connection only for incoming eSCO connections
This commit is contained in:
parent
9b64c21da4
commit
c169df2f88
@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
||||
## [Unreleased]
|
||||
|
||||
### Fixed
|
||||
- hfp_hf, hsp_hs: use eSCO params in accept sco connection only for incoming eSCO connections
|
||||
|
||||
### Added
|
||||
|
||||
|
@ -633,8 +633,12 @@ void hfp_handle_hci_event(uint8_t packet_type, uint16_t channel, uint8_t *packet
|
||||
hci_event_connection_request_get_bd_addr(packet, event_addr);
|
||||
hfp_connection = get_hfp_connection_context_for_bd_addr(event_addr, local_role);
|
||||
if (!hfp_connection) break;
|
||||
log_info("hf accept sco\n");
|
||||
hfp_connection->hf_accept_sco = 1;
|
||||
if (hci_event_connection_request_get_link_type(packet) == 2){
|
||||
hfp_connection->hf_accept_sco = 2;
|
||||
} else {
|
||||
hfp_connection->hf_accept_sco = 1;
|
||||
}
|
||||
log_info("hf accept sco %u\n", hfp_connection->hf_accept_sco);
|
||||
if (!hfp_hf_run_for_context) break;
|
||||
(*hfp_hf_run_for_context)(hfp_connection);
|
||||
break;
|
||||
|
@ -593,6 +593,7 @@ static void hfp_run_for_context(hfp_connection_t * hfp_connection){
|
||||
|
||||
if (hfp_connection->hf_accept_sco && hci_can_send_command_packet_now()){
|
||||
|
||||
bool eSCO = hfp_connection->hf_accept_sco == 2;
|
||||
hfp_connection->hf_accept_sco = 0;
|
||||
|
||||
// notify about codec selection if not done already
|
||||
@ -606,7 +607,7 @@ static void hfp_run_for_context(hfp_connection_t * hfp_connection){
|
||||
uint8_t retransmission_effort;
|
||||
uint16_t packet_types;
|
||||
|
||||
if (hci_extended_sco_link_supported() && hci_remote_esco_supported(hfp_connection->acl_handle)){
|
||||
if (eSCO && hci_extended_sco_link_supported() && hci_remote_esco_supported(hfp_connection->acl_handle)){
|
||||
max_latency = 0x000c;
|
||||
retransmission_effort = 0x02;
|
||||
packet_types = 0x388;
|
||||
|
@ -369,6 +369,8 @@ static void hsp_run(void){
|
||||
if (wait_ok) return;
|
||||
|
||||
if (hs_accept_sco_connection && hci_can_send_command_packet_now()){
|
||||
|
||||
bool eSCO = hs_accept_sco_connection == 2;
|
||||
hs_accept_sco_connection = 0;
|
||||
|
||||
log_info("HSP: sending hci_accept_connection_request.");
|
||||
@ -377,8 +379,8 @@ static void hsp_run(void){
|
||||
uint16_t max_latency;
|
||||
uint8_t retransmission_effort;
|
||||
uint16_t packet_types;
|
||||
|
||||
if (hci_remote_esco_supported(rfcomm_handle)){
|
||||
|
||||
if (eSCO && hci_extended_sco_link_supported() && hci_remote_esco_supported(rfcomm_handle)){
|
||||
max_latency = 0x000c;
|
||||
retransmission_effort = 0x02;
|
||||
packet_types = 0x388;
|
||||
@ -529,12 +531,13 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack
|
||||
case 0: // SCO
|
||||
case 2: // eSCO
|
||||
hci_event_connection_request_get_bd_addr(packet, event_addr);
|
||||
printf("remote device %s\n", bd_addr_to_str(remote));
|
||||
printf("accept sco for device %s\n", bd_addr_to_str(event_addr));
|
||||
|
||||
if (bd_addr_cmp(event_addr, remote) == 0){
|
||||
printf("hs_accept_sco_connection \n");
|
||||
hs_accept_sco_connection = 1;
|
||||
if (hci_event_connection_request_get_link_type(packet) == 2){
|
||||
hs_accept_sco_connection = 2;
|
||||
} else {
|
||||
hs_accept_sco_connection = 1;
|
||||
}
|
||||
log_info("hs_accept_sco_connection %u", hs_accept_sco_connection);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user