From c8787e1c149dc401ca251cb91c411c1d67f504d2 Mon Sep 17 00:00:00 2001 From: Deokhyun Kim Date: Fri, 26 Jul 2019 18:03:00 +0900 Subject: [PATCH] Apply avrcp ct connect timeout to 8 sec only for Bose speaker - Race condition occurs when requesting L2CAP AVRCP connection Sometimes AVRCP connection request by Bose is delayed. It can conflict Apply avrcp ct connect timeout to 8 sec only for Bose speaker Change-Id: Ib8ca44f61aae47b9c58af38999c6ce2959f3c6e7 Signed-off-by: Deokhyun Kim --- plugins/policy.c | 19 ++++++++++++++++--- profiles/audio/avdtp.c | 3 ++- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/plugins/policy.c b/plugins/policy.c index caa3e37..5db4875 100755 --- a/plugins/policy.c +++ b/plugins/policy.c @@ -297,22 +297,35 @@ static void sink_cb(struct btd_service *service, btd_service_state_t old_state, data->sink_timer = 0; } +#ifdef TIZEN_FEATURE_BLUEZ_MODIFY + char address[18]; + int timeout = CONTROL_CONNECT_TIMEOUT; + ba2str(device_get_address(dev), address); + if (!strncasecmp(address, "00:0C:8A", 8) || + !strncasecmp(address, "08:DF:1F", 8)) + timeout = CONTROL_CONNECT_TIMEOUT * 2; /* Check if service initiate the connection then proceed * immediatelly otherwise set timer */ if (old_state == BTD_SERVICE_STATE_CONNECTING) -#ifdef TIZEN_FEATURE_BLUEZ_MODIFY /* Set timer as most of the devices initiate * avrcp connection immediately; irrespective of local * or remote initiated a2dp connection */ - policy_set_ct_timer(data, CONTROL_CONNECT_TIMEOUT); + policy_set_ct_timer(data, timeout); + else if (btd_service_get_state(controller) != + BTD_SERVICE_STATE_CONNECTED) + policy_set_ct_timer(data, timeout); #else + /* Check if service initiate the connection then proceed + * immediatelly otherwise set timer + */ + if (old_state == BTD_SERVICE_STATE_CONNECTING) policy_connect(data, controller); -#endif else if (btd_service_get_state(controller) != BTD_SERVICE_STATE_CONNECTED) policy_set_ct_timer(data, CONTROL_CONNECT_TIMEOUT); +#endif break; case BTD_SERVICE_STATE_DISCONNECTING: break; diff --git a/profiles/audio/avdtp.c b/profiles/audio/avdtp.c index b20c408..60d9253 100644 --- a/profiles/audio/avdtp.c +++ b/profiles/audio/avdtp.c @@ -3937,7 +3937,8 @@ int avdtp_start(struct avdtp *session, struct avdtp_stream *stream) ba2str(device_get_address(session->device), address); /* For Bose headset (Bose AE2w) 2 seconds timeout is required to avoid AVDTP ABORT_CMD */ - if (!strncasecmp(address, "00:0C:8A", 8)) + if (!strncasecmp(address, "00:0C:8A", 8) || + !strncasecmp(address, "08:DF:1F", 8)) timeout_sec = 2; /* For Gear Circle, HS3000 headset, this headset doesn't initiate start command and * when we add timer for 1 second so idle may trigger callback after 1.2 sec or -- 2.7.4