diff options
Diffstat (limited to 'net/bluetooth/hci_event.c')
-rw-r--r-- | net/bluetooth/hci_event.c | 605 |
1 files changed, 100 insertions, 505 deletions
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 477726a63512..138580745c2c 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c | |||
@@ -53,7 +53,7 @@ static void hci_cc_inquiry_cancel(struct hci_dev *hdev, struct sk_buff *skb) | |||
53 | hci_discovery_set_state(hdev, DISCOVERY_STOPPED); | 53 | hci_discovery_set_state(hdev, DISCOVERY_STOPPED); |
54 | hci_dev_unlock(hdev); | 54 | hci_dev_unlock(hdev); |
55 | 55 | ||
56 | hci_req_complete(hdev, HCI_OP_INQUIRY_CANCEL, status); | 56 | hci_req_cmd_complete(hdev, HCI_OP_INQUIRY, status); |
57 | 57 | ||
58 | hci_conn_check_pending(hdev); | 58 | hci_conn_check_pending(hdev); |
59 | } | 59 | } |
@@ -183,8 +183,6 @@ static void hci_cc_write_def_link_policy(struct hci_dev *hdev, | |||
183 | 183 | ||
184 | if (!status) | 184 | if (!status) |
185 | hdev->link_policy = get_unaligned_le16(sent); | 185 | hdev->link_policy = get_unaligned_le16(sent); |
186 | |||
187 | hci_req_complete(hdev, HCI_OP_WRITE_DEF_LINK_POLICY, status); | ||
188 | } | 186 | } |
189 | 187 | ||
190 | static void hci_cc_reset(struct hci_dev *hdev, struct sk_buff *skb) | 188 | static void hci_cc_reset(struct hci_dev *hdev, struct sk_buff *skb) |
@@ -195,11 +193,8 @@ static void hci_cc_reset(struct hci_dev *hdev, struct sk_buff *skb) | |||
195 | 193 | ||
196 | clear_bit(HCI_RESET, &hdev->flags); | 194 | clear_bit(HCI_RESET, &hdev->flags); |
197 | 195 | ||
198 | hci_req_complete(hdev, HCI_OP_RESET, status); | ||
199 | |||
200 | /* Reset all non-persistent flags */ | 196 | /* Reset all non-persistent flags */ |
201 | hdev->dev_flags &= ~(BIT(HCI_LE_SCAN) | BIT(HCI_PENDING_CLASS) | | 197 | hdev->dev_flags &= ~HCI_PERSISTENT_MASK; |
202 | BIT(HCI_PERIODIC_INQ)); | ||
203 | 198 | ||
204 | hdev->discovery.state = DISCOVERY_STOPPED; | 199 | hdev->discovery.state = DISCOVERY_STOPPED; |
205 | hdev->inq_tx_power = HCI_TX_POWER_INVALID; | 200 | hdev->inq_tx_power = HCI_TX_POWER_INVALID; |
@@ -228,11 +223,6 @@ static void hci_cc_write_local_name(struct hci_dev *hdev, struct sk_buff *skb) | |||
228 | memcpy(hdev->dev_name, sent, HCI_MAX_NAME_LENGTH); | 223 | memcpy(hdev->dev_name, sent, HCI_MAX_NAME_LENGTH); |
229 | 224 | ||
230 | hci_dev_unlock(hdev); | 225 | hci_dev_unlock(hdev); |
231 | |||
232 | if (!status && !test_bit(HCI_INIT, &hdev->flags)) | ||
233 | hci_update_ad(hdev); | ||
234 | |||
235 | hci_req_complete(hdev, HCI_OP_WRITE_LOCAL_NAME, status); | ||
236 | } | 226 | } |
237 | 227 | ||
238 | static void hci_cc_read_local_name(struct hci_dev *hdev, struct sk_buff *skb) | 228 | static void hci_cc_read_local_name(struct hci_dev *hdev, struct sk_buff *skb) |
@@ -270,8 +260,6 @@ static void hci_cc_write_auth_enable(struct hci_dev *hdev, struct sk_buff *skb) | |||
270 | 260 | ||
271 | if (test_bit(HCI_MGMT, &hdev->dev_flags)) | 261 | if (test_bit(HCI_MGMT, &hdev->dev_flags)) |
272 | mgmt_auth_enable_complete(hdev, status); | 262 | mgmt_auth_enable_complete(hdev, status); |
273 | |||
274 | hci_req_complete(hdev, HCI_OP_WRITE_AUTH_ENABLE, status); | ||
275 | } | 263 | } |
276 | 264 | ||
277 | static void hci_cc_write_encrypt_mode(struct hci_dev *hdev, struct sk_buff *skb) | 265 | static void hci_cc_write_encrypt_mode(struct hci_dev *hdev, struct sk_buff *skb) |
@@ -293,8 +281,6 @@ static void hci_cc_write_encrypt_mode(struct hci_dev *hdev, struct sk_buff *skb) | |||
293 | else | 281 | else |
294 | clear_bit(HCI_ENCRYPT, &hdev->flags); | 282 | clear_bit(HCI_ENCRYPT, &hdev->flags); |
295 | } | 283 | } |
296 | |||
297 | hci_req_complete(hdev, HCI_OP_WRITE_ENCRYPT_MODE, status); | ||
298 | } | 284 | } |
299 | 285 | ||
300 | static void hci_cc_write_scan_enable(struct hci_dev *hdev, struct sk_buff *skb) | 286 | static void hci_cc_write_scan_enable(struct hci_dev *hdev, struct sk_buff *skb) |
@@ -343,7 +329,6 @@ static void hci_cc_write_scan_enable(struct hci_dev *hdev, struct sk_buff *skb) | |||
343 | 329 | ||
344 | done: | 330 | done: |
345 | hci_dev_unlock(hdev); | 331 | hci_dev_unlock(hdev); |
346 | hci_req_complete(hdev, HCI_OP_WRITE_SCAN_ENABLE, status); | ||
347 | } | 332 | } |
348 | 333 | ||
349 | static void hci_cc_read_class_of_dev(struct hci_dev *hdev, struct sk_buff *skb) | 334 | static void hci_cc_read_class_of_dev(struct hci_dev *hdev, struct sk_buff *skb) |
@@ -435,15 +420,6 @@ static void hci_cc_write_voice_setting(struct hci_dev *hdev, | |||
435 | hdev->notify(hdev, HCI_NOTIFY_VOICE_SETTING); | 420 | hdev->notify(hdev, HCI_NOTIFY_VOICE_SETTING); |
436 | } | 421 | } |
437 | 422 | ||
438 | static void hci_cc_host_buffer_size(struct hci_dev *hdev, struct sk_buff *skb) | ||
439 | { | ||
440 | __u8 status = *((__u8 *) skb->data); | ||
441 | |||
442 | BT_DBG("%s status 0x%2.2x", hdev->name, status); | ||
443 | |||
444 | hci_req_complete(hdev, HCI_OP_HOST_BUFFER_SIZE, status); | ||
445 | } | ||
446 | |||
447 | static void hci_cc_write_ssp_mode(struct hci_dev *hdev, struct sk_buff *skb) | 423 | static void hci_cc_write_ssp_mode(struct hci_dev *hdev, struct sk_buff *skb) |
448 | { | 424 | { |
449 | __u8 status = *((__u8 *) skb->data); | 425 | __u8 status = *((__u8 *) skb->data); |
@@ -472,211 +448,6 @@ static void hci_cc_write_ssp_mode(struct hci_dev *hdev, struct sk_buff *skb) | |||
472 | } | 448 | } |
473 | } | 449 | } |
474 | 450 | ||
475 | static u8 hci_get_inquiry_mode(struct hci_dev *hdev) | ||
476 | { | ||
477 | if (lmp_ext_inq_capable(hdev)) | ||
478 | return 2; | ||
479 | |||
480 | if (lmp_inq_rssi_capable(hdev)) | ||
481 | return 1; | ||
482 | |||
483 | if (hdev->manufacturer == 11 && hdev->hci_rev == 0x00 && | ||
484 | hdev->lmp_subver == 0x0757) | ||
485 | return 1; | ||
486 | |||
487 | if (hdev->manufacturer == 15) { | ||
488 | if (hdev->hci_rev == 0x03 && hdev->lmp_subver == 0x6963) | ||
489 | return 1; | ||
490 | if (hdev->hci_rev == 0x09 && hdev->lmp_subver == 0x6963) | ||
491 | return 1; | ||
492 | if (hdev->hci_rev == 0x00 && hdev->lmp_subver == 0x6965) | ||
493 | return 1; | ||
494 | } | ||
495 | |||
496 | if (hdev->manufacturer == 31 && hdev->hci_rev == 0x2005 && | ||
497 | hdev->lmp_subver == 0x1805) | ||
498 | return 1; | ||
499 | |||
500 | return 0; | ||
501 | } | ||
502 | |||
503 | static void hci_setup_inquiry_mode(struct hci_dev *hdev) | ||
504 | { | ||
505 | u8 mode; | ||
506 | |||
507 | mode = hci_get_inquiry_mode(hdev); | ||
508 | |||
509 | hci_send_cmd(hdev, HCI_OP_WRITE_INQUIRY_MODE, 1, &mode); | ||
510 | } | ||
511 | |||
512 | static void hci_setup_event_mask(struct hci_dev *hdev) | ||
513 | { | ||
514 | /* The second byte is 0xff instead of 0x9f (two reserved bits | ||
515 | * disabled) since a Broadcom 1.2 dongle doesn't respond to the | ||
516 | * command otherwise */ | ||
517 | u8 events[8] = { 0xff, 0xff, 0xfb, 0xff, 0x00, 0x00, 0x00, 0x00 }; | ||
518 | |||
519 | /* CSR 1.1 dongles does not accept any bitfield so don't try to set | ||
520 | * any event mask for pre 1.2 devices */ | ||
521 | if (hdev->hci_ver < BLUETOOTH_VER_1_2) | ||
522 | return; | ||
523 | |||
524 | if (lmp_bredr_capable(hdev)) { | ||
525 | events[4] |= 0x01; /* Flow Specification Complete */ | ||
526 | events[4] |= 0x02; /* Inquiry Result with RSSI */ | ||
527 | events[4] |= 0x04; /* Read Remote Extended Features Complete */ | ||
528 | events[5] |= 0x08; /* Synchronous Connection Complete */ | ||
529 | events[5] |= 0x10; /* Synchronous Connection Changed */ | ||
530 | } | ||
531 | |||
532 | if (lmp_inq_rssi_capable(hdev)) | ||
533 | events[4] |= 0x02; /* Inquiry Result with RSSI */ | ||
534 | |||
535 | if (lmp_sniffsubr_capable(hdev)) | ||
536 | events[5] |= 0x20; /* Sniff Subrating */ | ||
537 | |||
538 | if (lmp_pause_enc_capable(hdev)) | ||
539 | events[5] |= 0x80; /* Encryption Key Refresh Complete */ | ||
540 | |||
541 | if (lmp_ext_inq_capable(hdev)) | ||
542 | events[5] |= 0x40; /* Extended Inquiry Result */ | ||
543 | |||
544 | if (lmp_no_flush_capable(hdev)) | ||
545 | events[7] |= 0x01; /* Enhanced Flush Complete */ | ||
546 | |||
547 | if (lmp_lsto_capable(hdev)) | ||
548 | events[6] |= 0x80; /* Link Supervision Timeout Changed */ | ||
549 | |||
550 | if (lmp_ssp_capable(hdev)) { | ||
551 | events[6] |= 0x01; /* IO Capability Request */ | ||
552 | events[6] |= 0x02; /* IO Capability Response */ | ||
553 | events[6] |= 0x04; /* User Confirmation Request */ | ||
554 | events[6] |= 0x08; /* User Passkey Request */ | ||
555 | events[6] |= 0x10; /* Remote OOB Data Request */ | ||
556 | events[6] |= 0x20; /* Simple Pairing Complete */ | ||
557 | events[7] |= 0x04; /* User Passkey Notification */ | ||
558 | events[7] |= 0x08; /* Keypress Notification */ | ||
559 | events[7] |= 0x10; /* Remote Host Supported | ||
560 | * Features Notification */ | ||
561 | } | ||
562 | |||
563 | if (lmp_le_capable(hdev)) | ||
564 | events[7] |= 0x20; /* LE Meta-Event */ | ||
565 | |||
566 | hci_send_cmd(hdev, HCI_OP_SET_EVENT_MASK, sizeof(events), events); | ||
567 | |||
568 | if (lmp_le_capable(hdev)) { | ||
569 | memset(events, 0, sizeof(events)); | ||
570 | events[0] = 0x1f; | ||
571 | hci_send_cmd(hdev, HCI_OP_LE_SET_EVENT_MASK, | ||
572 | sizeof(events), events); | ||
573 | } | ||
574 | } | ||
575 | |||
576 | static void bredr_setup(struct hci_dev *hdev) | ||
577 | { | ||
578 | struct hci_cp_delete_stored_link_key cp; | ||
579 | __le16 param; | ||
580 | __u8 flt_type; | ||
581 | |||
582 | /* Read Buffer Size (ACL mtu, max pkt, etc.) */ | ||
583 | hci_send_cmd(hdev, HCI_OP_READ_BUFFER_SIZE, 0, NULL); | ||
584 | |||
585 | /* Read Class of Device */ | ||
586 | hci_send_cmd(hdev, HCI_OP_READ_CLASS_OF_DEV, 0, NULL); | ||
587 | |||
588 | /* Read Local Name */ | ||
589 | hci_send_cmd(hdev, HCI_OP_READ_LOCAL_NAME, 0, NULL); | ||
590 | |||
591 | /* Read Voice Setting */ | ||
592 | hci_send_cmd(hdev, HCI_OP_READ_VOICE_SETTING, 0, NULL); | ||
593 | |||
594 | /* Clear Event Filters */ | ||
595 | flt_type = HCI_FLT_CLEAR_ALL; | ||
596 | hci_send_cmd(hdev, HCI_OP_SET_EVENT_FLT, 1, &flt_type); | ||
597 | |||
598 | /* Connection accept timeout ~20 secs */ | ||
599 | param = __constant_cpu_to_le16(0x7d00); | ||
600 | hci_send_cmd(hdev, HCI_OP_WRITE_CA_TIMEOUT, 2, ¶m); | ||
601 | |||
602 | bacpy(&cp.bdaddr, BDADDR_ANY); | ||
603 | cp.delete_all = 1; | ||
604 | hci_send_cmd(hdev, HCI_OP_DELETE_STORED_LINK_KEY, sizeof(cp), &cp); | ||
605 | } | ||
606 | |||
607 | static void le_setup(struct hci_dev *hdev) | ||
608 | { | ||
609 | /* Read LE Buffer Size */ | ||
610 | hci_send_cmd(hdev, HCI_OP_LE_READ_BUFFER_SIZE, 0, NULL); | ||
611 | |||
612 | /* Read LE Local Supported Features */ | ||
613 | hci_send_cmd(hdev, HCI_OP_LE_READ_LOCAL_FEATURES, 0, NULL); | ||
614 | |||
615 | /* Read LE Advertising Channel TX Power */ | ||
616 | hci_send_cmd(hdev, HCI_OP_LE_READ_ADV_TX_POWER, 0, NULL); | ||
617 | |||
618 | /* Read LE White List Size */ | ||
619 | hci_send_cmd(hdev, HCI_OP_LE_READ_WHITE_LIST_SIZE, 0, NULL); | ||
620 | |||
621 | /* Read LE Supported States */ | ||
622 | hci_send_cmd(hdev, HCI_OP_LE_READ_SUPPORTED_STATES, 0, NULL); | ||
623 | } | ||
624 | |||
625 | static void hci_setup(struct hci_dev *hdev) | ||
626 | { | ||
627 | if (hdev->dev_type != HCI_BREDR) | ||
628 | return; | ||
629 | |||
630 | /* Read BD Address */ | ||
631 | hci_send_cmd(hdev, HCI_OP_READ_BD_ADDR, 0, NULL); | ||
632 | |||
633 | if (lmp_bredr_capable(hdev)) | ||
634 | bredr_setup(hdev); | ||
635 | |||
636 | if (lmp_le_capable(hdev)) | ||
637 | le_setup(hdev); | ||
638 | |||
639 | hci_setup_event_mask(hdev); | ||
640 | |||
641 | if (hdev->hci_ver > BLUETOOTH_VER_1_1) | ||
642 | hci_send_cmd(hdev, HCI_OP_READ_LOCAL_COMMANDS, 0, NULL); | ||
643 | |||
644 | if (lmp_ssp_capable(hdev)) { | ||
645 | if (test_bit(HCI_SSP_ENABLED, &hdev->dev_flags)) { | ||
646 | u8 mode = 0x01; | ||
647 | hci_send_cmd(hdev, HCI_OP_WRITE_SSP_MODE, | ||
648 | sizeof(mode), &mode); | ||
649 | } else { | ||
650 | struct hci_cp_write_eir cp; | ||
651 | |||
652 | memset(hdev->eir, 0, sizeof(hdev->eir)); | ||
653 | memset(&cp, 0, sizeof(cp)); | ||
654 | |||
655 | hci_send_cmd(hdev, HCI_OP_WRITE_EIR, sizeof(cp), &cp); | ||
656 | } | ||
657 | } | ||
658 | |||
659 | if (lmp_inq_rssi_capable(hdev)) | ||
660 | hci_setup_inquiry_mode(hdev); | ||
661 | |||
662 | if (lmp_inq_tx_pwr_capable(hdev)) | ||
663 | hci_send_cmd(hdev, HCI_OP_READ_INQ_RSP_TX_POWER, 0, NULL); | ||
664 | |||
665 | if (lmp_ext_feat_capable(hdev)) { | ||
666 | struct hci_cp_read_local_ext_features cp; | ||
667 | |||
668 | cp.page = 0x01; | ||
669 | hci_send_cmd(hdev, HCI_OP_READ_LOCAL_EXT_FEATURES, sizeof(cp), | ||
670 | &cp); | ||
671 | } | ||
672 | |||
673 | if (test_bit(HCI_LINK_SECURITY, &hdev->dev_flags)) { | ||
674 | u8 enable = 1; | ||
675 | hci_send_cmd(hdev, HCI_OP_WRITE_AUTH_ENABLE, sizeof(enable), | ||
676 | &enable); | ||
677 | } | ||
678 | } | ||
679 | |||
680 | static void hci_cc_read_local_version(struct hci_dev *hdev, struct sk_buff *skb) | 451 | static void hci_cc_read_local_version(struct hci_dev *hdev, struct sk_buff *skb) |
681 | { | 452 | { |
682 | struct hci_rp_read_local_version *rp = (void *) skb->data; | 453 | struct hci_rp_read_local_version *rp = (void *) skb->data; |
@@ -684,7 +455,7 @@ static void hci_cc_read_local_version(struct hci_dev *hdev, struct sk_buff *skb) | |||
684 | BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); | 455 | BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); |
685 | 456 | ||
686 | if (rp->status) | 457 | if (rp->status) |
687 | goto done; | 458 | return; |
688 | 459 | ||
689 | hdev->hci_ver = rp->hci_ver; | 460 | hdev->hci_ver = rp->hci_ver; |
690 | hdev->hci_rev = __le16_to_cpu(rp->hci_rev); | 461 | hdev->hci_rev = __le16_to_cpu(rp->hci_rev); |
@@ -694,30 +465,6 @@ static void hci_cc_read_local_version(struct hci_dev *hdev, struct sk_buff *skb) | |||
694 | 465 | ||
695 | BT_DBG("%s manufacturer 0x%4.4x hci ver %d:%d", hdev->name, | 466 | BT_DBG("%s manufacturer 0x%4.4x hci ver %d:%d", hdev->name, |
696 | hdev->manufacturer, hdev->hci_ver, hdev->hci_rev); | 467 | hdev->manufacturer, hdev->hci_ver, hdev->hci_rev); |
697 | |||
698 | if (test_bit(HCI_INIT, &hdev->flags)) | ||
699 | hci_setup(hdev); | ||
700 | |||
701 | done: | ||
702 | hci_req_complete(hdev, HCI_OP_READ_LOCAL_VERSION, rp->status); | ||
703 | } | ||
704 | |||
705 | static void hci_setup_link_policy(struct hci_dev *hdev) | ||
706 | { | ||
707 | struct hci_cp_write_def_link_policy cp; | ||
708 | u16 link_policy = 0; | ||
709 | |||
710 | if (lmp_rswitch_capable(hdev)) | ||
711 | link_policy |= HCI_LP_RSWITCH; | ||
712 | if (lmp_hold_capable(hdev)) | ||
713 | link_policy |= HCI_LP_HOLD; | ||
714 | if (lmp_sniff_capable(hdev)) | ||
715 | link_policy |= HCI_LP_SNIFF; | ||
716 | if (lmp_park_capable(hdev)) | ||
717 | link_policy |= HCI_LP_PARK; | ||
718 | |||
719 | cp.policy = cpu_to_le16(link_policy); | ||
720 | hci_send_cmd(hdev, HCI_OP_WRITE_DEF_LINK_POLICY, sizeof(cp), &cp); | ||
721 | } | 468 | } |
722 | 469 | ||
723 | static void hci_cc_read_local_commands(struct hci_dev *hdev, | 470 | static void hci_cc_read_local_commands(struct hci_dev *hdev, |
@@ -727,16 +474,8 @@ static void hci_cc_read_local_commands(struct hci_dev *hdev, | |||
727 | 474 | ||
728 | BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); | 475 | BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); |
729 | 476 | ||
730 | if (rp->status) | 477 | if (!rp->status) |
731 | goto done; | 478 | memcpy(hdev->commands, rp->commands, sizeof(hdev->commands)); |
732 | |||
733 | memcpy(hdev->commands, rp->commands, sizeof(hdev->commands)); | ||
734 | |||
735 | if (test_bit(HCI_INIT, &hdev->flags) && (hdev->commands[5] & 0x10)) | ||
736 | hci_setup_link_policy(hdev); | ||
737 | |||
738 | done: | ||
739 | hci_req_complete(hdev, HCI_OP_READ_LOCAL_COMMANDS, rp->status); | ||
740 | } | 479 | } |
741 | 480 | ||
742 | static void hci_cc_read_local_features(struct hci_dev *hdev, | 481 | static void hci_cc_read_local_features(struct hci_dev *hdev, |
@@ -795,22 +534,6 @@ static void hci_cc_read_local_features(struct hci_dev *hdev, | |||
795 | hdev->features[6], hdev->features[7]); | 534 | hdev->features[6], hdev->features[7]); |
796 | } | 535 | } |
797 | 536 | ||
798 | static void hci_set_le_support(struct hci_dev *hdev) | ||
799 | { | ||
800 | struct hci_cp_write_le_host_supported cp; | ||
801 | |||
802 | memset(&cp, 0, sizeof(cp)); | ||
803 | |||
804 | if (test_bit(HCI_LE_ENABLED, &hdev->dev_flags)) { | ||
805 | cp.le = 1; | ||
806 | cp.simul = lmp_le_br_capable(hdev); | ||
807 | } | ||
808 | |||
809 | if (cp.le != lmp_host_le_capable(hdev)) | ||
810 | hci_send_cmd(hdev, HCI_OP_WRITE_LE_HOST_SUPPORTED, sizeof(cp), | ||
811 | &cp); | ||
812 | } | ||
813 | |||
814 | static void hci_cc_read_local_ext_features(struct hci_dev *hdev, | 537 | static void hci_cc_read_local_ext_features(struct hci_dev *hdev, |
815 | struct sk_buff *skb) | 538 | struct sk_buff *skb) |
816 | { | 539 | { |
@@ -819,7 +542,7 @@ static void hci_cc_read_local_ext_features(struct hci_dev *hdev, | |||
819 | BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); | 542 | BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); |
820 | 543 | ||
821 | if (rp->status) | 544 | if (rp->status) |
822 | goto done; | 545 | return; |
823 | 546 | ||
824 | switch (rp->page) { | 547 | switch (rp->page) { |
825 | case 0: | 548 | case 0: |
@@ -829,12 +552,6 @@ static void hci_cc_read_local_ext_features(struct hci_dev *hdev, | |||
829 | memcpy(hdev->host_features, rp->features, 8); | 552 | memcpy(hdev->host_features, rp->features, 8); |
830 | break; | 553 | break; |
831 | } | 554 | } |
832 | |||
833 | if (test_bit(HCI_INIT, &hdev->flags) && lmp_le_capable(hdev)) | ||
834 | hci_set_le_support(hdev); | ||
835 | |||
836 | done: | ||
837 | hci_req_complete(hdev, HCI_OP_READ_LOCAL_EXT_FEATURES, rp->status); | ||
838 | } | 555 | } |
839 | 556 | ||
840 | static void hci_cc_read_flow_control_mode(struct hci_dev *hdev, | 557 | static void hci_cc_read_flow_control_mode(struct hci_dev *hdev, |
@@ -844,12 +561,8 @@ static void hci_cc_read_flow_control_mode(struct hci_dev *hdev, | |||
844 | 561 | ||
845 | BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); | 562 | BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); |
846 | 563 | ||
847 | if (rp->status) | 564 | if (!rp->status) |
848 | return; | 565 | hdev->flow_ctl_mode = rp->mode; |
849 | |||
850 | hdev->flow_ctl_mode = rp->mode; | ||
851 | |||
852 | hci_req_complete(hdev, HCI_OP_READ_FLOW_CONTROL_MODE, rp->status); | ||
853 | } | 566 | } |
854 | 567 | ||
855 | static void hci_cc_read_buffer_size(struct hci_dev *hdev, struct sk_buff *skb) | 568 | static void hci_cc_read_buffer_size(struct hci_dev *hdev, struct sk_buff *skb) |
@@ -886,8 +599,65 @@ static void hci_cc_read_bd_addr(struct hci_dev *hdev, struct sk_buff *skb) | |||
886 | 599 | ||
887 | if (!rp->status) | 600 | if (!rp->status) |
888 | bacpy(&hdev->bdaddr, &rp->bdaddr); | 601 | bacpy(&hdev->bdaddr, &rp->bdaddr); |
602 | } | ||
603 | |||
604 | static void hci_cc_read_page_scan_activity(struct hci_dev *hdev, | ||
605 | struct sk_buff *skb) | ||
606 | { | ||
607 | struct hci_rp_read_page_scan_activity *rp = (void *) skb->data; | ||
608 | |||
609 | BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); | ||
610 | |||
611 | if (test_bit(HCI_INIT, &hdev->flags) && !rp->status) { | ||
612 | hdev->page_scan_interval = __le16_to_cpu(rp->interval); | ||
613 | hdev->page_scan_window = __le16_to_cpu(rp->window); | ||
614 | } | ||
615 | } | ||
616 | |||
617 | static void hci_cc_write_page_scan_activity(struct hci_dev *hdev, | ||
618 | struct sk_buff *skb) | ||
619 | { | ||
620 | u8 status = *((u8 *) skb->data); | ||
621 | struct hci_cp_write_page_scan_activity *sent; | ||
622 | |||
623 | BT_DBG("%s status 0x%2.2x", hdev->name, status); | ||
624 | |||
625 | if (status) | ||
626 | return; | ||
627 | |||
628 | sent = hci_sent_cmd_data(hdev, HCI_OP_WRITE_PAGE_SCAN_ACTIVITY); | ||
629 | if (!sent) | ||
630 | return; | ||
631 | |||
632 | hdev->page_scan_interval = __le16_to_cpu(sent->interval); | ||
633 | hdev->page_scan_window = __le16_to_cpu(sent->window); | ||
634 | } | ||
635 | |||
636 | static void hci_cc_read_page_scan_type(struct hci_dev *hdev, | ||
637 | struct sk_buff *skb) | ||
638 | { | ||
639 | struct hci_rp_read_page_scan_type *rp = (void *) skb->data; | ||
640 | |||
641 | BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); | ||
642 | |||
643 | if (test_bit(HCI_INIT, &hdev->flags) && !rp->status) | ||
644 | hdev->page_scan_type = rp->type; | ||
645 | } | ||
646 | |||
647 | static void hci_cc_write_page_scan_type(struct hci_dev *hdev, | ||
648 | struct sk_buff *skb) | ||
649 | { | ||
650 | u8 status = *((u8 *) skb->data); | ||
651 | u8 *type; | ||
889 | 652 | ||
890 | hci_req_complete(hdev, HCI_OP_READ_BD_ADDR, rp->status); | 653 | BT_DBG("%s status 0x%2.2x", hdev->name, status); |
654 | |||
655 | if (status) | ||
656 | return; | ||
657 | |||
658 | type = hci_sent_cmd_data(hdev, HCI_OP_WRITE_PAGE_SCAN_TYPE); | ||
659 | if (type) | ||
660 | hdev->page_scan_type = *type; | ||
891 | } | 661 | } |
892 | 662 | ||
893 | static void hci_cc_read_data_block_size(struct hci_dev *hdev, | 663 | static void hci_cc_read_data_block_size(struct hci_dev *hdev, |
@@ -908,17 +678,6 @@ static void hci_cc_read_data_block_size(struct hci_dev *hdev, | |||
908 | 678 | ||
909 | BT_DBG("%s blk mtu %d cnt %d len %d", hdev->name, hdev->block_mtu, | 679 | BT_DBG("%s blk mtu %d cnt %d len %d", hdev->name, hdev->block_mtu, |
910 | hdev->block_cnt, hdev->block_len); | 680 | hdev->block_cnt, hdev->block_len); |
911 | |||
912 | hci_req_complete(hdev, HCI_OP_READ_DATA_BLOCK_SIZE, rp->status); | ||
913 | } | ||
914 | |||
915 | static void hci_cc_write_ca_timeout(struct hci_dev *hdev, struct sk_buff *skb) | ||
916 | { | ||
917 | __u8 status = *((__u8 *) skb->data); | ||
918 | |||
919 | BT_DBG("%s status 0x%2.2x", hdev->name, status); | ||
920 | |||
921 | hci_req_complete(hdev, HCI_OP_WRITE_CA_TIMEOUT, status); | ||
922 | } | 681 | } |
923 | 682 | ||
924 | static void hci_cc_read_local_amp_info(struct hci_dev *hdev, | 683 | static void hci_cc_read_local_amp_info(struct hci_dev *hdev, |
@@ -942,8 +701,6 @@ static void hci_cc_read_local_amp_info(struct hci_dev *hdev, | |||
942 | hdev->amp_be_flush_to = __le32_to_cpu(rp->be_flush_to); | 701 | hdev->amp_be_flush_to = __le32_to_cpu(rp->be_flush_to); |
943 | hdev->amp_max_flush_to = __le32_to_cpu(rp->max_flush_to); | 702 | hdev->amp_max_flush_to = __le32_to_cpu(rp->max_flush_to); |
944 | 703 | ||
945 | hci_req_complete(hdev, HCI_OP_READ_LOCAL_AMP_INFO, rp->status); | ||
946 | |||
947 | a2mp_rsp: | 704 | a2mp_rsp: |
948 | a2mp_send_getinfo_rsp(hdev); | 705 | a2mp_send_getinfo_rsp(hdev); |
949 | } | 706 | } |
@@ -985,35 +742,6 @@ a2mp_rsp: | |||
985 | a2mp_send_create_phy_link_req(hdev, rp->status); | 742 | a2mp_send_create_phy_link_req(hdev, rp->status); |
986 | } | 743 | } |
987 | 744 | ||
988 | static void hci_cc_delete_stored_link_key(struct hci_dev *hdev, | ||
989 | struct sk_buff *skb) | ||
990 | { | ||
991 | __u8 status = *((__u8 *) skb->data); | ||
992 | |||
993 | BT_DBG("%s status 0x%2.2x", hdev->name, status); | ||
994 | |||
995 | hci_req_complete(hdev, HCI_OP_DELETE_STORED_LINK_KEY, status); | ||
996 | } | ||
997 | |||
998 | static void hci_cc_set_event_mask(struct hci_dev *hdev, struct sk_buff *skb) | ||
999 | { | ||
1000 | __u8 status = *((__u8 *) skb->data); | ||
1001 | |||
1002 | BT_DBG("%s status 0x%2.2x", hdev->name, status); | ||
1003 | |||
1004 | hci_req_complete(hdev, HCI_OP_SET_EVENT_MASK, status); | ||
1005 | } | ||
1006 | |||
1007 | static void hci_cc_write_inquiry_mode(struct hci_dev *hdev, | ||
1008 | struct sk_buff *skb) | ||
1009 | { | ||
1010 | __u8 status = *((__u8 *) skb->data); | ||
1011 | |||
1012 | BT_DBG("%s status 0x%2.2x", hdev->name, status); | ||
1013 | |||
1014 | hci_req_complete(hdev, HCI_OP_WRITE_INQUIRY_MODE, status); | ||
1015 | } | ||
1016 | |||
1017 | static void hci_cc_read_inq_rsp_tx_power(struct hci_dev *hdev, | 745 | static void hci_cc_read_inq_rsp_tx_power(struct hci_dev *hdev, |
1018 | struct sk_buff *skb) | 746 | struct sk_buff *skb) |
1019 | { | 747 | { |
@@ -1023,17 +751,6 @@ static void hci_cc_read_inq_rsp_tx_power(struct hci_dev *hdev, | |||
1023 | 751 | ||
1024 | if (!rp->status) | 752 | if (!rp->status) |
1025 | hdev->inq_tx_power = rp->tx_power; | 753 | hdev->inq_tx_power = rp->tx_power; |
1026 | |||
1027 | hci_req_complete(hdev, HCI_OP_READ_INQ_RSP_TX_POWER, rp->status); | ||
1028 | } | ||
1029 | |||
1030 | static void hci_cc_set_event_flt(struct hci_dev *hdev, struct sk_buff *skb) | ||
1031 | { | ||
1032 | __u8 status = *((__u8 *) skb->data); | ||
1033 | |||
1034 | BT_DBG("%s status 0x%2.2x", hdev->name, status); | ||
1035 | |||
1036 | hci_req_complete(hdev, HCI_OP_SET_EVENT_FLT, status); | ||
1037 | } | 754 | } |
1038 | 755 | ||
1039 | static void hci_cc_pin_code_reply(struct hci_dev *hdev, struct sk_buff *skb) | 756 | static void hci_cc_pin_code_reply(struct hci_dev *hdev, struct sk_buff *skb) |
@@ -1095,8 +812,6 @@ static void hci_cc_le_read_buffer_size(struct hci_dev *hdev, | |||
1095 | hdev->le_cnt = hdev->le_pkts; | 812 | hdev->le_cnt = hdev->le_pkts; |
1096 | 813 | ||
1097 | BT_DBG("%s le mtu %d:%d", hdev->name, hdev->le_mtu, hdev->le_pkts); | 814 | BT_DBG("%s le mtu %d:%d", hdev->name, hdev->le_mtu, hdev->le_pkts); |
1098 | |||
1099 | hci_req_complete(hdev, HCI_OP_LE_READ_BUFFER_SIZE, rp->status); | ||
1100 | } | 815 | } |
1101 | 816 | ||
1102 | static void hci_cc_le_read_local_features(struct hci_dev *hdev, | 817 | static void hci_cc_le_read_local_features(struct hci_dev *hdev, |
@@ -1108,8 +823,6 @@ static void hci_cc_le_read_local_features(struct hci_dev *hdev, | |||
1108 | 823 | ||
1109 | if (!rp->status) | 824 | if (!rp->status) |
1110 | memcpy(hdev->le_features, rp->features, 8); | 825 | memcpy(hdev->le_features, rp->features, 8); |
1111 | |||
1112 | hci_req_complete(hdev, HCI_OP_LE_READ_LOCAL_FEATURES, rp->status); | ||
1113 | } | 826 | } |
1114 | 827 | ||
1115 | static void hci_cc_le_read_adv_tx_power(struct hci_dev *hdev, | 828 | static void hci_cc_le_read_adv_tx_power(struct hci_dev *hdev, |
@@ -1119,22 +832,8 @@ static void hci_cc_le_read_adv_tx_power(struct hci_dev *hdev, | |||
1119 | 832 | ||
1120 | BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); | 833 | BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); |
1121 | 834 | ||
1122 | if (!rp->status) { | 835 | if (!rp->status) |
1123 | hdev->adv_tx_power = rp->tx_power; | 836 | hdev->adv_tx_power = rp->tx_power; |
1124 | if (!test_bit(HCI_INIT, &hdev->flags)) | ||
1125 | hci_update_ad(hdev); | ||
1126 | } | ||
1127 | |||
1128 | hci_req_complete(hdev, HCI_OP_LE_READ_ADV_TX_POWER, rp->status); | ||
1129 | } | ||
1130 | |||
1131 | static void hci_cc_le_set_event_mask(struct hci_dev *hdev, struct sk_buff *skb) | ||
1132 | { | ||
1133 | __u8 status = *((__u8 *) skb->data); | ||
1134 | |||
1135 | BT_DBG("%s status 0x%2.2x", hdev->name, status); | ||
1136 | |||
1137 | hci_req_complete(hdev, HCI_OP_LE_SET_EVENT_MASK, status); | ||
1138 | } | 837 | } |
1139 | 838 | ||
1140 | static void hci_cc_user_confirm_reply(struct hci_dev *hdev, struct sk_buff *skb) | 839 | static void hci_cc_user_confirm_reply(struct hci_dev *hdev, struct sk_buff *skb) |
@@ -1231,12 +930,15 @@ static void hci_cc_le_set_adv_enable(struct hci_dev *hdev, struct sk_buff *skb) | |||
1231 | clear_bit(HCI_LE_PERIPHERAL, &hdev->dev_flags); | 930 | clear_bit(HCI_LE_PERIPHERAL, &hdev->dev_flags); |
1232 | } | 931 | } |
1233 | 932 | ||
1234 | hci_dev_unlock(hdev); | 933 | if (!test_bit(HCI_INIT, &hdev->flags)) { |
934 | struct hci_request req; | ||
1235 | 935 | ||
1236 | if (!test_bit(HCI_INIT, &hdev->flags)) | 936 | hci_req_init(&req, hdev); |
1237 | hci_update_ad(hdev); | 937 | hci_update_ad(&req); |
938 | hci_req_run(&req, NULL); | ||
939 | } | ||
1238 | 940 | ||
1239 | hci_req_complete(hdev, HCI_OP_LE_SET_ADV_ENABLE, status); | 941 | hci_dev_unlock(hdev); |
1240 | } | 942 | } |
1241 | 943 | ||
1242 | static void hci_cc_le_set_scan_param(struct hci_dev *hdev, struct sk_buff *skb) | 944 | static void hci_cc_le_set_scan_param(struct hci_dev *hdev, struct sk_buff *skb) |
@@ -1245,8 +947,6 @@ static void hci_cc_le_set_scan_param(struct hci_dev *hdev, struct sk_buff *skb) | |||
1245 | 947 | ||
1246 | BT_DBG("%s status 0x%2.2x", hdev->name, status); | 948 | BT_DBG("%s status 0x%2.2x", hdev->name, status); |
1247 | 949 | ||
1248 | hci_req_complete(hdev, HCI_OP_LE_SET_SCAN_PARAM, status); | ||
1249 | |||
1250 | if (status) { | 950 | if (status) { |
1251 | hci_dev_lock(hdev); | 951 | hci_dev_lock(hdev); |
1252 | mgmt_start_discovery_failed(hdev, status); | 952 | mgmt_start_discovery_failed(hdev, status); |
@@ -1269,8 +969,6 @@ static void hci_cc_le_set_scan_enable(struct hci_dev *hdev, | |||
1269 | 969 | ||
1270 | switch (cp->enable) { | 970 | switch (cp->enable) { |
1271 | case LE_SCANNING_ENABLED: | 971 | case LE_SCANNING_ENABLED: |
1272 | hci_req_complete(hdev, HCI_OP_LE_SET_SCAN_ENABLE, status); | ||
1273 | |||
1274 | if (status) { | 972 | if (status) { |
1275 | hci_dev_lock(hdev); | 973 | hci_dev_lock(hdev); |
1276 | mgmt_start_discovery_failed(hdev, status); | 974 | mgmt_start_discovery_failed(hdev, status); |
@@ -1321,32 +1019,6 @@ static void hci_cc_le_read_white_list_size(struct hci_dev *hdev, | |||
1321 | 1019 | ||
1322 | if (!rp->status) | 1020 | if (!rp->status) |
1323 | hdev->le_white_list_size = rp->size; | 1021 | hdev->le_white_list_size = rp->size; |
1324 | |||
1325 | hci_req_complete(hdev, HCI_OP_LE_READ_WHITE_LIST_SIZE, rp->status); | ||
1326 | } | ||
1327 | |||
1328 | static void hci_cc_le_ltk_reply(struct hci_dev *hdev, struct sk_buff *skb) | ||
1329 | { | ||
1330 | struct hci_rp_le_ltk_reply *rp = (void *) skb->data; | ||
1331 | |||
1332 | BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); | ||
1333 | |||
1334 | if (rp->status) | ||
1335 | return; | ||
1336 | |||
1337 | hci_req_complete(hdev, HCI_OP_LE_LTK_REPLY, rp->status); | ||
1338 | } | ||
1339 | |||
1340 | static void hci_cc_le_ltk_neg_reply(struct hci_dev *hdev, struct sk_buff *skb) | ||
1341 | { | ||
1342 | struct hci_rp_le_ltk_neg_reply *rp = (void *) skb->data; | ||
1343 | |||
1344 | BT_DBG("%s status 0x%2.2x", hdev->name, rp->status); | ||
1345 | |||
1346 | if (rp->status) | ||
1347 | return; | ||
1348 | |||
1349 | hci_req_complete(hdev, HCI_OP_LE_LTK_NEG_REPLY, rp->status); | ||
1350 | } | 1022 | } |
1351 | 1023 | ||
1352 | static void hci_cc_le_read_supported_states(struct hci_dev *hdev, | 1024 | static void hci_cc_le_read_supported_states(struct hci_dev *hdev, |
@@ -1358,8 +1030,6 @@ static void hci_cc_le_read_supported_states(struct hci_dev *hdev, | |||
1358 | 1030 | ||
1359 | if (!rp->status) | 1031 | if (!rp->status) |
1360 | memcpy(hdev->le_states, rp->le_states, 8); | 1032 | memcpy(hdev->le_states, rp->le_states, 8); |
1361 | |||
1362 | hci_req_complete(hdev, HCI_OP_LE_READ_SUPPORTED_STATES, rp->status); | ||
1363 | } | 1033 | } |
1364 | 1034 | ||
1365 | static void hci_cc_write_le_host_supported(struct hci_dev *hdev, | 1035 | static void hci_cc_write_le_host_supported(struct hci_dev *hdev, |
@@ -1389,8 +1059,6 @@ static void hci_cc_write_le_host_supported(struct hci_dev *hdev, | |||
1389 | if (test_bit(HCI_MGMT, &hdev->dev_flags) && | 1059 | if (test_bit(HCI_MGMT, &hdev->dev_flags) && |
1390 | !test_bit(HCI_INIT, &hdev->flags)) | 1060 | !test_bit(HCI_INIT, &hdev->flags)) |
1391 | mgmt_le_enable_complete(hdev, sent->le, status); | 1061 | mgmt_le_enable_complete(hdev, sent->le, status); |
1392 | |||
1393 | hci_req_complete(hdev, HCI_OP_WRITE_LE_HOST_SUPPORTED, status); | ||
1394 | } | 1062 | } |
1395 | 1063 | ||
1396 | static void hci_cc_write_remote_amp_assoc(struct hci_dev *hdev, | 1064 | static void hci_cc_write_remote_amp_assoc(struct hci_dev *hdev, |
@@ -1412,7 +1080,6 @@ static void hci_cs_inquiry(struct hci_dev *hdev, __u8 status) | |||
1412 | BT_DBG("%s status 0x%2.2x", hdev->name, status); | 1080 | BT_DBG("%s status 0x%2.2x", hdev->name, status); |
1413 | 1081 | ||
1414 | if (status) { | 1082 | if (status) { |
1415 | hci_req_complete(hdev, HCI_OP_INQUIRY, status); | ||
1416 | hci_conn_check_pending(hdev); | 1083 | hci_conn_check_pending(hdev); |
1417 | hci_dev_lock(hdev); | 1084 | hci_dev_lock(hdev); |
1418 | if (test_bit(HCI_MGMT, &hdev->dev_flags)) | 1085 | if (test_bit(HCI_MGMT, &hdev->dev_flags)) |
@@ -1884,11 +1551,6 @@ static void hci_cs_le_create_conn(struct hci_dev *hdev, __u8 status) | |||
1884 | } | 1551 | } |
1885 | } | 1552 | } |
1886 | 1553 | ||
1887 | static void hci_cs_le_start_enc(struct hci_dev *hdev, u8 status) | ||
1888 | { | ||
1889 | BT_DBG("%s status 0x%2.2x", hdev->name, status); | ||
1890 | } | ||
1891 | |||
1892 | static void hci_cs_create_phylink(struct hci_dev *hdev, u8 status) | 1554 | static void hci_cs_create_phylink(struct hci_dev *hdev, u8 status) |
1893 | { | 1555 | { |
1894 | struct hci_cp_create_phy_link *cp; | 1556 | struct hci_cp_create_phy_link *cp; |
@@ -1930,11 +1592,6 @@ static void hci_cs_accept_phylink(struct hci_dev *hdev, u8 status) | |||
1930 | amp_write_remote_assoc(hdev, cp->phy_handle); | 1592 | amp_write_remote_assoc(hdev, cp->phy_handle); |
1931 | } | 1593 | } |
1932 | 1594 | ||
1933 | static void hci_cs_create_logical_link(struct hci_dev *hdev, u8 status) | ||
1934 | { | ||
1935 | BT_DBG("%s status 0x%2.2x", hdev->name, status); | ||
1936 | } | ||
1937 | |||
1938 | static void hci_inquiry_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) | 1595 | static void hci_inquiry_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) |
1939 | { | 1596 | { |
1940 | __u8 status = *((__u8 *) skb->data); | 1597 | __u8 status = *((__u8 *) skb->data); |
@@ -1943,7 +1600,7 @@ static void hci_inquiry_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) | |||
1943 | 1600 | ||
1944 | BT_DBG("%s status 0x%2.2x", hdev->name, status); | 1601 | BT_DBG("%s status 0x%2.2x", hdev->name, status); |
1945 | 1602 | ||
1946 | hci_req_complete(hdev, HCI_OP_INQUIRY, status); | 1603 | hci_req_cmd_complete(hdev, HCI_OP_INQUIRY, status); |
1947 | 1604 | ||
1948 | hci_conn_check_pending(hdev); | 1605 | hci_conn_check_pending(hdev); |
1949 | 1606 | ||
@@ -2399,7 +2056,7 @@ static void hci_encrypt_change_evt(struct hci_dev *hdev, struct sk_buff *skb) | |||
2399 | clear_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags); | 2056 | clear_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags); |
2400 | 2057 | ||
2401 | if (ev->status && conn->state == BT_CONNECTED) { | 2058 | if (ev->status && conn->state == BT_CONNECTED) { |
2402 | hci_acl_disconn(conn, HCI_ERROR_AUTH_FAILURE); | 2059 | hci_disconnect(conn, HCI_ERROR_AUTH_FAILURE); |
2403 | hci_conn_put(conn); | 2060 | hci_conn_put(conn); |
2404 | goto unlock; | 2061 | goto unlock; |
2405 | } | 2062 | } |
@@ -2491,20 +2148,10 @@ unlock: | |||
2491 | hci_dev_unlock(hdev); | 2148 | hci_dev_unlock(hdev); |
2492 | } | 2149 | } |
2493 | 2150 | ||
2494 | static void hci_remote_version_evt(struct hci_dev *hdev, struct sk_buff *skb) | ||
2495 | { | ||
2496 | BT_DBG("%s", hdev->name); | ||
2497 | } | ||
2498 | |||
2499 | static void hci_qos_setup_complete_evt(struct hci_dev *hdev, | ||
2500 | struct sk_buff *skb) | ||
2501 | { | ||
2502 | BT_DBG("%s", hdev->name); | ||
2503 | } | ||
2504 | |||
2505 | static void hci_cmd_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) | 2151 | static void hci_cmd_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) |
2506 | { | 2152 | { |
2507 | struct hci_ev_cmd_complete *ev = (void *) skb->data; | 2153 | struct hci_ev_cmd_complete *ev = (void *) skb->data; |
2154 | u8 status = skb->data[sizeof(*ev)]; | ||
2508 | __u16 opcode; | 2155 | __u16 opcode; |
2509 | 2156 | ||
2510 | skb_pull(skb, sizeof(*ev)); | 2157 | skb_pull(skb, sizeof(*ev)); |
@@ -2588,10 +2235,6 @@ static void hci_cmd_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) | |||
2588 | hci_cc_write_voice_setting(hdev, skb); | 2235 | hci_cc_write_voice_setting(hdev, skb); |
2589 | break; | 2236 | break; |
2590 | 2237 | ||
2591 | case HCI_OP_HOST_BUFFER_SIZE: | ||
2592 | hci_cc_host_buffer_size(hdev, skb); | ||
2593 | break; | ||
2594 | |||
2595 | case HCI_OP_WRITE_SSP_MODE: | 2238 | case HCI_OP_WRITE_SSP_MODE: |
2596 | hci_cc_write_ssp_mode(hdev, skb); | 2239 | hci_cc_write_ssp_mode(hdev, skb); |
2597 | break; | 2240 | break; |
@@ -2620,46 +2263,42 @@ static void hci_cmd_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) | |||
2620 | hci_cc_read_bd_addr(hdev, skb); | 2263 | hci_cc_read_bd_addr(hdev, skb); |
2621 | break; | 2264 | break; |
2622 | 2265 | ||
2623 | case HCI_OP_READ_DATA_BLOCK_SIZE: | 2266 | case HCI_OP_READ_PAGE_SCAN_ACTIVITY: |
2624 | hci_cc_read_data_block_size(hdev, skb); | 2267 | hci_cc_read_page_scan_activity(hdev, skb); |
2625 | break; | 2268 | break; |
2626 | 2269 | ||
2627 | case HCI_OP_WRITE_CA_TIMEOUT: | 2270 | case HCI_OP_WRITE_PAGE_SCAN_ACTIVITY: |
2628 | hci_cc_write_ca_timeout(hdev, skb); | 2271 | hci_cc_write_page_scan_activity(hdev, skb); |
2629 | break; | 2272 | break; |
2630 | 2273 | ||
2631 | case HCI_OP_READ_FLOW_CONTROL_MODE: | 2274 | case HCI_OP_READ_PAGE_SCAN_TYPE: |
2632 | hci_cc_read_flow_control_mode(hdev, skb); | 2275 | hci_cc_read_page_scan_type(hdev, skb); |
2633 | break; | 2276 | break; |
2634 | 2277 | ||
2635 | case HCI_OP_READ_LOCAL_AMP_INFO: | 2278 | case HCI_OP_WRITE_PAGE_SCAN_TYPE: |
2636 | hci_cc_read_local_amp_info(hdev, skb); | 2279 | hci_cc_write_page_scan_type(hdev, skb); |
2637 | break; | 2280 | break; |
2638 | 2281 | ||
2639 | case HCI_OP_READ_LOCAL_AMP_ASSOC: | 2282 | case HCI_OP_READ_DATA_BLOCK_SIZE: |
2640 | hci_cc_read_local_amp_assoc(hdev, skb); | 2283 | hci_cc_read_data_block_size(hdev, skb); |
2641 | break; | 2284 | break; |
2642 | 2285 | ||
2643 | case HCI_OP_DELETE_STORED_LINK_KEY: | 2286 | case HCI_OP_READ_FLOW_CONTROL_MODE: |
2644 | hci_cc_delete_stored_link_key(hdev, skb); | 2287 | hci_cc_read_flow_control_mode(hdev, skb); |
2645 | break; | 2288 | break; |
2646 | 2289 | ||
2647 | case HCI_OP_SET_EVENT_MASK: | 2290 | case HCI_OP_READ_LOCAL_AMP_INFO: |
2648 | hci_cc_set_event_mask(hdev, skb); | 2291 | hci_cc_read_local_amp_info(hdev, skb); |
2649 | break; | 2292 | break; |
2650 | 2293 | ||
2651 | case HCI_OP_WRITE_INQUIRY_MODE: | 2294 | case HCI_OP_READ_LOCAL_AMP_ASSOC: |
2652 | hci_cc_write_inquiry_mode(hdev, skb); | 2295 | hci_cc_read_local_amp_assoc(hdev, skb); |
2653 | break; | 2296 | break; |
2654 | 2297 | ||
2655 | case HCI_OP_READ_INQ_RSP_TX_POWER: | 2298 | case HCI_OP_READ_INQ_RSP_TX_POWER: |
2656 | hci_cc_read_inq_rsp_tx_power(hdev, skb); | 2299 | hci_cc_read_inq_rsp_tx_power(hdev, skb); |
2657 | break; | 2300 | break; |
2658 | 2301 | ||
2659 | case HCI_OP_SET_EVENT_FLT: | ||
2660 | hci_cc_set_event_flt(hdev, skb); | ||
2661 | break; | ||
2662 | |||
2663 | case HCI_OP_PIN_CODE_REPLY: | 2302 | case HCI_OP_PIN_CODE_REPLY: |
2664 | hci_cc_pin_code_reply(hdev, skb); | 2303 | hci_cc_pin_code_reply(hdev, skb); |
2665 | break; | 2304 | break; |
@@ -2684,10 +2323,6 @@ static void hci_cmd_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) | |||
2684 | hci_cc_le_read_adv_tx_power(hdev, skb); | 2323 | hci_cc_le_read_adv_tx_power(hdev, skb); |
2685 | break; | 2324 | break; |
2686 | 2325 | ||
2687 | case HCI_OP_LE_SET_EVENT_MASK: | ||
2688 | hci_cc_le_set_event_mask(hdev, skb); | ||
2689 | break; | ||
2690 | |||
2691 | case HCI_OP_USER_CONFIRM_REPLY: | 2326 | case HCI_OP_USER_CONFIRM_REPLY: |
2692 | hci_cc_user_confirm_reply(hdev, skb); | 2327 | hci_cc_user_confirm_reply(hdev, skb); |
2693 | break; | 2328 | break; |
@@ -2720,14 +2355,6 @@ static void hci_cmd_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) | |||
2720 | hci_cc_le_read_white_list_size(hdev, skb); | 2355 | hci_cc_le_read_white_list_size(hdev, skb); |
2721 | break; | 2356 | break; |
2722 | 2357 | ||
2723 | case HCI_OP_LE_LTK_REPLY: | ||
2724 | hci_cc_le_ltk_reply(hdev, skb); | ||
2725 | break; | ||
2726 | |||
2727 | case HCI_OP_LE_LTK_NEG_REPLY: | ||
2728 | hci_cc_le_ltk_neg_reply(hdev, skb); | ||
2729 | break; | ||
2730 | |||
2731 | case HCI_OP_LE_READ_SUPPORTED_STATES: | 2358 | case HCI_OP_LE_READ_SUPPORTED_STATES: |
2732 | hci_cc_le_read_supported_states(hdev, skb); | 2359 | hci_cc_le_read_supported_states(hdev, skb); |
2733 | break; | 2360 | break; |
@@ -2745,9 +2372,11 @@ static void hci_cmd_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) | |||
2745 | break; | 2372 | break; |
2746 | } | 2373 | } |
2747 | 2374 | ||
2748 | if (ev->opcode != HCI_OP_NOP) | 2375 | if (opcode != HCI_OP_NOP) |
2749 | del_timer(&hdev->cmd_timer); | 2376 | del_timer(&hdev->cmd_timer); |
2750 | 2377 | ||
2378 | hci_req_cmd_complete(hdev, opcode, status); | ||
2379 | |||
2751 | if (ev->ncmd && !test_bit(HCI_RESET, &hdev->flags)) { | 2380 | if (ev->ncmd && !test_bit(HCI_RESET, &hdev->flags)) { |
2752 | atomic_set(&hdev->cmd_cnt, 1); | 2381 | atomic_set(&hdev->cmd_cnt, 1); |
2753 | if (!skb_queue_empty(&hdev->cmd_q)) | 2382 | if (!skb_queue_empty(&hdev->cmd_q)) |
@@ -2817,10 +2446,6 @@ static void hci_cmd_status_evt(struct hci_dev *hdev, struct sk_buff *skb) | |||
2817 | hci_cs_le_create_conn(hdev, ev->status); | 2446 | hci_cs_le_create_conn(hdev, ev->status); |
2818 | break; | 2447 | break; |
2819 | 2448 | ||
2820 | case HCI_OP_LE_START_ENC: | ||
2821 | hci_cs_le_start_enc(hdev, ev->status); | ||
2822 | break; | ||
2823 | |||
2824 | case HCI_OP_CREATE_PHY_LINK: | 2449 | case HCI_OP_CREATE_PHY_LINK: |
2825 | hci_cs_create_phylink(hdev, ev->status); | 2450 | hci_cs_create_phylink(hdev, ev->status); |
2826 | break; | 2451 | break; |
@@ -2829,18 +2454,16 @@ static void hci_cmd_status_evt(struct hci_dev *hdev, struct sk_buff *skb) | |||
2829 | hci_cs_accept_phylink(hdev, ev->status); | 2454 | hci_cs_accept_phylink(hdev, ev->status); |
2830 | break; | 2455 | break; |
2831 | 2456 | ||
2832 | case HCI_OP_CREATE_LOGICAL_LINK: | ||
2833 | hci_cs_create_logical_link(hdev, ev->status); | ||
2834 | break; | ||
2835 | |||
2836 | default: | 2457 | default: |
2837 | BT_DBG("%s opcode 0x%4.4x", hdev->name, opcode); | 2458 | BT_DBG("%s opcode 0x%4.4x", hdev->name, opcode); |
2838 | break; | 2459 | break; |
2839 | } | 2460 | } |
2840 | 2461 | ||
2841 | if (ev->opcode != HCI_OP_NOP) | 2462 | if (opcode != HCI_OP_NOP) |
2842 | del_timer(&hdev->cmd_timer); | 2463 | del_timer(&hdev->cmd_timer); |
2843 | 2464 | ||
2465 | hci_req_cmd_status(hdev, opcode, ev->status); | ||
2466 | |||
2844 | if (ev->ncmd && !test_bit(HCI_RESET, &hdev->flags)) { | 2467 | if (ev->ncmd && !test_bit(HCI_RESET, &hdev->flags)) { |
2845 | atomic_set(&hdev->cmd_cnt, 1); | 2468 | atomic_set(&hdev->cmd_cnt, 1); |
2846 | if (!skb_queue_empty(&hdev->cmd_q)) | 2469 | if (!skb_queue_empty(&hdev->cmd_q)) |
@@ -3391,18 +3014,6 @@ unlock: | |||
3391 | hci_dev_unlock(hdev); | 3014 | hci_dev_unlock(hdev); |
3392 | } | 3015 | } |
3393 | 3016 | ||
3394 | static void hci_sync_conn_changed_evt(struct hci_dev *hdev, struct sk_buff *skb) | ||
3395 | { | ||
3396 | BT_DBG("%s", hdev->name); | ||
3397 | } | ||
3398 | |||
3399 | static void hci_sniff_subrate_evt(struct hci_dev *hdev, struct sk_buff *skb) | ||
3400 | { | ||
3401 | struct hci_ev_sniff_subrate *ev = (void *) skb->data; | ||
3402 | |||
3403 | BT_DBG("%s status 0x%2.2x", hdev->name, ev->status); | ||
3404 | } | ||
3405 | |||
3406 | static void hci_extended_inquiry_result_evt(struct hci_dev *hdev, | 3017 | static void hci_extended_inquiry_result_evt(struct hci_dev *hdev, |
3407 | struct sk_buff *skb) | 3018 | struct sk_buff *skb) |
3408 | { | 3019 | { |
@@ -3472,7 +3083,7 @@ static void hci_key_refresh_complete_evt(struct hci_dev *hdev, | |||
3472 | clear_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags); | 3083 | clear_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags); |
3473 | 3084 | ||
3474 | if (ev->status && conn->state == BT_CONNECTED) { | 3085 | if (ev->status && conn->state == BT_CONNECTED) { |
3475 | hci_acl_disconn(conn, HCI_ERROR_AUTH_FAILURE); | 3086 | hci_disconnect(conn, HCI_ERROR_AUTH_FAILURE); |
3476 | hci_conn_put(conn); | 3087 | hci_conn_put(conn); |
3477 | goto unlock; | 3088 | goto unlock; |
3478 | } | 3089 | } |
@@ -4130,14 +3741,6 @@ void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb) | |||
4130 | hci_remote_features_evt(hdev, skb); | 3741 | hci_remote_features_evt(hdev, skb); |
4131 | break; | 3742 | break; |
4132 | 3743 | ||
4133 | case HCI_EV_REMOTE_VERSION: | ||
4134 | hci_remote_version_evt(hdev, skb); | ||
4135 | break; | ||
4136 | |||
4137 | case HCI_EV_QOS_SETUP_COMPLETE: | ||
4138 | hci_qos_setup_complete_evt(hdev, skb); | ||
4139 | break; | ||
4140 | |||
4141 | case HCI_EV_CMD_COMPLETE: | 3744 | case HCI_EV_CMD_COMPLETE: |
4142 | hci_cmd_complete_evt(hdev, skb); | 3745 | hci_cmd_complete_evt(hdev, skb); |
4143 | break; | 3746 | break; |
@@ -4194,14 +3797,6 @@ void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb) | |||
4194 | hci_sync_conn_complete_evt(hdev, skb); | 3797 | hci_sync_conn_complete_evt(hdev, skb); |
4195 | break; | 3798 | break; |
4196 | 3799 | ||
4197 | case HCI_EV_SYNC_CONN_CHANGED: | ||
4198 | hci_sync_conn_changed_evt(hdev, skb); | ||
4199 | break; | ||
4200 | |||
4201 | case HCI_EV_SNIFF_SUBRATE: | ||
4202 | hci_sniff_subrate_evt(hdev, skb); | ||
4203 | break; | ||
4204 | |||
4205 | case HCI_EV_EXTENDED_INQUIRY_RESULT: | 3800 | case HCI_EV_EXTENDED_INQUIRY_RESULT: |
4206 | hci_extended_inquiry_result_evt(hdev, skb); | 3801 | hci_extended_inquiry_result_evt(hdev, skb); |
4207 | break; | 3802 | break; |