Diff between 773cce6b378ddcb486318e6edd458ade0f28eb16 and 102b9f3d075b344d6c2e0f4836dc8f0abfdc3dbc

Changed Files

File Additions Deletions Status
src/shared/shell.c +9 -0 modified
src/shared/shell.h +2 -0 modified

Full Patch

diff --git a/src/shared/shell.c b/src/shared/shell.c
index 4e42bd6..3e5959f 100644
--- a/src/shared/shell.c
+++ b/src/shared/shell.c
@@ -1447,6 +1447,15 @@ static void env_destroy(void *data)
 int bt_shell_run(void)
 {
 	int status;
+	const struct queue_entry *submenu;
+
+	for (submenu = queue_get_entries(data.submenus); submenu;
+	     submenu = submenu->next) {
+		struct bt_shell_menu *menu = submenu->data;
+
+		if (menu->pre_run != NULL)
+			menu->pre_run(menu);
+	}
 
 	status = mainloop_run_with_signal(signal_callback, NULL);
 
diff --git a/src/shared/shell.h b/src/shared/shell.h
index eebbc71..297fb69 100644
--- a/src/shared/shell.h
+++ b/src/shared/shell.h
@@ -27,6 +27,7 @@ typedef void (*bt_shell_menu_disp_t) (char **matches, int num_matches,
 							int max_length);
 typedef void (*bt_shell_prompt_input_func) (const char *input, void *user_data);
 typedef bool (*bt_shell_menu_exists_t) (const struct bt_shell_menu *menu);
+typedef void (*bt_shell_menu_pre_run_t) (const struct bt_shell_menu *menu);
 
 struct bt_shell_menu_entry {
 	const char *cmd;
@@ -41,6 +42,7 @@ struct bt_shell_menu_entry {
 struct bt_shell_menu {
 	const char *name;
 	const char *desc;
+	bt_shell_menu_pre_run_t pre_run;
 	const struct bt_shell_menu_entry entries[];
 };