Bluetooth: Ask upper layers for HCI disconnect reason
[pandora-kernel.git] / net / bluetooth / hci_event.c
index f91ba69..c396542 100644 (file)
@@ -484,6 +484,15 @@ static void hci_cc_read_local_features(struct hci_dev *hdev, struct sk_buff *skb
        if (hdev->features[4] & LMP_EV5)
                hdev->esco_type |= (ESCO_EV5);
 
+       if (hdev->features[5] & LMP_EDR_ESCO_2M)
+               hdev->esco_type |= (ESCO_2EV3);
+
+       if (hdev->features[5] & LMP_EDR_ESCO_3M)
+               hdev->esco_type |= (ESCO_3EV3);
+
+       if (hdev->features[5] & LMP_EDR_3S_ESCO)
+               hdev->esco_type |= (ESCO_2EV5 | ESCO_3EV5);
+
        BT_DBG("%s features 0x%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x", hdev->name,
                                        hdev->features[0], hdev->features[1],
                                        hdev->features[2], hdev->features[3],
@@ -914,7 +923,8 @@ static inline void hci_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *s
        if (ev->status) {
                hci_proto_connect_cfm(conn, ev->status);
                hci_conn_del(conn);
-       }
+       } else if (ev->link_type != ACL_LINK)
+               hci_proto_connect_cfm(conn, ev->status);
 
 unlock:
        hci_dev_unlock(hdev);
@@ -1011,7 +1021,7 @@ static inline void hci_disconn_complete_evt(struct hci_dev *hdev, struct sk_buff
 
                hci_conn_del_sysfs(conn);
 
-               hci_proto_disconn_ind(conn, ev->reason);
+               hci_proto_disconn_cfm(conn, ev->reason);
                hci_conn_del(conn);
        }
 
@@ -1600,7 +1610,8 @@ static inline void hci_remote_ext_features_evt(struct hci_dev *hdev, struct sk_b
 
                if (conn->state == BT_CONFIG) {
                        if (!ev->status && hdev->ssp_mode > 0 &&
-                                       conn->ssp_mode > 0 && conn->out) {
+                                       conn->ssp_mode > 0 && conn->out &&
+                                       conn->sec_level != BT_SECURITY_SDP) {
                                struct hci_cp_auth_requested cp;
                                cp.handle = ev->handle;
                                hci_send_cmd(hdev, HCI_OP_AUTH_REQUESTED,
@@ -1637,6 +1648,13 @@ static inline void hci_sync_conn_complete_evt(struct hci_dev *hdev, struct sk_bu
                conn->type = SCO_LINK;
        }
 
+       if (conn->out && ev->status == 0x1c && conn->attempt < 2) {
+               conn->pkt_type = (hdev->esco_type & SCO_ESCO_MASK) |
+                                       (hdev->esco_type & EDR_ESCO_MASK);
+               hci_setup_sync(conn, conn->link->handle);
+               goto unlock;
+       }
+
        if (!ev->status) {
                conn->handle = __le16_to_cpu(ev->handle);
                conn->state  = BT_CONNECTED;