hci_event.c (0c9e98af5e94877ad3b1af2c0f39b2376a462ded) hci_event.c (971e3a4bbcbf7378315b85150853d86be59cffe0)
1/*
2 BlueZ - Bluetooth protocol stack for Linux
3 Copyright (c) 2000-2001, 2010, Code Aurora Forum. All rights reserved.
4
5 Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com>
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License version 2 as

--- 528 unchanged lines hidden (view full) ---

537 hci_send_cmd(hdev, HCI_OP_WRITE_SSP_MODE, sizeof(mode), &mode);
538 }
539
540 if (hdev->features[3] & LMP_RSSI_INQ)
541 hci_setup_inquiry_mode(hdev);
542
543 if (hdev->features[7] & LMP_INQ_TX_PWR)
544 hci_send_cmd(hdev, HCI_OP_READ_INQ_RSP_TX_POWER, 0, NULL);
1/*
2 BlueZ - Bluetooth protocol stack for Linux
3 Copyright (c) 2000-2001, 2010, Code Aurora Forum. All rights reserved.
4
5 Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com>
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License version 2 as

--- 528 unchanged lines hidden (view full) ---

537 hci_send_cmd(hdev, HCI_OP_WRITE_SSP_MODE, sizeof(mode), &mode);
538 }
539
540 if (hdev->features[3] & LMP_RSSI_INQ)
541 hci_setup_inquiry_mode(hdev);
542
543 if (hdev->features[7] & LMP_INQ_TX_PWR)
544 hci_send_cmd(hdev, HCI_OP_READ_INQ_RSP_TX_POWER, 0, NULL);
545
546 if (hdev->features[7] & LMP_EXTFEATURES) {
547 struct hci_cp_read_local_ext_features cp;
548
549 cp.page = 0x01;
550 hci_send_cmd(hdev, HCI_OP_READ_LOCAL_EXT_FEATURES,
551 sizeof(cp), &cp);
552 }
545}
546
547static void hci_cc_read_local_version(struct hci_dev *hdev, struct sk_buff *skb)
548{
549 struct hci_rp_read_local_version *rp = (void *) skb->data;
550
551 BT_DBG("%s status 0x%x", hdev->name, rp->status);
552

--- 100 unchanged lines hidden (view full) ---

653
654 BT_DBG("%s features 0x%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x", hdev->name,
655 hdev->features[0], hdev->features[1],
656 hdev->features[2], hdev->features[3],
657 hdev->features[4], hdev->features[5],
658 hdev->features[6], hdev->features[7]);
659}
660
553}
554
555static void hci_cc_read_local_version(struct hci_dev *hdev, struct sk_buff *skb)
556{
557 struct hci_rp_read_local_version *rp = (void *) skb->data;
558
559 BT_DBG("%s status 0x%x", hdev->name, rp->status);
560

--- 100 unchanged lines hidden (view full) ---

661
662 BT_DBG("%s features 0x%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x", hdev->name,
663 hdev->features[0], hdev->features[1],
664 hdev->features[2], hdev->features[3],
665 hdev->features[4], hdev->features[5],
666 hdev->features[6], hdev->features[7]);
667}
668
669static void hci_cc_read_local_ext_features(struct hci_dev *hdev,
670 struct sk_buff *skb)
671{
672 struct hci_rp_read_local_ext_features *rp = (void *) skb->data;
673
674 BT_DBG("%s status 0x%x", hdev->name, rp->status);
675
676 if (rp->status)
677 return;
678
679 memcpy(hdev->extfeatures, rp->features, 8);
680
681 hci_req_complete(hdev, HCI_OP_READ_LOCAL_EXT_FEATURES, rp->status);
682}
683
661static void hci_cc_read_buffer_size(struct hci_dev *hdev, struct sk_buff *skb)
662{
663 struct hci_rp_read_buffer_size *rp = (void *) skb->data;
664
665 BT_DBG("%s status 0x%x", hdev->name, rp->status);
666
667 if (rp->status)
668 return;

--- 167 unchanged lines hidden (view full) ---

836 struct hci_rp_read_local_oob_data *rp = (void *) skb->data;
837
838 BT_DBG("%s status 0x%x", hdev->name, rp->status);
839
840 mgmt_read_local_oob_data_reply_complete(hdev->id, rp->hash,
841 rp->randomizer, rp->status);
842}
843
684static void hci_cc_read_buffer_size(struct hci_dev *hdev, struct sk_buff *skb)
685{
686 struct hci_rp_read_buffer_size *rp = (void *) skb->data;
687
688 BT_DBG("%s status 0x%x", hdev->name, rp->status);
689
690 if (rp->status)
691 return;

--- 167 unchanged lines hidden (view full) ---

859 struct hci_rp_read_local_oob_data *rp = (void *) skb->data;
860
861 BT_DBG("%s status 0x%x", hdev->name, rp->status);
862
863 mgmt_read_local_oob_data_reply_complete(hdev->id, rp->hash,
864 rp->randomizer, rp->status);
865}
866
867static void hci_cc_le_set_scan_enable(struct hci_dev *hdev,
868 struct sk_buff *skb)
869{
870 struct hci_cp_le_set_scan_enable *cp;
871 __u8 status = *((__u8 *) skb->data);
872
873 BT_DBG("%s status 0x%x", hdev->name, status);
874
875 if (status)
876 return;
877
878 cp = hci_sent_cmd_data(hdev, HCI_OP_LE_SET_SCAN_ENABLE);
879 if (!cp)
880 return;
881
882 hci_dev_lock(hdev);
883
884 if (cp->enable == 0x01) {
885 del_timer(&hdev->adv_timer);
886 hci_adv_entries_clear(hdev);
887 } else if (cp->enable == 0x00) {
888 mod_timer(&hdev->adv_timer, jiffies + ADV_CLEAR_TIMEOUT);
889 }
890
891 hci_dev_unlock(hdev);
892}
893
894static void hci_cc_le_ltk_reply(struct hci_dev *hdev, struct sk_buff *skb)
895{
896 struct hci_rp_le_ltk_reply *rp = (void *) skb->data;
897
898 BT_DBG("%s status 0x%x", hdev->name, rp->status);
899
900 if (rp->status)
901 return;
902
903 hci_req_complete(hdev, HCI_OP_LE_LTK_REPLY, rp->status);
904}
905
906static void hci_cc_le_ltk_neg_reply(struct hci_dev *hdev, struct sk_buff *skb)
907{
908 struct hci_rp_le_ltk_neg_reply *rp = (void *) skb->data;
909
910 BT_DBG("%s status 0x%x", hdev->name, rp->status);
911
912 if (rp->status)
913 return;
914
915 hci_req_complete(hdev, HCI_OP_LE_LTK_NEG_REPLY, rp->status);
916}
917
844static inline void hci_cs_inquiry(struct hci_dev *hdev, __u8 status)
845{
846 BT_DBG("%s status 0x%x", hdev->name, status);
847
848 if (status) {
849 hci_req_complete(hdev, HCI_OP_INQUIRY, status);
850 hci_conn_check_pending(hdev);
851 return;

--- 352 unchanged lines hidden (view full) ---

1204 if (conn && conn->state == BT_CONNECT) {
1205 conn->state = BT_CLOSED;
1206 hci_proto_connect_cfm(conn, status);
1207 hci_conn_del(conn);
1208 }
1209 } else {
1210 if (!conn) {
1211 conn = hci_conn_add(hdev, LE_LINK, &cp->peer_addr);
918static inline void hci_cs_inquiry(struct hci_dev *hdev, __u8 status)
919{
920 BT_DBG("%s status 0x%x", hdev->name, status);
921
922 if (status) {
923 hci_req_complete(hdev, HCI_OP_INQUIRY, status);
924 hci_conn_check_pending(hdev);
925 return;

--- 352 unchanged lines hidden (view full) ---

1278 if (conn && conn->state == BT_CONNECT) {
1279 conn->state = BT_CLOSED;
1280 hci_proto_connect_cfm(conn, status);
1281 hci_conn_del(conn);
1282 }
1283 } else {
1284 if (!conn) {
1285 conn = hci_conn_add(hdev, LE_LINK, &cp->peer_addr);
1212 if (conn)
1286 if (conn) {
1287 conn->dst_type = cp->peer_addr_type;
1213 conn->out = 1;
1288 conn->out = 1;
1214 else
1289 } else {
1215 BT_ERR("No memory for new connection");
1290 BT_ERR("No memory for new connection");
1291 }
1216 }
1217 }
1218
1219 hci_dev_unlock(hdev);
1220}
1221
1292 }
1293 }
1294
1295 hci_dev_unlock(hdev);
1296}
1297
1298static void hci_cs_le_start_enc(struct hci_dev *hdev, u8 status)
1299{
1300 BT_DBG("%s status 0x%x", hdev->name, status);
1301}
1302
1222static inline void hci_inquiry_complete_evt(struct hci_dev *hdev, struct sk_buff *skb)
1223{
1224 __u8 status = *((__u8 *) skb->data);
1225
1226 BT_DBG("%s status %d", hdev->name, status);
1227
1228 if (test_bit(HCI_MGMT, &hdev->flags) &&
1229 test_and_clear_bit(HCI_INQUIRY, &hdev->flags))

--- 227 unchanged lines hidden (view full) ---

1457 struct hci_ev_auth_complete *ev = (void *) skb->data;
1458 struct hci_conn *conn;
1459
1460 BT_DBG("%s status %d", hdev->name, ev->status);
1461
1462 hci_dev_lock(hdev);
1463
1464 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle));
1303static inline void hci_inquiry_complete_evt(struct hci_dev *hdev, struct sk_buff *skb)
1304{
1305 __u8 status = *((__u8 *) skb->data);
1306
1307 BT_DBG("%s status %d", hdev->name, status);
1308
1309 if (test_bit(HCI_MGMT, &hdev->flags) &&
1310 test_and_clear_bit(HCI_INQUIRY, &hdev->flags))

--- 227 unchanged lines hidden (view full) ---

1538 struct hci_ev_auth_complete *ev = (void *) skb->data;
1539 struct hci_conn *conn;
1540
1541 BT_DBG("%s status %d", hdev->name, ev->status);
1542
1543 hci_dev_lock(hdev);
1544
1545 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle));
1465 if (conn) {
1466 if (!ev->status) {
1546 if (!conn)
1547 goto unlock;
1548
1549 if (!ev->status) {
1550 if (!(conn->ssp_mode > 0 && hdev->ssp_mode > 0) &&
1551 test_bit(HCI_CONN_REAUTH_PEND, &conn->pend)) {
1552 BT_INFO("re-auth of legacy device is not possible.");
1553 } else {
1467 conn->link_mode |= HCI_LM_AUTH;
1468 conn->sec_level = conn->pending_sec_level;
1554 conn->link_mode |= HCI_LM_AUTH;
1555 conn->sec_level = conn->pending_sec_level;
1469 } else {
1470 mgmt_auth_failed(hdev->id, &conn->dst, ev->status);
1471 }
1556 }
1557 } else {
1558 mgmt_auth_failed(hdev->id, &conn->dst, ev->status);
1559 }
1472
1560
1473 clear_bit(HCI_CONN_AUTH_PEND, &conn->pend);
1561 clear_bit(HCI_CONN_AUTH_PEND, &conn->pend);
1562 clear_bit(HCI_CONN_REAUTH_PEND, &conn->pend);
1474
1563
1475 if (conn->state == BT_CONFIG) {
1476 if (!ev->status && hdev->ssp_mode > 0 &&
1477 conn->ssp_mode > 0) {
1478 struct hci_cp_set_conn_encrypt cp;
1479 cp.handle = ev->handle;
1480 cp.encrypt = 0x01;
1481 hci_send_cmd(hdev, HCI_OP_SET_CONN_ENCRYPT,
1482 sizeof(cp), &cp);
1483 } else {
1484 conn->state = BT_CONNECTED;
1485 hci_proto_connect_cfm(conn, ev->status);
1486 hci_conn_put(conn);
1487 }
1564 if (conn->state == BT_CONFIG) {
1565 if (!ev->status && hdev->ssp_mode > 0 && conn->ssp_mode > 0) {
1566 struct hci_cp_set_conn_encrypt cp;
1567 cp.handle = ev->handle;
1568 cp.encrypt = 0x01;
1569 hci_send_cmd(hdev, HCI_OP_SET_CONN_ENCRYPT, sizeof(cp),
1570 &cp);
1488 } else {
1571 } else {
1489 hci_auth_cfm(conn, ev->status);
1490
1491 hci_conn_hold(conn);
1492 conn->disc_timeout = HCI_DISCONN_TIMEOUT;
1572 conn->state = BT_CONNECTED;
1573 hci_proto_connect_cfm(conn, ev->status);
1493 hci_conn_put(conn);
1494 }
1574 hci_conn_put(conn);
1575 }
1576 } else {
1577 hci_auth_cfm(conn, ev->status);
1495
1578
1496 if (test_bit(HCI_CONN_ENCRYPT_PEND, &conn->pend)) {
1497 if (!ev->status) {
1498 struct hci_cp_set_conn_encrypt cp;
1499 cp.handle = ev->handle;
1500 cp.encrypt = 0x01;
1501 hci_send_cmd(hdev, HCI_OP_SET_CONN_ENCRYPT,
1502 sizeof(cp), &cp);
1503 } else {
1504 clear_bit(HCI_CONN_ENCRYPT_PEND, &conn->pend);
1505 hci_encrypt_cfm(conn, ev->status, 0x00);
1506 }
1579 hci_conn_hold(conn);
1580 conn->disc_timeout = HCI_DISCONN_TIMEOUT;
1581 hci_conn_put(conn);
1582 }
1583
1584 if (test_bit(HCI_CONN_ENCRYPT_PEND, &conn->pend)) {
1585 if (!ev->status) {
1586 struct hci_cp_set_conn_encrypt cp;
1587 cp.handle = ev->handle;
1588 cp.encrypt = 0x01;
1589 hci_send_cmd(hdev, HCI_OP_SET_CONN_ENCRYPT, sizeof(cp),
1590 &cp);
1591 } else {
1592 clear_bit(HCI_CONN_ENCRYPT_PEND, &conn->pend);
1593 hci_encrypt_cfm(conn, ev->status, 0x00);
1507 }
1508 }
1509
1594 }
1595 }
1596
1597unlock:
1510 hci_dev_unlock(hdev);
1511}
1512
1513static inline void hci_remote_name_evt(struct hci_dev *hdev, struct sk_buff *skb)
1514{
1515 struct hci_ev_remote_name *ev = (void *) skb->data;
1516 struct hci_conn *conn;
1517

--- 34 unchanged lines hidden (view full) ---

1552
1553 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle));
1554 if (conn) {
1555 if (!ev->status) {
1556 if (ev->encrypt) {
1557 /* Encryption implies authentication */
1558 conn->link_mode |= HCI_LM_AUTH;
1559 conn->link_mode |= HCI_LM_ENCRYPT;
1598 hci_dev_unlock(hdev);
1599}
1600
1601static inline void hci_remote_name_evt(struct hci_dev *hdev, struct sk_buff *skb)
1602{
1603 struct hci_ev_remote_name *ev = (void *) skb->data;
1604 struct hci_conn *conn;
1605

--- 34 unchanged lines hidden (view full) ---

1640
1641 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle));
1642 if (conn) {
1643 if (!ev->status) {
1644 if (ev->encrypt) {
1645 /* Encryption implies authentication */
1646 conn->link_mode |= HCI_LM_AUTH;
1647 conn->link_mode |= HCI_LM_ENCRYPT;
1648 conn->sec_level = conn->pending_sec_level;
1560 } else
1561 conn->link_mode &= ~HCI_LM_ENCRYPT;
1562 }
1563
1564 clear_bit(HCI_CONN_ENCRYPT_PEND, &conn->pend);
1565
1566 if (conn->state == BT_CONFIG) {
1567 if (!ev->status)

--- 187 unchanged lines hidden (view full) ---

1755 case HCI_OP_READ_LOCAL_COMMANDS:
1756 hci_cc_read_local_commands(hdev, skb);
1757 break;
1758
1759 case HCI_OP_READ_LOCAL_FEATURES:
1760 hci_cc_read_local_features(hdev, skb);
1761 break;
1762
1649 } else
1650 conn->link_mode &= ~HCI_LM_ENCRYPT;
1651 }
1652
1653 clear_bit(HCI_CONN_ENCRYPT_PEND, &conn->pend);
1654
1655 if (conn->state == BT_CONFIG) {
1656 if (!ev->status)

--- 187 unchanged lines hidden (view full) ---

1844 case HCI_OP_READ_LOCAL_COMMANDS:
1845 hci_cc_read_local_commands(hdev, skb);
1846 break;
1847
1848 case HCI_OP_READ_LOCAL_FEATURES:
1849 hci_cc_read_local_features(hdev, skb);
1850 break;
1851
1852 case HCI_OP_READ_LOCAL_EXT_FEATURES:
1853 hci_cc_read_local_ext_features(hdev, skb);
1854 break;
1855
1763 case HCI_OP_READ_BUFFER_SIZE:
1764 hci_cc_read_buffer_size(hdev, skb);
1765 break;
1766
1767 case HCI_OP_READ_BD_ADDR:
1768 hci_cc_read_bd_addr(hdev, skb);
1769 break;
1770

--- 40 unchanged lines hidden (view full) ---

1811 case HCI_OP_USER_CONFIRM_REPLY:
1812 hci_cc_user_confirm_reply(hdev, skb);
1813 break;
1814
1815 case HCI_OP_USER_CONFIRM_NEG_REPLY:
1816 hci_cc_user_confirm_neg_reply(hdev, skb);
1817 break;
1818
1856 case HCI_OP_READ_BUFFER_SIZE:
1857 hci_cc_read_buffer_size(hdev, skb);
1858 break;
1859
1860 case HCI_OP_READ_BD_ADDR:
1861 hci_cc_read_bd_addr(hdev, skb);
1862 break;
1863

--- 40 unchanged lines hidden (view full) ---

1904 case HCI_OP_USER_CONFIRM_REPLY:
1905 hci_cc_user_confirm_reply(hdev, skb);
1906 break;
1907
1908 case HCI_OP_USER_CONFIRM_NEG_REPLY:
1909 hci_cc_user_confirm_neg_reply(hdev, skb);
1910 break;
1911
1912 case HCI_OP_LE_SET_SCAN_ENABLE:
1913 hci_cc_le_set_scan_enable(hdev, skb);
1914 break;
1915
1916 case HCI_OP_LE_LTK_REPLY:
1917 hci_cc_le_ltk_reply(hdev, skb);
1918 break;
1919
1920 case HCI_OP_LE_LTK_NEG_REPLY:
1921 hci_cc_le_ltk_neg_reply(hdev, skb);
1922 break;
1923
1819 default:
1820 BT_DBG("%s opcode 0x%x", hdev->name, opcode);
1821 break;
1822 }
1823
1824 if (ev->opcode != HCI_OP_NOP)
1825 del_timer(&hdev->cmd_timer);
1826

--- 62 unchanged lines hidden (view full) ---

1889 if (ev->status != 0)
1890 mgmt_disconnect_failed(hdev->id);
1891 break;
1892
1893 case HCI_OP_LE_CREATE_CONN:
1894 hci_cs_le_create_conn(hdev, ev->status);
1895 break;
1896
1924 default:
1925 BT_DBG("%s opcode 0x%x", hdev->name, opcode);
1926 break;
1927 }
1928
1929 if (ev->opcode != HCI_OP_NOP)
1930 del_timer(&hdev->cmd_timer);
1931

--- 62 unchanged lines hidden (view full) ---

1994 if (ev->status != 0)
1995 mgmt_disconnect_failed(hdev->id);
1996 break;
1997
1998 case HCI_OP_LE_CREATE_CONN:
1999 hci_cs_le_create_conn(hdev, ev->status);
2000 break;
2001
2002 case HCI_OP_LE_START_ENC:
2003 hci_cs_le_start_enc(hdev, ev->status);
2004 break;
2005
1897 default:
1898 BT_DBG("%s opcode 0x%x", hdev->name, opcode);
1899 break;
1900 }
1901
1902 if (ev->opcode != HCI_OP_NOP)
1903 del_timer(&hdev->cmd_timer);
1904

--- 748 unchanged lines hidden (view full) ---

2653 conn = hci_conn_hash_lookup_ba(hdev, LE_LINK, &ev->bdaddr);
2654 if (!conn) {
2655 conn = hci_conn_add(hdev, LE_LINK, &ev->bdaddr);
2656 if (!conn) {
2657 BT_ERR("No memory for new connection");
2658 hci_dev_unlock(hdev);
2659 return;
2660 }
2006 default:
2007 BT_DBG("%s opcode 0x%x", hdev->name, opcode);
2008 break;
2009 }
2010
2011 if (ev->opcode != HCI_OP_NOP)
2012 del_timer(&hdev->cmd_timer);
2013

--- 748 unchanged lines hidden (view full) ---

2762 conn = hci_conn_hash_lookup_ba(hdev, LE_LINK, &ev->bdaddr);
2763 if (!conn) {
2764 conn = hci_conn_add(hdev, LE_LINK, &ev->bdaddr);
2765 if (!conn) {
2766 BT_ERR("No memory for new connection");
2767 hci_dev_unlock(hdev);
2768 return;
2769 }
2770
2771 conn->dst_type = ev->bdaddr_type;
2661 }
2662
2663 if (ev->status) {
2664 mgmt_connect_failed(hdev->id, &ev->bdaddr, ev->status);
2665 hci_proto_connect_cfm(conn, ev->status);
2666 conn->state = BT_CLOSED;
2667 hci_conn_del(conn);
2668 goto unlock;
2669 }
2670
2671 mgmt_connected(hdev->id, &ev->bdaddr);
2672
2772 }
2773
2774 if (ev->status) {
2775 mgmt_connect_failed(hdev->id, &ev->bdaddr, ev->status);
2776 hci_proto_connect_cfm(conn, ev->status);
2777 conn->state = BT_CLOSED;
2778 hci_conn_del(conn);
2779 goto unlock;
2780 }
2781
2782 mgmt_connected(hdev->id, &ev->bdaddr);
2783
2784 conn->sec_level = BT_SECURITY_LOW;
2673 conn->handle = __le16_to_cpu(ev->handle);
2674 conn->state = BT_CONNECTED;
2675
2676 hci_conn_hold_device(conn);
2677 hci_conn_add_sysfs(conn);
2678
2679 hci_proto_connect_cfm(conn, ev->status);
2680
2681unlock:
2682 hci_dev_unlock(hdev);
2683}
2684
2785 conn->handle = __le16_to_cpu(ev->handle);
2786 conn->state = BT_CONNECTED;
2787
2788 hci_conn_hold_device(conn);
2789 hci_conn_add_sysfs(conn);
2790
2791 hci_proto_connect_cfm(conn, ev->status);
2792
2793unlock:
2794 hci_dev_unlock(hdev);
2795}
2796
2797static inline void hci_le_adv_report_evt(struct hci_dev *hdev,
2798 struct sk_buff *skb)
2799{
2800 struct hci_ev_le_advertising_info *ev;
2801 u8 num_reports;
2802
2803 num_reports = skb->data[0];
2804 ev = (void *) &skb->data[1];
2805
2806 hci_dev_lock(hdev);
2807
2808 hci_add_adv_entry(hdev, ev);
2809
2810 while (--num_reports) {
2811 ev = (void *) (ev->data + ev->length + 1);
2812 hci_add_adv_entry(hdev, ev);
2813 }
2814
2815 hci_dev_unlock(hdev);
2816}
2817
2818static inline void hci_le_ltk_request_evt(struct hci_dev *hdev,
2819 struct sk_buff *skb)
2820{
2821 struct hci_ev_le_ltk_req *ev = (void *) skb->data;
2822 struct hci_cp_le_ltk_reply cp;
2823 struct hci_conn *conn;
2824
2825 BT_DBG("%s handle %d", hdev->name, cpu_to_le16(ev->handle));
2826
2827 hci_dev_lock(hdev);
2828
2829 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle));
2830
2831 memset(&cp, 0, sizeof(cp));
2832 cp.handle = cpu_to_le16(conn->handle);
2833 memcpy(cp.ltk, conn->ltk, sizeof(conn->ltk));
2834
2835 hci_send_cmd(hdev, HCI_OP_LE_LTK_REPLY, sizeof(cp), &cp);
2836
2837 hci_dev_unlock(hdev);
2838}
2839
2685static inline void hci_le_meta_evt(struct hci_dev *hdev, struct sk_buff *skb)
2686{
2687 struct hci_ev_le_meta *le_ev = (void *) skb->data;
2688
2689 skb_pull(skb, sizeof(*le_ev));
2690
2691 switch (le_ev->subevent) {
2692 case HCI_EV_LE_CONN_COMPLETE:
2693 hci_le_conn_complete_evt(hdev, skb);
2694 break;
2695
2840static inline void hci_le_meta_evt(struct hci_dev *hdev, struct sk_buff *skb)
2841{
2842 struct hci_ev_le_meta *le_ev = (void *) skb->data;
2843
2844 skb_pull(skb, sizeof(*le_ev));
2845
2846 switch (le_ev->subevent) {
2847 case HCI_EV_LE_CONN_COMPLETE:
2848 hci_le_conn_complete_evt(hdev, skb);
2849 break;
2850
2851 case HCI_EV_LE_ADVERTISING_REPORT:
2852 hci_le_adv_report_evt(hdev, skb);
2853 break;
2854
2855 case HCI_EV_LE_LTK_REQ:
2856 hci_le_ltk_request_evt(hdev, skb);
2857 break;
2858
2696 default:
2697 break;
2698 }
2699}
2700
2701void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb)
2702{
2703 struct hci_event_hdr *hdr = (void *) skb->data;

--- 185 unchanged lines hidden ---
2859 default:
2860 break;
2861 }
2862}
2863
2864void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb)
2865{
2866 struct hci_event_hdr *hdr = (void *) skb->data;

--- 185 unchanged lines hidden ---