aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/hci_event.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/bluetooth/hci_event.c')
-rw-r--r--net/bluetooth/hci_event.c72
1 files changed, 33 insertions, 39 deletions
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 5935f748c0f9..5fb3df66c2cd 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -486,7 +486,10 @@ static void hci_cc_read_local_commands(struct hci_dev *hdev,
486 486
487 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); 487 BT_DBG("%s status 0x%2.2x", hdev->name, rp->status);
488 488
489 if (!rp->status) 489 if (rp->status)
490 return;
491
492 if (test_bit(HCI_SETUP, &hdev->dev_flags))
490 memcpy(hdev->commands, rp->commands, sizeof(hdev->commands)); 493 memcpy(hdev->commands, rp->commands, sizeof(hdev->commands));
491} 494}
492 495
@@ -538,12 +541,6 @@ static void hci_cc_read_local_features(struct hci_dev *hdev,
538 541
539 if (hdev->features[0][5] & LMP_EDR_3S_ESCO) 542 if (hdev->features[0][5] & LMP_EDR_3S_ESCO)
540 hdev->esco_type |= (ESCO_2EV5 | ESCO_3EV5); 543 hdev->esco_type |= (ESCO_2EV5 | ESCO_3EV5);
541
542 BT_DBG("%s features 0x%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x", hdev->name,
543 hdev->features[0][0], hdev->features[0][1],
544 hdev->features[0][2], hdev->features[0][3],
545 hdev->features[0][4], hdev->features[0][5],
546 hdev->features[0][6], hdev->features[0][7]);
547} 544}
548 545
549static void hci_cc_read_local_ext_features(struct hci_dev *hdev, 546static void hci_cc_read_local_ext_features(struct hci_dev *hdev,
@@ -1782,7 +1779,9 @@ static u8 hci_to_mgmt_reason(u8 err)
1782static void hci_disconn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) 1779static void hci_disconn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb)
1783{ 1780{
1784 struct hci_ev_disconn_complete *ev = (void *) skb->data; 1781 struct hci_ev_disconn_complete *ev = (void *) skb->data;
1782 u8 reason = hci_to_mgmt_reason(ev->reason);
1785 struct hci_conn *conn; 1783 struct hci_conn *conn;
1784 u8 type;
1786 1785
1787 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); 1786 BT_DBG("%s status 0x%2.2x", hdev->name, ev->status);
1788 1787
@@ -1792,43 +1791,38 @@ static void hci_disconn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb)
1792 if (!conn) 1791 if (!conn)
1793 goto unlock; 1792 goto unlock;
1794 1793
1795 if (ev->status == 0) 1794 if (ev->status) {
1796 conn->state = BT_CLOSED; 1795 mgmt_disconnect_failed(hdev, &conn->dst, conn->type,
1796 conn->dst_type, ev->status);
1797 goto unlock;
1798 }
1797 1799
1798 if (test_and_clear_bit(HCI_CONN_MGMT_CONNECTED, &conn->flags) && 1800 conn->state = BT_CLOSED;
1799 (conn->type == ACL_LINK || conn->type == LE_LINK)) {
1800 if (ev->status) {
1801 mgmt_disconnect_failed(hdev, &conn->dst, conn->type,
1802 conn->dst_type, ev->status);
1803 } else {
1804 u8 reason = hci_to_mgmt_reason(ev->reason);
1805 1801
1806 mgmt_device_disconnected(hdev, &conn->dst, conn->type, 1802 if (test_and_clear_bit(HCI_CONN_MGMT_CONNECTED, &conn->flags))
1807 conn->dst_type, reason); 1803 mgmt_device_disconnected(hdev, &conn->dst, conn->type,
1808 } 1804 conn->dst_type, reason);
1809 }
1810 1805
1811 if (ev->status == 0) { 1806 if (conn->type == ACL_LINK && conn->flush_key)
1812 u8 type = conn->type; 1807 hci_remove_link_key(hdev, &conn->dst);
1813 1808
1814 if (type == ACL_LINK && conn->flush_key) 1809 type = conn->type;
1815 hci_remove_link_key(hdev, &conn->dst);
1816 hci_proto_disconn_cfm(conn, ev->reason);
1817 hci_conn_del(conn);
1818 1810
1819 /* Re-enable advertising if necessary, since it might 1811 hci_proto_disconn_cfm(conn, ev->reason);
1820 * have been disabled by the connection. From the 1812 hci_conn_del(conn);
1821 * HCI_LE_Set_Advertise_Enable command description in 1813
1822 * the core specification (v4.0): 1814 /* Re-enable advertising if necessary, since it might
1823 * "The Controller shall continue advertising until the Host 1815 * have been disabled by the connection. From the
1824 * issues an LE_Set_Advertise_Enable command with 1816 * HCI_LE_Set_Advertise_Enable command description in
1825 * Advertising_Enable set to 0x00 (Advertising is disabled) 1817 * the core specification (v4.0):
1826 * or until a connection is created or until the Advertising 1818 * "The Controller shall continue advertising until the Host
1827 * is timed out due to Directed Advertising." 1819 * issues an LE_Set_Advertise_Enable command with
1828 */ 1820 * Advertising_Enable set to 0x00 (Advertising is disabled)
1829 if (type == LE_LINK) 1821 * or until a connection is created or until the Advertising
1830 mgmt_reenable_advertising(hdev); 1822 * is timed out due to Directed Advertising."
1831 } 1823 */
1824 if (type == LE_LINK)
1825 mgmt_reenable_advertising(hdev);
1832 1826
1833unlock: 1827unlock:
1834 hci_dev_unlock(hdev); 1828 hci_dev_unlock(hdev);