linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH BlueZ] shared/shell: Add prompt item to bt_shell_menu structure
@ 2019-10-23  5:41 Inga Stotland
  2019-11-13 17:33 ` Stotland, Inga
  0 siblings, 1 reply; 3+ messages in thread
From: Inga Stotland @ 2019-10-23  5:41 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: luiz.dentz, Inga Stotland

This allows to associate specific prompts with main menu
and submenus thus providing for better navigation when
submenus are in use.
---
 src/shared/shell.c | 3 +++
 src/shared/shell.h | 1 +
 2 files changed, 4 insertions(+)

diff --git a/src/shared/shell.c b/src/shared/shell.c
index cfdcc76c4..a821c8d0a 100644
--- a/src/shared/shell.c
+++ b/src/shared/shell.c
@@ -1226,6 +1226,9 @@ bool bt_shell_set_menu(const struct bt_shell_menu *menu)
 	if (!data.main)
 		data.main = menu;
 
+	if (menu->prompt)
+		bt_shell_set_prompt(menu->prompt);
+
 	return true;
 }
 
diff --git a/src/shared/shell.h b/src/shared/shell.h
index e14d58381..a9eee506f 100644
--- a/src/shared/shell.h
+++ b/src/shared/shell.h
@@ -53,6 +53,7 @@ struct bt_shell_menu_entry {
 struct bt_shell_menu {
 	const char *name;
 	const char *desc;
+	const char *prompt;
 	const struct bt_shell_menu_entry entries[];
 };
 
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH BlueZ] shared/shell: Add prompt item to bt_shell_menu structure
  2019-10-23  5:41 [PATCH BlueZ] shared/shell: Add prompt item to bt_shell_menu structure Inga Stotland
@ 2019-11-13 17:33 ` Stotland, Inga
  2019-11-13 17:46   ` Luiz Augusto von Dentz
  0 siblings, 1 reply; 3+ messages in thread
From: Stotland, Inga @ 2019-11-13 17:33 UTC (permalink / raw)
  To: luiz.dentz; +Cc: linux-bluetooth

Hi Luiz,

On Tue, 2019-10-22 at 22:41 -0700, Inga Stotland wrote:
> This allows to associate specific prompts with main menu
> and submenus thus providing for better navigation when
> submenus are in use.
> ---
>  src/shared/shell.c | 3 +++
>  src/shared/shell.h | 1 +
>  2 files changed, 4 insertions(+)
> 
> diff --git a/src/shared/shell.c b/src/shared/shell.c
> index cfdcc76c4..a821c8d0a 100644
> --- a/src/shared/shell.c
> +++ b/src/shared/shell.c
> @@ -1226,6 +1226,9 @@ bool bt_shell_set_menu(const struct bt_shell_menu *menu)
>  	if (!data.main)
>  		data.main = menu;
>  
> +	if (menu->prompt)
> +		bt_shell_set_prompt(menu->prompt);
> +
>  	return true;
>  }
>  
> diff --git a/src/shared/shell.h b/src/shared/shell.h
> index e14d58381..a9eee506f 100644
> --- a/src/shared/shell.h
> +++ b/src/shared/shell.h
> @@ -53,6 +53,7 @@ struct bt_shell_menu_entry {
>  struct bt_shell_menu {
>  	const char *name;
>  	const char *desc;
> +	const char *prompt;
>  	const struct bt_shell_menu_entry entries[];
>  };
>  

Do you have any comments for this patch?

Best regards,
Inga

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH BlueZ] shared/shell: Add prompt item to bt_shell_menu structure
  2019-11-13 17:33 ` Stotland, Inga
@ 2019-11-13 17:46   ` Luiz Augusto von Dentz
  0 siblings, 0 replies; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2019-11-13 17:46 UTC (permalink / raw)
  To: Stotland, Inga; +Cc: linux-bluetooth

Hi Inga,

On Wed, Nov 13, 2019 at 7:33 PM Stotland, Inga <inga.stotland@intel.com> wrote:
>
> Hi Luiz,
>
> On Tue, 2019-10-22 at 22:41 -0700, Inga Stotland wrote:
> > This allows to associate specific prompts with main menu
> > and submenus thus providing for better navigation when
> > submenus are in use.
> > ---
> >  src/shared/shell.c | 3 +++
> >  src/shared/shell.h | 1 +
> >  2 files changed, 4 insertions(+)
> >
> > diff --git a/src/shared/shell.c b/src/shared/shell.c
> > index cfdcc76c4..a821c8d0a 100644
> > --- a/src/shared/shell.c
> > +++ b/src/shared/shell.c
> > @@ -1226,6 +1226,9 @@ bool bt_shell_set_menu(const struct bt_shell_menu *menu)
> >       if (!data.main)
> >               data.main = menu;
> >
> > +     if (menu->prompt)
> > +             bt_shell_set_prompt(menu->prompt);
> > +
> >       return true;
> >  }
> >
> > diff --git a/src/shared/shell.h b/src/shared/shell.h
> > index e14d58381..a9eee506f 100644
> > --- a/src/shared/shell.h
> > +++ b/src/shared/shell.h
> > @@ -53,6 +53,7 @@ struct bt_shell_menu_entry {
> >  struct bt_shell_menu {
> >       const char *name;
> >       const char *desc;
> > +     const char *prompt;
> >       const struct bt_shell_menu_entry entries[];
> >  };
> >
>
> Do you have any comments for this patch?

I recall experimenting with something similar, but the problem is that
sometimes there is already a prompt set, for instance we set the
address when connected on bluetoothctl and that should probably stay
even if you change the menu, perhaps instead overwrite the prompt we
could have another section so we append the menu name at the end of
the prompt or something like that.

-- 
Luiz Augusto von Dentz

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-11-13 17:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-23  5:41 [PATCH BlueZ] shared/shell: Add prompt item to bt_shell_menu structure Inga Stotland
2019-11-13 17:33 ` Stotland, Inga
2019-11-13 17:46   ` Luiz Augusto von Dentz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).