Bluetooth: Settings: Fix not allowing custom handlers without arguments
Custom handlers without any arguments don't since there is a check for
argc > 1, to fix this behavior removing the check.
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
diff --git a/subsys/bluetooth/host/settings.c b/subsys/bluetooth/host/settings.c
index e112374..277aa75 100644
--- a/subsys/bluetooth/host/settings.c
+++ b/subsys/bluetooth/host/settings.c
@@ -89,20 +89,15 @@
static int set(int argc, char **argv, void *value_ctx)
{
int len;
+ const struct bt_settings_handler *h;
- if (argc > 1) {
- const struct bt_settings_handler *h;
+ for (h = _bt_settings_start; h < _bt_settings_end; h++) {
+ if (!strcmp(argv[0], h->name)) {
+ argc--;
+ argv++;
- for (h = _bt_settings_start; h < _bt_settings_end; h++) {
- if (!strcmp(argv[0], h->name)) {
- argc--;
- argv++;
-
- return h->set(argc, argv, value_ctx);
- }
+ return h->set(argc, argv, value_ctx);
}
-
- return -ENOENT;
}
if (!strcmp(argv[0], "id")) {
@@ -182,7 +177,7 @@
}
#endif /* CONFIG_BT_PRIVACY */
- return 0;
+ return -ENOENT;
}
#define ID_DATA_LEN(array) (bt_dev.id_count * sizeof(array[0]))