From: Gongwei Li hcon->remote_id last use was removed in 2024 by commit e7b02296fb40 ("Bluetooth: Remove BT_HS"). Remove it. Signed-off-by: Gongwei Li --- include/net/bluetooth/hci_core.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index b8100dbfe5d7..32b1c08c8bba 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h @@ -749,7 +749,6 @@ struct hci_conn { __u8 remote_cap; __u8 remote_auth; - __u8 remote_id; unsigned int sent; -- 2.25.1 From: Gongwei Li Add processing for HCI Process Read Remote Version event. Used to query the lmp version of remote devices. Signed-off-by: Gongwei Li --- include/net/bluetooth/hci_core.h | 1 + net/bluetooth/hci_event.c | 23 +++++++++++++++++++++++ net/bluetooth/mgmt.c | 5 +++++ 3 files changed, 29 insertions(+) diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 32b1c08c8bba..bdd5e6ef3616 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h @@ -749,6 +749,7 @@ struct hci_conn { __u8 remote_cap; __u8 remote_auth; + __u8 remote_ver; unsigned int sent; diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index f20c826509b6..7f8e3f8ec01e 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c @@ -3737,6 +3737,26 @@ static void hci_remote_features_evt(struct hci_dev *hdev, void *data, hci_dev_unlock(hdev); } +static void hci_remote_version_evt(struct hci_dev *hdev, void *data, + struct sk_buff *skb) +{ + struct hci_ev_remote_version *ev = (void *)skb->data; + struct hci_conn *conn; + + BT_DBG("%s", hdev->name); + + hci_dev_lock(hdev); + + conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); + if (!conn) + goto unlock; + + conn->remote_ver = ev->lmp_ver; + +unlock: + hci_dev_unlock(hdev); +} + static inline void handle_cmd_cnt_and_timer(struct hci_dev *hdev, u8 ncmd) { cancel_delayed_work(&hdev->cmd_timer); @@ -7448,6 +7468,9 @@ static const struct hci_ev { /* [0x0b = HCI_EV_REMOTE_FEATURES] */ HCI_EV(HCI_EV_REMOTE_FEATURES, hci_remote_features_evt, sizeof(struct hci_ev_remote_features)), + /* [0x0c = HCI_EV_REMOTE_VERSION] */ + HCI_EV(HCI_EV_REMOTE_VERSION, hci_remote_version_evt, + sizeof(struct hci_ev_remote_version)), /* [0x0e = HCI_EV_CMD_COMPLETE] */ HCI_EV_REQ_VL(HCI_EV_CMD_COMPLETE, hci_cmd_complete_evt, sizeof(struct hci_ev_cmd_complete), HCI_MAX_EVENT_SIZE), diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index 79762bfaea5f..c0bab45648f3 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c @@ -9728,6 +9728,9 @@ void mgmt_device_connected(struct hci_dev *hdev, struct hci_conn *conn, { struct sk_buff *skb; struct mgmt_ev_device_connected *ev; + struct hci_cp_read_remote_version cp; + + memset(&cp, 0, sizeof(cp)); u16 eir_len = 0; u32 flags = 0; @@ -9774,6 +9777,8 @@ void mgmt_device_connected(struct hci_dev *hdev, struct hci_conn *conn, ev->eir_len = cpu_to_le16(eir_len); mgmt_event_skb(skb, NULL); + + hci_send_cmd(hdev, HCI_OP_READ_REMOTE_VERSION, sizeof(cp), &cp); } static void unpair_device_rsp(struct mgmt_pending_cmd *cmd, void *data) -- 2.25.1