[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <472c08c3-046a-4f16-ae88-c101ff6b7262@molgen.mpg.de>
Date: Wed, 12 Nov 2025 10:55:58 +0100
From: Paul Menzel <pmenzel@...gen.mpg.de>
To: Gongwei Li <13875017792@....com>
Cc: Marcel Holtmann <marcel@...tmann.org>,
Luiz Augusto von Dentz <luiz.dentz@...il.com>,
Johan Hedberg <johan.hedberg@...il.com>, linux-bluetooth@...r.kernel.org,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
Gongwei Li <ligongwei@...inos.cn>
Subject: Re: [PATCH 2/2] Bluetooth: Process Read Remote Version evt
Dear Gongwei,
Thank you for your patch. I’d spell out event in the commit message
summary/title.
Am 12.11.25 um 10:48 schrieb Gongwei Li:
> From: Gongwei Li <ligongwei@...inos.cn>
>
> Add processing for HCI Process Read Remote Version event.
> Used to query the lmp version of remote devices.
How did you test it?
> Signed-off-by: Gongwei Li <ligongwei@...inos.cn>
> ---
> 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)
The diff looks good. Please feel free to add:
Reviewed-by: Paul Menzel <pmenzel@...gen.mpg.de>
Kind regards,
Paul
Powered by blists - more mailing lists