diff options
Diffstat (limited to 'net/bluetooth/hci_event.c')
| -rw-r--r-- | net/bluetooth/hci_event.c | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index d43d0c890975..bb94e6da223c 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c | |||
| @@ -57,6 +57,7 @@ | |||
| 57 | static void hci_cc_link_ctl(struct hci_dev *hdev, __u16 ocf, struct sk_buff *skb) | 57 | static void hci_cc_link_ctl(struct hci_dev *hdev, __u16 ocf, struct sk_buff *skb) |
| 58 | { | 58 | { |
| 59 | __u8 status; | 59 | __u8 status; |
| 60 | struct hci_conn *pend; | ||
| 60 | 61 | ||
| 61 | BT_DBG("%s ocf 0x%x", hdev->name, ocf); | 62 | BT_DBG("%s ocf 0x%x", hdev->name, ocf); |
| 62 | 63 | ||
| @@ -71,6 +72,15 @@ static void hci_cc_link_ctl(struct hci_dev *hdev, __u16 ocf, struct sk_buff *skb | |||
| 71 | clear_bit(HCI_INQUIRY, &hdev->flags); | 72 | clear_bit(HCI_INQUIRY, &hdev->flags); |
| 72 | hci_req_complete(hdev, status); | 73 | hci_req_complete(hdev, status); |
| 73 | } | 74 | } |
| 75 | |||
| 76 | hci_dev_lock(hdev); | ||
| 77 | |||
| 78 | pend = hci_conn_hash_lookup_state(hdev, ACL_LINK, BT_CONNECT2); | ||
| 79 | if (pend) | ||
| 80 | hci_acl_connect(pend); | ||
| 81 | |||
| 82 | hci_dev_unlock(hdev); | ||
| 83 | |||
| 74 | break; | 84 | break; |
| 75 | 85 | ||
| 76 | default: | 86 | default: |
| @@ -414,9 +424,12 @@ static inline void hci_cs_create_conn(struct hci_dev *hdev, __u8 status) | |||
| 414 | 424 | ||
| 415 | if (status) { | 425 | if (status) { |
| 416 | if (conn && conn->state == BT_CONNECT) { | 426 | if (conn && conn->state == BT_CONNECT) { |
| 417 | conn->state = BT_CLOSED; | 427 | if (status != 0x0c || conn->attempt > 2) { |
| 418 | hci_proto_connect_cfm(conn, status); | 428 | conn->state = BT_CLOSED; |
| 419 | hci_conn_del(conn); | 429 | hci_proto_connect_cfm(conn, status); |
| 430 | hci_conn_del(conn); | ||
| 431 | } else | ||
| 432 | conn->state = BT_CONNECT2; | ||
| 420 | } | 433 | } |
| 421 | } else { | 434 | } else { |
| 422 | if (!conn) { | 435 | if (!conn) { |
| @@ -562,11 +575,20 @@ static void hci_cs_info_param(struct hci_dev *hdev, __u16 ocf, __u8 status) | |||
| 562 | static inline void hci_inquiry_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) | 575 | static inline void hci_inquiry_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) |
| 563 | { | 576 | { |
| 564 | __u8 status = *((__u8 *) skb->data); | 577 | __u8 status = *((__u8 *) skb->data); |
| 578 | struct hci_conn *pend; | ||
| 565 | 579 | ||
| 566 | BT_DBG("%s status %d", hdev->name, status); | 580 | BT_DBG("%s status %d", hdev->name, status); |
| 567 | 581 | ||
| 568 | clear_bit(HCI_INQUIRY, &hdev->flags); | 582 | clear_bit(HCI_INQUIRY, &hdev->flags); |
| 569 | hci_req_complete(hdev, status); | 583 | hci_req_complete(hdev, status); |
| 584 | |||
| 585 | hci_dev_lock(hdev); | ||
| 586 | |||
| 587 | pend = hci_conn_hash_lookup_state(hdev, ACL_LINK, BT_CONNECT2); | ||
| 588 | if (pend) | ||
| 589 | hci_acl_connect(pend); | ||
| 590 | |||
| 591 | hci_dev_unlock(hdev); | ||
| 570 | } | 592 | } |
| 571 | 593 | ||
| 572 | /* Inquiry Result */ | 594 | /* Inquiry Result */ |
| @@ -728,7 +750,7 @@ static inline void hci_conn_request_evt(struct hci_dev *hdev, struct sk_buff *sk | |||
| 728 | static inline void hci_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) | 750 | static inline void hci_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) |
| 729 | { | 751 | { |
| 730 | struct hci_ev_conn_complete *ev = (struct hci_ev_conn_complete *) skb->data; | 752 | struct hci_ev_conn_complete *ev = (struct hci_ev_conn_complete *) skb->data; |
| 731 | struct hci_conn *conn; | 753 | struct hci_conn *conn, *pend; |
| 732 | 754 | ||
| 733 | BT_DBG("%s", hdev->name); | 755 | BT_DBG("%s", hdev->name); |
| 734 | 756 | ||
| @@ -801,6 +823,10 @@ static inline void hci_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *s | |||
| 801 | if (ev->status) | 823 | if (ev->status) |
| 802 | hci_conn_del(conn); | 824 | hci_conn_del(conn); |
| 803 | 825 | ||
| 826 | pend = hci_conn_hash_lookup_state(hdev, ACL_LINK, BT_CONNECT2); | ||
| 827 | if (pend) | ||
| 828 | hci_acl_connect(pend); | ||
| 829 | |||
| 804 | hci_dev_unlock(hdev); | 830 | hci_dev_unlock(hdev); |
| 805 | } | 831 | } |
| 806 | 832 | ||
