Apply avrcp ct connect timeout to 8 sec only for Bose speaker 58/210958/1 accepted/tizen/unified/20190729.081028 submit/tizen/20190729.004732
authorDeokhyun Kim <dukan.kim@samsung.com>
Fri, 26 Jul 2019 09:03:00 +0000 (18:03 +0900)
committerDeokhyun Kim <dukan.kim@samsung.com>
Fri, 26 Jul 2019 09:03:00 +0000 (18:03 +0900)
  - 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 <dukan.kim@samsung.com>
plugins/policy.c
profiles/audio/avdtp.c

index caa3e37..5db4875 100755 (executable)
@@ -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;
index b20c408..60d9253 100644 (file)
@@ -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