Skip to content

Commit 3df18ff

Browse files
carlescufiAnas Nashif
authored andcommitted
Bluetooth: controller: Fix Read Version Info VS cmd
Use the macros generated during the build and located in version.h to fill in the version information in the Read Version Information VS command. Additionally reply with the correct hardware identifiers when running on Nordic hardware. Signed-off-by: Carles Cufi <[email protected]>
1 parent d311899 commit 3df18ff

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

subsys/bluetooth/controller/hci/hci.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <stddef.h>
99
#include <zephyr/types.h>
1010
#include <string.h>
11+
#include <version.h>
1112

1213
#include <soc.h>
1314
#include <toolchain.h>
@@ -1651,12 +1652,13 @@ static void vs_read_version_info(struct net_buf *buf, struct net_buf **evt)
16511652
rp = cmd_complete(evt, sizeof(*rp));
16521653

16531654
rp->status = 0x00;
1654-
rp->hw_platform = sys_cpu_to_le16(0);
1655-
rp->hw_variant = sys_cpu_to_le16(0);
1655+
rp->hw_platform = BT_HCI_VS_HW_PLAT;
1656+
rp->hw_variant = BT_HCI_VS_HW_VAR;
1657+
16561658
rp->fw_variant = 0;
1657-
rp->fw_version = 0;
1658-
rp->fw_revision = sys_cpu_to_le16(0);
1659-
rp->fw_build = sys_cpu_to_le32(0);
1659+
rp->fw_version = (KERNEL_VERSION_MAJOR & 0xff);
1660+
rp->fw_revision = KERNEL_VERSION_MINOR;
1661+
rp->fw_build = (KERNEL_PATCHLEVEL & 0xffff);
16601662
}
16611663

16621664
static void vs_read_supported_commands(struct net_buf *buf,

subsys/bluetooth/controller/hci/hci_internal.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,18 @@ extern atomic_t hci_state_mask;
2222
#define HCI_CLASS_EVT_CONNECTION 2
2323
#define HCI_CLASS_ACL_DATA 3
2424

25+
#if defined(CONFIG_SOC_FAMILY_NRF5)
26+
#define BT_HCI_VS_HW_PLAT BT_HCI_VS_HW_PLAT_NORDIC
27+
#if defined(CONFIG_SOC_SERIES_NRF51X)
28+
#define BT_HCI_VS_HW_VAR BT_HCI_VS_HW_VAR_NORDIC_NRF51X;
29+
#elif defined(CONFIG_SOC_SERIES_NRF52X)
30+
#define BT_HCI_VS_HW_VAR BT_HCI_VS_HW_VAR_NORDIC_NRF52X;
31+
#endif
32+
#else
33+
#define BT_HCI_VS_HW_PLAT 0
34+
#define BT_HCI_VS_HW_VAR 0
35+
#endif /* CONFIG_SOC_FAMILY_NRF5 */
36+
2537
void hci_init(struct k_poll_signal *signal_host_buf);
2638
struct net_buf *hci_cmd_handle(struct net_buf *cmd);
2739
void hci_evt_encode(struct radio_pdu_node_rx *node_rx, struct net_buf *buf);

0 commit comments

Comments
 (0)