27 #include <linux/export.h>
28 #include <asm/unaligned.h>
40 BT_DBG(
"%s status 0x%2.2x", hdev->
name, status);
60 static void hci_cc_periodic_inq(
struct hci_dev *hdev,
struct sk_buff *skb)
64 BT_DBG(
"%s status 0x%2.2x", hdev->
name, status);
72 static void hci_cc_exit_periodic_inq(
struct hci_dev *hdev,
struct sk_buff *skb)
76 BT_DBG(
"%s status 0x%2.2x", hdev->
name, status);
86 static void hci_cc_remote_name_req_cancel(
struct hci_dev *hdev,
92 static void hci_cc_role_discovery(
struct hci_dev *hdev,
struct sk_buff *skb)
115 static void hci_cc_read_link_policy(
struct hci_dev *hdev,
struct sk_buff *skb)
134 static void hci_cc_write_link_policy(
struct hci_dev *hdev,
struct sk_buff *skb)
153 conn->link_policy = get_unaligned_le16(sent + 2);
158 static void hci_cc_read_def_link_policy(
struct hci_dev *hdev,
171 static void hci_cc_write_def_link_policy(
struct hci_dev *hdev,
177 BT_DBG(
"%s status 0x%2.2x", hdev->
name, status);
189 static void hci_cc_reset(
struct hci_dev *hdev,
struct sk_buff *skb)
193 BT_DBG(
"%s status 0x%2.2x", hdev->
name, status);
203 hdev->
discovery.state = DISCOVERY_STOPPED;
206 static void hci_cc_write_local_name(
struct hci_dev *hdev,
struct sk_buff *skb)
211 BT_DBG(
"%s status 0x%2.2x", hdev->
name, status);
229 static void hci_cc_read_local_name(
struct hci_dev *hdev,
struct sk_buff *skb)
242 static void hci_cc_write_auth_enable(
struct hci_dev *hdev,
struct sk_buff *skb)
247 BT_DBG(
"%s status 0x%2.2x", hdev->
name, status);
268 static void hci_cc_write_encrypt_mode(
struct hci_dev *hdev,
struct sk_buff *skb)
273 BT_DBG(
"%s status 0x%2.2x", hdev->
name, status);
291 static void hci_cc_write_scan_enable(
struct hci_dev *hdev,
struct sk_buff *skb)
294 int old_pscan, old_iscan;
297 BT_DBG(
"%s status 0x%2.2x", hdev->
name, status);
303 param = *((
__u8 *) sent);
325 }
else if (old_iscan)
332 }
else if (old_pscan)
340 static void hci_cc_read_class_of_dev(
struct hci_dev *hdev,
struct sk_buff *skb)
355 static void hci_cc_write_class_of_dev(
struct hci_dev *hdev,
struct sk_buff *skb)
360 BT_DBG(
"%s status 0x%2.2x", hdev->
name, status);
377 static void hci_cc_read_voice_setting(
struct hci_dev *hdev,
struct sk_buff *skb)
394 BT_DBG(
"%s voice setting 0x%4.4x", hdev->
name, setting);
400 static void hci_cc_write_voice_setting(
struct hci_dev *hdev,
407 BT_DBG(
"%s status 0x%2.2x", hdev->
name, status);
416 setting = get_unaligned_le16(sent);
423 BT_DBG(
"%s voice setting 0x%4.4x", hdev->
name, setting);
429 static void hci_cc_host_buffer_size(
struct hci_dev *hdev,
struct sk_buff *skb)
433 BT_DBG(
"%s status 0x%2.2x", hdev->
name, status);
438 static void hci_cc_write_ssp_mode(
struct hci_dev *hdev,
struct sk_buff *skb)
443 BT_DBG(
"%s status 0x%2.2x", hdev->
name, status);
459 static u8 hci_get_inquiry_mode(
struct hci_dev *hdev)
487 static void hci_setup_inquiry_mode(
struct hci_dev *hdev)
491 mode = hci_get_inquiry_mode(hdev);
496 static void hci_setup_event_mask(
struct hci_dev *hdev)
501 u8 events[8] = { 0xff, 0xff, 0xfb, 0xff, 0x00, 0x00, 0x00, 0x00 };
551 static void hci_setup(
struct hci_dev *hdev)
556 hci_setup_event_mask(hdev);
565 sizeof(mode), &mode);
577 hci_setup_inquiry_mode(hdev);
597 static void hci_cc_read_local_version(
struct hci_dev *hdev,
struct sk_buff *skb)
612 BT_DBG(
"%s manufacturer 0x%4.4x hci ver %d:%d", hdev->
name,
622 static void hci_setup_link_policy(
struct hci_dev *hdev)
640 static void hci_cc_read_local_commands(
struct hci_dev *hdev,
653 hci_setup_link_policy(hdev);
659 static void hci_cc_read_local_features(
struct hci_dev *hdev,
708 BT_DBG(
"%s features 0x%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x", hdev->
name,
715 static void hci_set_le_support(
struct hci_dev *hdev)
731 static void hci_cc_read_local_ext_features(
struct hci_dev *hdev,
751 hci_set_le_support(hdev);
757 static void hci_cc_read_flow_control_mode(
struct hci_dev *hdev,
772 static void hci_cc_read_buffer_size(
struct hci_dev *hdev,
struct sk_buff *skb)
798 static void hci_cc_read_bd_addr(
struct hci_dev *hdev,
struct sk_buff *skb)
810 static void hci_cc_read_data_block_size(
struct hci_dev *hdev,
832 static void hci_cc_write_ca_timeout(
struct hci_dev *hdev,
struct sk_buff *skb)
836 BT_DBG(
"%s status 0x%2.2x", hdev->
name, status);
841 static void hci_cc_read_local_amp_info(
struct hci_dev *hdev,
865 static void hci_cc_delete_stored_link_key(
struct hci_dev *hdev,
870 BT_DBG(
"%s status 0x%2.2x", hdev->
name, status);
875 static void hci_cc_set_event_mask(
struct hci_dev *hdev,
struct sk_buff *skb)
879 BT_DBG(
"%s status 0x%2.2x", hdev->
name, status);
884 static void hci_cc_write_inquiry_mode(
struct hci_dev *hdev,
889 BT_DBG(
"%s status 0x%2.2x", hdev->
name, status);
894 static void hci_cc_read_inq_rsp_tx_power(
struct hci_dev *hdev,
907 static void hci_cc_set_event_flt(
struct hci_dev *hdev,
struct sk_buff *skb)
911 BT_DBG(
"%s status 0x%2.2x", hdev->
name, status);
916 static void hci_cc_pin_code_reply(
struct hci_dev *hdev,
struct sk_buff *skb)
936 conn = hci_conn_hash_lookup_ba(hdev,
ACL_LINK, &
cp->bdaddr);
938 conn->pin_length =
cp->pin_len;
944 static void hci_cc_pin_code_neg_reply(
struct hci_dev *hdev,
struct sk_buff *skb)
959 static void hci_cc_le_read_buffer_size(
struct hci_dev *hdev,
979 static void hci_cc_user_confirm_reply(
struct hci_dev *hdev,
struct sk_buff *skb)
994 static void hci_cc_user_confirm_neg_reply(
struct hci_dev *hdev,
1010 static void hci_cc_user_passkey_reply(
struct hci_dev *hdev,
struct sk_buff *skb)
1025 static void hci_cc_user_passkey_neg_reply(
struct hci_dev *hdev,
1041 static void hci_cc_read_local_oob_data_reply(
struct hci_dev *hdev,
1054 static void hci_cc_le_set_scan_param(
struct hci_dev *hdev,
struct sk_buff *skb)
1058 BT_DBG(
"%s status 0x%2.2x", hdev->
name, status);
1070 static void hci_cc_le_set_scan_enable(
struct hci_dev *hdev,
1076 BT_DBG(
"%s status 0x%2.2x", hdev->
name, status);
1111 hdev->
discovery.state == DISCOVERY_FINDING) {
1122 BT_ERR(
"Used reserved LE_Scan_Enable param %d", cp->
enable);
1127 static void hci_cc_le_ltk_reply(
struct hci_dev *hdev,
struct sk_buff *skb)
1139 static void hci_cc_le_ltk_neg_reply(
struct hci_dev *hdev,
struct sk_buff *skb)
1151 static void hci_cc_write_le_host_supported(
struct hci_dev *hdev,
1157 BT_DBG(
"%s status 0x%2.2x", hdev->
name, status);
1177 static void hci_cs_inquiry(
struct hci_dev *hdev,
__u8 status)
1179 BT_DBG(
"%s status 0x%2.2x", hdev->
name, status);
1198 static void hci_cs_create_conn(
struct hci_dev *hdev,
__u8 status)
1203 BT_DBG(
"%s status 0x%2.2x", hdev->
name, status);
1217 if (status != 0x0c || conn->
attempt > 2) {
1219 hci_proto_connect_cfm(conn, status);
1231 BT_ERR(
"No memory for new connection");
1238 static void hci_cs_add_sco(
struct hci_dev *hdev,
__u8 status)
1244 BT_DBG(
"%s status 0x%2.2x", hdev->
name, status);
1255 BT_DBG(
"%s handle 0x%4.4x", hdev->
name, handle);
1259 acl = hci_conn_hash_lookup_handle(hdev, handle);
1265 hci_proto_connect_cfm(sco, status);
1273 static void hci_cs_auth_requested(
struct hci_dev *hdev,
__u8 status)
1278 BT_DBG(
"%s status 0x%2.2x", hdev->
name, status);
1292 hci_proto_connect_cfm(conn, status);
1300 static void hci_cs_set_conn_encrypt(
struct hci_dev *hdev,
__u8 status)
1305 BT_DBG(
"%s status 0x%2.2x", hdev->
name, status);
1319 hci_proto_connect_cfm(conn, status);
1327 static int hci_outgoing_auth_needed(
struct hci_dev *hdev,
1338 if (!hci_conn_ssp_enabled(conn) && !(conn->
auth_type & 0x01) &&
1345 static int hci_resolve_name(
struct hci_dev *hdev,
1350 memset(&cp, 0,
sizeof(cp));
1352 bacpy(&cp.bdaddr, &e->
data.bdaddr);
1353 cp.pscan_rep_mode = e->
data.pscan_rep_mode;
1354 cp.pscan_mode = e->
data.pscan_mode;
1355 cp.clock_offset = e->
data.clock_offset;
1360 static bool hci_resolve_next_name(
struct hci_dev *hdev)
1365 if (list_empty(&discov->
resolve))
1372 if (hci_resolve_name(hdev, e) == 0) {
1380 static void hci_check_pending_name(
struct hci_dev *hdev,
struct hci_conn *conn,
1390 if (discov->
state == DISCOVERY_STOPPED)
1393 if (discov->
state == DISCOVERY_STOPPING)
1394 goto discov_complete;
1396 if (discov->
state != DISCOVERY_RESOLVING)
1411 e->
data.rssi, name, name_len);
1416 if (hci_resolve_next_name(hdev))
1423 static void hci_cs_remote_name_req(
struct hci_dev *hdev,
__u8 status)
1428 BT_DBG(
"%s status 0x%2.2x", hdev->
name, status);
1444 hci_check_pending_name(hdev, conn, &cp->
bdaddr,
NULL, 0);
1449 if (!hci_outgoing_auth_needed(hdev, conn))
1462 static void hci_cs_read_remote_features(
struct hci_dev *hdev,
__u8 status)
1467 BT_DBG(
"%s status 0x%2.2x", hdev->
name, status);
1481 hci_proto_connect_cfm(conn, status);
1489 static void hci_cs_read_remote_ext_features(
struct hci_dev *hdev,
__u8 status)
1494 BT_DBG(
"%s status 0x%2.2x", hdev->
name, status);
1508 hci_proto_connect_cfm(conn, status);
1516 static void hci_cs_setup_sync_conn(
struct hci_dev *hdev,
__u8 status)
1522 BT_DBG(
"%s status 0x%2.2x", hdev->
name, status);
1533 BT_DBG(
"%s handle 0x%4.4x", hdev->
name, handle);
1537 acl = hci_conn_hash_lookup_handle(hdev, handle);
1543 hci_proto_connect_cfm(sco, status);
1551 static void hci_cs_sniff_mode(
struct hci_dev *hdev,
__u8 status)
1556 BT_DBG(
"%s status 0x%2.2x", hdev->
name, status);
1578 static void hci_cs_exit_sniff_mode(
struct hci_dev *hdev,
__u8 status)
1583 BT_DBG(
"%s status 0x%2.2x", hdev->
name, status);
1605 static void hci_cs_disconnect(
struct hci_dev *hdev,
u8 status)
1627 static void hci_cs_le_create_conn(
struct hci_dev *hdev,
__u8 status)
1631 BT_DBG(
"%s status 0x%2.2x", hdev->
name, status);
1648 hci_proto_connect_cfm(conn, status);
1655 static void hci_cs_le_start_enc(
struct hci_dev *hdev,
u8 status)
1657 BT_DBG(
"%s status 0x%2.2x", hdev->
name, status);
1660 static void hci_inquiry_complete_evt(
struct hci_dev *hdev,
struct sk_buff *skb)
1666 BT_DBG(
"%s status 0x%2.2x", hdev->
name, status);
1680 if (discov->
state != DISCOVERY_FINDING)
1683 if (list_empty(&discov->
resolve)) {
1689 if (e && hci_resolve_name(hdev, e) == 0) {
1700 static void hci_inquiry_result_evt(
struct hci_dev *hdev,
struct sk_buff *skb)
1704 int num_rsp = *((
__u8 *) skb->
data);
1706 BT_DBG(
"%s num_rsp %d", hdev->
name, num_rsp);
1716 for (; num_rsp; num_rsp--, info++) {
1717 bool name_known,
ssp;
1726 data.ssp_mode = 0x00;
1737 static void hci_conn_complete_evt(
struct hci_dev *hdev,
struct sk_buff *skb)
1763 hci_conn_hold(conn);
1765 if (!conn->
out && !hci_conn_ssp_enabled(conn) &&
1809 hci_proto_connect_cfm(conn, ev->
status);
1812 hci_proto_connect_cfm(conn, ev->
status);
1820 static void hci_conn_request_evt(
struct hci_dev *hdev,
struct sk_buff *skb)
1842 conn = hci_conn_hash_lookup_ba(hdev, ev->
link_type,
1847 BT_ERR(
"No memory for new connection");
1861 bacpy(&cp.bdaddr, &ev->
bdaddr);
1873 bacpy(&cp.bdaddr, &ev->
bdaddr);
1880 cp.retrans_effort = 0xff;
1889 bacpy(&cp.bdaddr, &ev->
bdaddr);
1895 static u8 hci_to_mgmt_reason(
u8 err)
1911 static void hci_disconn_complete_evt(
struct hci_dev *hdev,
struct sk_buff *skb)
1943 hci_proto_disconn_cfm(conn, ev->
reason);
1951 static void hci_auth_complete_evt(
struct hci_dev *hdev,
struct sk_buff *skb)
1965 if (!hci_conn_ssp_enabled(conn) &&
1967 BT_INFO(
"re-auth of legacy device is not possible.");
1981 if (!ev->
status && hci_conn_ssp_enabled(conn)) {
1989 hci_proto_connect_cfm(conn, ev->
status);
1993 hci_auth_cfm(conn, ev->
status);
1995 hci_conn_hold(conn);
2009 hci_encrypt_cfm(conn, ev->
status, 0x00);
2017 static void hci_remote_name_evt(
struct hci_dev *hdev,
struct sk_buff *skb)
2034 hci_check_pending_name(hdev, conn, &ev->
bdaddr, ev->
name,
2037 hci_check_pending_name(hdev, conn, &ev->
bdaddr,
NULL, 0);
2043 if (!hci_outgoing_auth_needed(hdev, conn))
2056 static void hci_encrypt_change_evt(
struct hci_dev *hdev,
struct sk_buff *skb)
2089 hci_proto_connect_cfm(conn, ev->
status);
2099 static void hci_change_link_key_complete_evt(
struct hci_dev *hdev,
2116 hci_key_change_cfm(conn, ev->
status);
2122 static void hci_remote_features_evt(
struct hci_dev *hdev,
2153 memset(&cp, 0,
sizeof(cp));
2154 bacpy(&cp.bdaddr, &conn->
dst);
2155 cp.pscan_rep_mode = 0x02;
2162 if (!hci_outgoing_auth_needed(hdev, conn)) {
2164 hci_proto_connect_cfm(conn, ev->
status);
2172 static void hci_remote_version_evt(
struct hci_dev *hdev,
struct sk_buff *skb)
2177 static void hci_qos_setup_complete_evt(
struct hci_dev *hdev,
2183 static void hci_cmd_complete_evt(
struct hci_dev *hdev,
struct sk_buff *skb)
2194 hci_cc_inquiry_cancel(hdev, skb);
2198 hci_cc_periodic_inq(hdev, skb);
2202 hci_cc_exit_periodic_inq(hdev, skb);
2206 hci_cc_remote_name_req_cancel(hdev, skb);
2210 hci_cc_role_discovery(hdev, skb);
2214 hci_cc_read_link_policy(hdev, skb);
2218 hci_cc_write_link_policy(hdev, skb);
2222 hci_cc_read_def_link_policy(hdev, skb);
2226 hci_cc_write_def_link_policy(hdev, skb);
2230 hci_cc_reset(hdev, skb);
2234 hci_cc_write_local_name(hdev, skb);
2238 hci_cc_read_local_name(hdev, skb);
2242 hci_cc_write_auth_enable(hdev, skb);
2246 hci_cc_write_encrypt_mode(hdev, skb);
2250 hci_cc_write_scan_enable(hdev, skb);
2254 hci_cc_read_class_of_dev(hdev, skb);
2258 hci_cc_write_class_of_dev(hdev, skb);
2262 hci_cc_read_voice_setting(hdev, skb);
2266 hci_cc_write_voice_setting(hdev, skb);
2270 hci_cc_host_buffer_size(hdev, skb);
2274 hci_cc_write_ssp_mode(hdev, skb);
2278 hci_cc_read_local_version(hdev, skb);
2282 hci_cc_read_local_commands(hdev, skb);
2286 hci_cc_read_local_features(hdev, skb);
2290 hci_cc_read_local_ext_features(hdev, skb);
2294 hci_cc_read_buffer_size(hdev, skb);
2298 hci_cc_read_bd_addr(hdev, skb);
2302 hci_cc_read_data_block_size(hdev, skb);
2306 hci_cc_write_ca_timeout(hdev, skb);
2310 hci_cc_read_flow_control_mode(hdev, skb);
2314 hci_cc_read_local_amp_info(hdev, skb);
2318 hci_cc_delete_stored_link_key(hdev, skb);
2322 hci_cc_set_event_mask(hdev, skb);
2326 hci_cc_write_inquiry_mode(hdev, skb);
2330 hci_cc_read_inq_rsp_tx_power(hdev, skb);
2334 hci_cc_set_event_flt(hdev, skb);
2338 hci_cc_pin_code_reply(hdev, skb);
2342 hci_cc_pin_code_neg_reply(hdev, skb);
2346 hci_cc_read_local_oob_data_reply(hdev, skb);
2350 hci_cc_le_read_buffer_size(hdev, skb);
2354 hci_cc_user_confirm_reply(hdev, skb);
2358 hci_cc_user_confirm_neg_reply(hdev, skb);
2362 hci_cc_user_passkey_reply(hdev, skb);
2366 hci_cc_user_passkey_neg_reply(hdev, skb);
2370 hci_cc_le_set_scan_param(hdev, skb);
2374 hci_cc_le_set_scan_enable(hdev, skb);
2378 hci_cc_le_ltk_reply(hdev, skb);
2382 hci_cc_le_ltk_neg_reply(hdev, skb);
2386 hci_cc_write_le_host_supported(hdev, skb);
2399 if (!skb_queue_empty(&hdev->
cmd_q))
2404 static void hci_cmd_status_evt(
struct hci_dev *hdev,
struct sk_buff *skb)
2415 hci_cs_inquiry(hdev, ev->
status);
2419 hci_cs_create_conn(hdev, ev->
status);
2423 hci_cs_add_sco(hdev, ev->
status);
2427 hci_cs_auth_requested(hdev, ev->
status);
2431 hci_cs_set_conn_encrypt(hdev, ev->
status);
2435 hci_cs_remote_name_req(hdev, ev->
status);
2439 hci_cs_read_remote_features(hdev, ev->
status);
2443 hci_cs_read_remote_ext_features(hdev, ev->
status);
2447 hci_cs_setup_sync_conn(hdev, ev->
status);
2451 hci_cs_sniff_mode(hdev, ev->
status);
2455 hci_cs_exit_sniff_mode(hdev, ev->
status);
2459 hci_cs_disconnect(hdev, ev->
status);
2463 hci_cs_le_create_conn(hdev, ev->
status);
2467 hci_cs_le_start_enc(hdev, ev->
status);
2480 if (!skb_queue_empty(&hdev->
cmd_q))
2485 static void hci_role_change_evt(
struct hci_dev *hdev,
struct sk_buff *skb)
2505 hci_role_switch_cfm(conn, ev->
status, ev->
role);
2511 static void hci_num_comp_pkts_evt(
struct hci_dev *hdev,
struct sk_buff *skb)
2521 if (skb->
len <
sizeof(*ev) || skb->
len <
sizeof(*ev) +
2537 conn = hci_conn_hash_lookup_handle(hdev, handle);
2543 switch (conn->
type) {
2569 BT_ERR(
"Unknown type %d conn %p", conn->
type, conn);
2577 static void hci_num_comp_blocks_evt(
struct hci_dev *hdev,
struct sk_buff *skb)
2587 if (skb->
len <
sizeof(*ev) || skb->
len <
sizeof(*ev) +
2604 conn = hci_conn_hash_lookup_handle(hdev, handle);
2610 switch (conn->
type) {
2618 BT_ERR(
"Unknown type %d conn %p", conn->
type, conn);
2626 static void hci_mode_change_evt(
struct hci_dev *hdev,
struct sk_buff *skb)
2655 static void hci_pin_code_request_evt(
struct hci_dev *hdev,
struct sk_buff *skb)
2669 hci_conn_hold(conn);
2692 static void hci_link_key_request_evt(
struct hci_dev *hdev,
struct sk_buff *skb)
2708 BT_DBG(
"%s link key not found for %s", hdev->
name,
2713 BT_DBG(
"%s found key type %u for %s", hdev->
name,
key->type,
2726 BT_DBG(
"%s ignoring unauthenticated key", hdev->
name);
2732 BT_DBG(
"%s ignoring key unauthenticated for high security",
2741 bacpy(&cp.bdaddr, &ev->
bdaddr);
2755 static void hci_link_key_notify_evt(
struct hci_dev *hdev,
struct sk_buff *skb)
2767 hci_conn_hold(conn);
2784 static void hci_clock_offset_evt(
struct hci_dev *hdev,
struct sk_buff *skb)
2794 if (conn && !ev->
status) {
2807 static void hci_pkt_type_change_evt(
struct hci_dev *hdev,
struct sk_buff *skb)
2823 static void hci_pscan_rep_mode_evt(
struct hci_dev *hdev,
struct sk_buff *skb)
2841 static void hci_inquiry_result_with_rssi_evt(
struct hci_dev *hdev,
2845 int num_rsp = *((
__u8 *) skb->
data);
2846 bool name_known,
ssp;
2848 BT_DBG(
"%s num_rsp %d", hdev->
name, num_rsp);
2860 info = (
void *) (skb->
data + 1);
2862 for (; num_rsp; num_rsp--, info++) {
2870 data.ssp_mode = 0x00;
2876 !name_known, ssp,
NULL, 0);
2881 for (; num_rsp; num_rsp--, info++) {
2885 data.pscan_mode = 0x00;
2889 data.ssp_mode = 0x00;
2894 !name_known, ssp,
NULL, 0);
2901 static void hci_remote_ext_features_evt(
struct hci_dev *hdev,
2931 memset(&cp, 0,
sizeof(cp));
2932 bacpy(&cp.bdaddr, &conn->
dst);
2933 cp.pscan_rep_mode = 0x02;
2940 if (!hci_outgoing_auth_needed(hdev, conn)) {
2942 hci_proto_connect_cfm(conn, ev->
status);
2950 static void hci_sync_conn_complete_evt(
struct hci_dev *hdev,
2998 hci_proto_connect_cfm(conn, ev->
status);
3006 static void hci_sync_conn_changed_evt(
struct hci_dev *hdev,
struct sk_buff *skb)
3011 static void hci_sniff_subrate_evt(
struct hci_dev *hdev,
struct sk_buff *skb)
3018 static void hci_extended_inquiry_result_evt(
struct hci_dev *hdev,
3023 int num_rsp = *((
__u8 *) skb->
data);
3026 BT_DBG(
"%s num_rsp %d", hdev->
name, num_rsp);
3036 for (; num_rsp; num_rsp--, info++) {
3037 bool name_known,
ssp;
3042 data.pscan_mode = 0x00;
3046 data.ssp_mode = 0x01;
3049 name_known = eir_has_data_type(info->
data,
3057 eir_len = eir_get_length(info->
data,
sizeof(info->
data));
3060 ssp, info->
data, eir_len);
3066 static void hci_key_refresh_complete_evt(
struct hci_dev *hdev,
3096 hci_proto_connect_cfm(conn, ev->
status);
3099 hci_auth_cfm(conn, ev->
status);
3101 hci_conn_hold(conn);
3110 static u8 hci_get_auth_req(
struct hci_conn *conn)
3129 static void hci_io_capa_request_evt(
struct hci_dev *hdev,
struct sk_buff *skb)
3142 hci_conn_hold(conn);
3151 bacpy(&cp.bdaddr, &ev->
bdaddr);
3156 conn->
auth_type = hci_get_auth_req(conn);
3170 bacpy(&cp.bdaddr, &ev->
bdaddr);
3181 static void hci_io_capa_reply_evt(
struct hci_dev *hdev,
struct sk_buff *skb)
3203 static void hci_user_confirm_request_evt(
struct hci_dev *hdev,
3207 int loc_mitm, rem_mitm, confirm_hint = 0;
3230 BT_DBG(
"Rejecting request: remote device can't provide MITM");
3237 if ((!loc_mitm || conn->
remote_cap == 0x03) &&
3244 BT_DBG(
"Confirming auto-accept as acceptor");
3249 BT_DBG(
"Auto-accept of user confirmation with %ums delay",
3271 static void hci_user_passkey_request_evt(
struct hci_dev *hdev,
3282 static void hci_user_passkey_notify_evt(
struct hci_dev *hdev,
3303 static void hci_keypress_notify_evt(
struct hci_dev *hdev,
struct sk_buff *skb)
3341 static void hci_simple_pair_complete_evt(
struct hci_dev *hdev,
3370 static void hci_remote_host_features_evt(
struct hci_dev *hdev,
3387 static void hci_remote_oob_data_request_evt(
struct hci_dev *hdev,
3404 bacpy(&cp.bdaddr, &ev->
bdaddr);
3405 memcpy(cp.hash,
data->hash,
sizeof(cp.hash));
3406 memcpy(cp.randomizer,
data->randomizer,
sizeof(cp.randomizer));
3413 bacpy(&cp.bdaddr, &ev->
bdaddr);
3422 static void hci_le_conn_complete_evt(
struct hci_dev *hdev,
struct sk_buff *skb)
3435 BT_ERR(
"No memory for new connection");
3450 hci_proto_connect_cfm(conn, ev->
status);
3467 hci_proto_connect_cfm(conn, ev->
status);
3473 static void hci_le_adv_report_evt(
struct hci_dev *hdev,
struct sk_buff *skb)
3475 u8 num_reports = skb->
data[0];
3481 while (num_reports--) {
3488 ptr +=
sizeof(*ev) + ev->
length + 1;
3494 static void hci_le_ltk_request_evt(
struct hci_dev *hdev,
struct sk_buff *skb)
3514 memcpy(cp.ltk, ltk->val,
sizeof(ltk->val));
3517 if (ltk->authenticated)
3537 static void hci_le_meta_evt(
struct hci_dev *hdev,
struct sk_buff *skb)
3545 hci_le_conn_complete_evt(hdev, skb);
3549 hci_le_adv_report_evt(hdev, skb);
3553 hci_le_ltk_request_evt(hdev, skb);
3570 hci_inquiry_complete_evt(hdev, skb);
3574 hci_inquiry_result_evt(hdev, skb);
3578 hci_conn_complete_evt(hdev, skb);
3582 hci_conn_request_evt(hdev, skb);
3586 hci_disconn_complete_evt(hdev, skb);
3590 hci_auth_complete_evt(hdev, skb);
3594 hci_remote_name_evt(hdev, skb);
3598 hci_encrypt_change_evt(hdev, skb);
3602 hci_change_link_key_complete_evt(hdev, skb);
3606 hci_remote_features_evt(hdev, skb);
3610 hci_remote_version_evt(hdev, skb);
3614 hci_qos_setup_complete_evt(hdev, skb);
3618 hci_cmd_complete_evt(hdev, skb);
3622 hci_cmd_status_evt(hdev, skb);
3626 hci_role_change_evt(hdev, skb);
3630 hci_num_comp_pkts_evt(hdev, skb);
3634 hci_mode_change_evt(hdev, skb);
3638 hci_pin_code_request_evt(hdev, skb);
3642 hci_link_key_request_evt(hdev, skb);
3646 hci_link_key_notify_evt(hdev, skb);
3650 hci_clock_offset_evt(hdev, skb);
3654 hci_pkt_type_change_evt(hdev, skb);
3658 hci_pscan_rep_mode_evt(hdev, skb);
3662 hci_inquiry_result_with_rssi_evt(hdev, skb);
3666 hci_remote_ext_features_evt(hdev, skb);
3670 hci_sync_conn_complete_evt(hdev, skb);
3674 hci_sync_conn_changed_evt(hdev, skb);
3678 hci_sniff_subrate_evt(hdev, skb);
3682 hci_extended_inquiry_result_evt(hdev, skb);
3686 hci_key_refresh_complete_evt(hdev, skb);
3690 hci_io_capa_request_evt(hdev, skb);
3694 hci_io_capa_reply_evt(hdev, skb);
3698 hci_user_confirm_request_evt(hdev, skb);
3702 hci_user_passkey_request_evt(hdev, skb);
3706 hci_user_passkey_notify_evt(hdev, skb);
3710 hci_keypress_notify_evt(hdev, skb);
3714 hci_simple_pair_complete_evt(hdev, skb);
3718 hci_remote_host_features_evt(hdev, skb);
3722 hci_le_meta_evt(hdev, skb);
3726 hci_remote_oob_data_request_evt(hdev, skb);
3730 hci_num_comp_blocks_evt(hdev, skb);
3739 hdev->
stat.evt_rx++;