Bluetooth: Don't send the sco vendor commands to other vendor chips 80/93180/5
authorDoHyun Pyun <dh79.pyun@samsung.com>
Fri, 21 Oct 2016 00:10:04 +0000 (09:10 +0900)
committerPyun DoHyun <dh79.pyun@samsung.com>
Mon, 24 Oct 2016 02:06:47 +0000 (19:06 -0700)
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 8339cdefba64c41e2cf4d096544c5323057fd0d1..65ed8b85e331da081ab7ff5f44842050dc15e7e4 100644 (file)
@@ -1115,6 +1115,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);
@@ -1145,6 +1148,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);
@@ -1176,6 +1182,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);
@@ -1206,6 +1215,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);
@@ -1257,6 +1269,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;
@@ -1305,7 +1320,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));
@@ -1320,7 +1336,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));