mirror of
https://github.com/nxp-imx/linux-imx.git
synced 2025-07-07 18:05:21 +02:00
Bluetooth: hci_core: Fix sending MGMT_EV_CONNECT_FAILED
[ Upstream commitd47da6bd4c
] If HCI_CONN_MGMT_CONNECTED has been set then the event shall be HCI_CONN_MGMT_DISCONNECTED. Fixes:b644ba3369
("Bluetooth: Update device_connected and device_found events to latest API") Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
84398204c5
commit
ea8d90a5b0
|
@ -2224,8 +2224,8 @@ void mgmt_device_disconnected(struct hci_dev *hdev, bdaddr_t *bdaddr,
|
||||||
bool mgmt_connected);
|
bool mgmt_connected);
|
||||||
void mgmt_disconnect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr,
|
void mgmt_disconnect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr,
|
||||||
u8 link_type, u8 addr_type, u8 status);
|
u8 link_type, u8 addr_type, u8 status);
|
||||||
void mgmt_connect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
|
void mgmt_connect_failed(struct hci_dev *hdev, struct hci_conn *conn,
|
||||||
u8 addr_type, u8 status);
|
u8 status);
|
||||||
void mgmt_pin_code_request(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 secure);
|
void mgmt_pin_code_request(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 secure);
|
||||||
void mgmt_pin_code_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
|
void mgmt_pin_code_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
|
||||||
u8 status);
|
u8 status);
|
||||||
|
|
|
@ -107,8 +107,7 @@ void hci_connect_le_scan_cleanup(struct hci_conn *conn, u8 status)
|
||||||
* where a timeout + cancel does indicate an actual failure.
|
* where a timeout + cancel does indicate an actual failure.
|
||||||
*/
|
*/
|
||||||
if (status && status != HCI_ERROR_UNKNOWN_CONN_ID)
|
if (status && status != HCI_ERROR_UNKNOWN_CONN_ID)
|
||||||
mgmt_connect_failed(hdev, &conn->dst, conn->type,
|
mgmt_connect_failed(hdev, conn, status);
|
||||||
conn->dst_type, status);
|
|
||||||
|
|
||||||
/* The connection attempt was doing scan for new RPA, and is
|
/* The connection attempt was doing scan for new RPA, and is
|
||||||
* in scan phase. If params are not associated with any other
|
* in scan phase. If params are not associated with any other
|
||||||
|
@ -1233,8 +1232,7 @@ void hci_conn_failed(struct hci_conn *conn, u8 status)
|
||||||
hci_le_conn_failed(conn, status);
|
hci_le_conn_failed(conn, status);
|
||||||
break;
|
break;
|
||||||
case ACL_LINK:
|
case ACL_LINK:
|
||||||
mgmt_connect_failed(hdev, &conn->dst, conn->type,
|
mgmt_connect_failed(hdev, conn, status);
|
||||||
conn->dst_type, status);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9724,13 +9724,18 @@ void mgmt_disconnect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr,
|
||||||
mgmt_pending_remove(cmd);
|
mgmt_pending_remove(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
void mgmt_connect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
|
void mgmt_connect_failed(struct hci_dev *hdev, struct hci_conn *conn, u8 status)
|
||||||
u8 addr_type, u8 status)
|
|
||||||
{
|
{
|
||||||
struct mgmt_ev_connect_failed ev;
|
struct mgmt_ev_connect_failed ev;
|
||||||
|
|
||||||
bacpy(&ev.addr.bdaddr, bdaddr);
|
if (test_and_clear_bit(HCI_CONN_MGMT_CONNECTED, &conn->flags)) {
|
||||||
ev.addr.type = link_to_bdaddr(link_type, addr_type);
|
mgmt_device_disconnected(hdev, &conn->dst, conn->type,
|
||||||
|
conn->dst_type, status, true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
bacpy(&ev.addr.bdaddr, &conn->dst);
|
||||||
|
ev.addr.type = link_to_bdaddr(conn->type, conn->dst_type);
|
||||||
ev.status = mgmt_status(status);
|
ev.status = mgmt_status(status);
|
||||||
|
|
||||||
mgmt_event(MGMT_EV_CONNECT_FAILED, hdev, &ev, sizeof(ev), NULL);
|
mgmt_event(MGMT_EV_CONNECT_FAILED, hdev, &ev, sizeof(ev), NULL);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user