Bluetooth: Don't send the sco vendor commands to other vendor chips
authorDoHyun Pyun <dh79.pyun@samsung.com>
Fri, 21 Oct 2016 00:10:04 +0000 (09:10 +0900)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Wed, 14 Dec 2016 04:53:29 +0000 (13:53 +0900)
There are BCM sco WBC/NBC commands, and they are only for BCM chips.
So this patch fix not to send the sco commands to non BCM vendor
chips which causes sco command timeout and disconnection.

Change-Id: Iae67b6e6de2ecf68b79e47136c2b80aa530a281c
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
net/bluetooth/sco.c

index b20345885c820eaae9b823749bb0f15edb04c83d..f8ec5b42946a7e700f79249d89aa25d27385e338 100644 (file)
@@ -1118,6 +1118,9 @@ void sco_connect_set_gw_nbc(struct hci_dev *hdev)
        hci_send_cmd(hdev, HCI_OP_WRITE_VOICE_SETTING, sizeof(cp1), &cp1);
        hdev->voice_setting = cpu_to_le16(0x0060);
 
+       if (hdev->manufacturer != 0x000F)
+               return;
+
        cp2.role = 0x00;  /* WbDisable */
        cp2.pkt_type = cpu_to_le16(0x0002);
        hci_send_cmd(hdev, HCI_BCM_ENABLE_WBS_REQ, sizeof(cp2), &cp2);
@@ -1148,6 +1151,9 @@ void sco_connect_set_gw_wbc(struct hci_dev *hdev)
        hci_send_cmd(hdev, HCI_OP_WRITE_VOICE_SETTING, sizeof(cp1), &cp1);
        hdev->voice_setting = cpu_to_le16(0x0003 | 0x0060);
 
+       if (hdev->manufacturer != 0x000F)
+               return;
+
        cp2.role = 0x01; /* Enable */
        cp2.pkt_type = cpu_to_le16(0x0002);
        hci_send_cmd(hdev, HCI_BCM_ENABLE_WBS_REQ, sizeof(cp2), &cp2);
@@ -1179,6 +1185,9 @@ void sco_connect_set_nbc(struct hci_dev *hdev)
        hci_send_cmd(hdev, HCI_OP_WRITE_VOICE_SETTING, sizeof(cp1), &cp1);
        hdev->voice_setting = cpu_to_le16(0x0060);
 
+       if (hdev->manufacturer != 0x000F)
+               return;
+
        cp2.role = 0x00; /* WbDisable */
        cp2.pkt_type = cpu_to_le16(0x0002);
        hci_send_cmd(hdev, HCI_BCM_ENABLE_WBS_REQ, sizeof(cp2), &cp2);
@@ -1209,6 +1218,9 @@ void sco_connect_set_wbc(struct hci_dev *hdev)
        hci_send_cmd(hdev, HCI_OP_WRITE_VOICE_SETTING, sizeof(cp1), &cp1);
        hdev->voice_setting = cpu_to_le16(0x0003 | 0x0060);
 
+       if (hdev->manufacturer != 0x000F)
+               return;
+
        cp2.role = 0x01; /* Enable */
        cp2.pkt_type = cpu_to_le16(0x0002);
        hci_send_cmd(hdev, HCI_BCM_ENABLE_WBS_REQ, sizeof(cp2), &cp2);
@@ -1260,6 +1272,9 @@ int sco_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, __u8 *flags)
        read_unlock(&sco_sk_list.lock);
 
 #ifdef TIZEN_BT
+       if (hdev->manufacturer != 0x000F)
+               return lm;
+
        /* WBC/NBC feature */
        if ((lm & HCI_LM_ACCEPT) && !hci_conn_hash_lookup_sco(hdev)) {
                struct hci_conn *hcon_acl;
@@ -1308,7 +1323,8 @@ static void sco_connect_cfm(struct hci_conn *hcon, __u8 status)
 
 #ifdef TIZEN_BT
                /* Link policy */
-               hci_write_acl_link_policy(hcon, HCI_LP_RSWITCH);
+               if (hcon->hdev->manufacturer == 0x000F)
+                       hci_write_acl_link_policy(hcon, HCI_LP_RSWITCH);
 #endif
        } else
                sco_conn_del(hcon, bt_to_errno(status));
@@ -1323,7 +1339,8 @@ static void sco_disconn_cfm(struct hci_conn *hcon, __u8 reason)
 
 #ifdef TIZEN_BT
        /* Link policy */
-       hci_write_acl_link_policy(hcon, HCI_LP_SNIFF | HCI_LP_RSWITCH);
+       if (hcon->hdev->manufacturer == 0x000F)
+               hci_write_acl_link_policy(hcon, HCI_LP_SNIFF | HCI_LP_RSWITCH);
 #endif
 
        sco_conn_del(hcon, bt_to_errno(reason));