From 1861583ce29701fc6afa23233b9f0a75f7e60257 Mon Sep 17 00:00:00 2001 From: Pavel Vasilyev Date: Thu, 14 Mar 2024 13:55:18 +0100 Subject: [PATCH] Bluetooth: Mesh: Warn if can't listen to unprov beacons until proved When calling `mesh prov beacon-listen on` shell command before provisioning the local device, the stack won't report unprovisioned beacons. This is because the scanner has not been started yet. This behavior confuses users. Print a warning that the device needs to be provisioned first before it can listen to unprovisioned beacons. Signed-off-by: Pavel Vasilyev --- subsys/bluetooth/mesh/shell/shell.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/subsys/bluetooth/mesh/shell/shell.c b/subsys/bluetooth/mesh/shell/shell.c index 53672bea4ba..78c503c29ac 100644 --- a/subsys/bluetooth/mesh/shell/shell.c +++ b/subsys/bluetooth/mesh/shell/shell.c @@ -726,6 +726,11 @@ static int cmd_beacon_listen(const struct shell *sh, size_t argc, return err; } + if (!bt_mesh_is_provisioned()) { + shell_error(sh, "Not yet provisioned"); + return -EINVAL; + } + if (val) { bt_mesh_shell_prov.unprovisioned_beacon = print_unprovisioned_beacon; #if defined(CONFIG_BT_MESH_PB_GATT_CLIENT)