From: Luiz Augusto von Dentz <luiz.von.dentz@xxxxxxxxx> This makes command discoverable to print a warning if discoverable-timeout is not set(0): [bluetooth]# discoverable-timeout 0 [bluetooth]# Changing discoverable-timeout 0 succeeded [bluetooth]# [CHG] Controller 4C:49:6C:44:F5:E7 DiscoverableTimeout: 0x00000000 (0) [bluetooth]# discoverable on Warning: setting discoverable while discoverable-timeout not set(0) is not recommended --- client/main.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/client/main.c b/client/main.c index a96a4263849d..2a5c7527bc6c 100644 --- a/client/main.c +++ b/client/main.c @@ -1095,6 +1095,7 @@ static void cmd_pairable(int argc, char *argv[]) static void cmd_discoverable(int argc, char *argv[]) { + DBusMessageIter iter; dbus_bool_t discoverable; char *str; @@ -1104,6 +1105,18 @@ static void cmd_discoverable(int argc, char *argv[]) if (check_default_ctrl() == FALSE) return bt_shell_noninteractive_quit(EXIT_FAILURE); + if (discoverable && g_dbus_proxy_get_property(default_ctrl->proxy, + "DiscoverableTimeout", &iter)) { + uint32_t value; + + dbus_message_iter_get_basic(&iter, &value); + + if (!value) + bt_shell_printf("Warning: setting discoverable while " + "discoverable-timeout not set(0) is not" + " recommended\n"); + } + str = g_strdup_printf("discoverable %s", discoverable == TRUE ? "on" : "off"); -- 2.46.0