From 9b19a90daa52ac9b1cc25d2a070fc6b2ea6105ff Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Sun, 24 Nov 2024 12:50:21 +0200 Subject: [PATCH] samples: bluetooth: Add build asserts for VS-using samples The README files of these samples already indicate that they use the Zephyr-specific HCI vendor extensions, but this may still not be clear enough to some users, as evidenced in #81779. Add build asserts to make sure the samples only build when Zephyr VS extensions have been enabled. Signed-off-by: Johan Hedberg --- samples/bluetooth/hci_pwr_ctrl/src/main.c | 3 +++ samples/bluetooth/hci_vs_scan_req/src/main.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/samples/bluetooth/hci_pwr_ctrl/src/main.c b/samples/bluetooth/hci_pwr_ctrl/src/main.c index 7595326bd13..13794328489 100644 --- a/samples/bluetooth/hci_pwr_ctrl/src/main.c +++ b/samples/bluetooth/hci_pwr_ctrl/src/main.c @@ -22,6 +22,9 @@ #include #include +BUILD_ASSERT(IS_ENABLED(CONFIG_BT_HAS_HCI_VS), + "This app requires Zephyr-specific HCI vendor extensions"); + static struct bt_conn *default_conn; static uint16_t default_conn_handle; diff --git a/samples/bluetooth/hci_vs_scan_req/src/main.c b/samples/bluetooth/hci_vs_scan_req/src/main.c index d43ae8b1034..6e1c4cb6b77 100644 --- a/samples/bluetooth/hci_vs_scan_req/src/main.c +++ b/samples/bluetooth/hci_vs_scan_req/src/main.c @@ -10,6 +10,9 @@ #include #include +BUILD_ASSERT(IS_ENABLED(CONFIG_BT_HAS_HCI_VS), + "This app requires Zephyr-specific HCI vendor extensions"); + #define DEVICE_NAME CONFIG_BT_DEVICE_NAME #define DEVICE_NAME_LENGTH (sizeof(DEVICE_NAME) - 1)