All of lore.kernel.org
 help / color / mirror / Atom feed
* Cannot use any submenu in bluetoothctl since bluez 5.48
@ 2018-02-05  6:57 Vincent Petry
  2018-02-05  8:21 ` ERAMOTO Masaya
  0 siblings, 1 reply; 3+ messages in thread
From: Vincent Petry @ 2018-02-05  6:57 UTC (permalink / raw)
  To: linux-bluetooth

Hello,

It appears that since bluez 5.48, the gatt commands and others have been
moved into a submenu in the bluetoothctl shell.

I'm struggling to find a way to access the gatt commands. In the past I
could just type "list-attributes" but now it says "Invalid command".

None of the following commands work:

- gatt
- gatt help
- help gatt
- list-attributes

I had a quick look at the source code and I have the feeling that there
is actually no way to access these commands.

If there is a way already, please make it easier and more intuitive to find.

My env:
- openSUSE Tumbleweed snapshot 20180130
- bluez 5.48
- kernel 4.14.15-1-default

Thanks,

Vincent



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

* Re: Cannot use any submenu in bluetoothctl since bluez 5.48
  2018-02-05  6:57 Cannot use any submenu in bluetoothctl since bluez 5.48 Vincent Petry
@ 2018-02-05  8:21 ` ERAMOTO Masaya
  2018-02-05 12:19   ` Luiz Augusto von Dentz
  0 siblings, 1 reply; 3+ messages in thread
From: ERAMOTO Masaya @ 2018-02-05  8:21 UTC (permalink / raw)
  To: Vincent Petry; +Cc: linux-bluetooth

Hi Vincent,

On 02/05/2018 03:57 PM, Vincent Petry wrote:
> Hello,
> 
> It appears that since bluez 5.48, the gatt commands and others have been
> moved into a submenu in the bluetoothctl shell.
> 
> I'm struggling to find a way to access the gatt commands. In the past I
> could just type "list-attributes" but now it says "Invalid command".
> 
> None of the following commands work:
> 
> - gatt
> - gatt help
> - help gatt
> - list-attributes
> 
> I had a quick look at the source code and I have the feeling that there
> is actually no way to access these commands.
> 
> If there is a way already, please make it easier and more intuitive to find.
> 

You can input "menu gatt" to enter gatt submenu and can use available commands
in gatt submenu (e.g. "list-attributes"). If you want to return to main menu,
you input "back". Then you can use available commands in main menu or enter
another submenu.

When inputting an invalid command, we may be able to add the messages like

  [bluetooth]# gatt
  Invalid command: gatt

  Use "help" for a list of available commands in a menu.
  Use "menu <submenu>" if you want to enter any submenu.
  Use "back" if you want to return to main menu.

with the following patch.

---
 src/shared/shell.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/shared/shell.c b/src/shared/shell.c
index f1b85f202..fad421ef1 100644
--- a/src/shared/shell.c
+++ b/src/shared/shell.c
@@ -335,6 +335,16 @@ static int menu_exec(const struct bt_shell_menu_entry *entry,
 	return -ENOENT;
 }
 
+static void help_messages(char *arg)
+{
+	print_text(COLOR_HIGHLIGHT,
+		"Invalid command: %s\n\n"
+		"Use \"help\" for a list of available commands in a menu.\n"
+		"Use \"menu <submenu>\" if you want to enter any submenu.\n"
+		"Use \"back\" if you want to return to main menu.",
+		arg);
+}
+
 static void shell_exec(int argc, char *argv[])
 {
 	if (!data.menu || !argv[0])
@@ -342,7 +352,7 @@ static void shell_exec(int argc, char *argv[])
 
 	if (menu_exec(default_menu, argc, argv) == -ENOENT) {
 		if (menu_exec(data.menu->entries, argc, argv) == -ENOENT)
-			print_text(COLOR_HIGHLIGHT, "Invalid command");
+			help_messages(argv[0]);
 	}
 }
 
-- 
2.14.1


Regards,
Eramoto

> My env:
> - openSUSE Tumbleweed snapshot 20180130
> - bluez 5.48
> - kernel 4.14.15-1-default
> 
> Thanks,
> 
> Vincent
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 


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

* Re: Cannot use any submenu in bluetoothctl since bluez 5.48
  2018-02-05  8:21 ` ERAMOTO Masaya
@ 2018-02-05 12:19   ` Luiz Augusto von Dentz
  0 siblings, 0 replies; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2018-02-05 12:19 UTC (permalink / raw)
  To: ERAMOTO Masaya; +Cc: Vincent Petry, linux-bluetooth

Hi Eramoto,

On Mon, Feb 5, 2018 at 6:21 AM, ERAMOTO Masaya
<eramoto.masaya@jp.fujitsu.com> wrote:
> Hi Vincent,
>
> On 02/05/2018 03:57 PM, Vincent Petry wrote:
>> Hello,
>>
>> It appears that since bluez 5.48, the gatt commands and others have been
>> moved into a submenu in the bluetoothctl shell.
>>
>> I'm struggling to find a way to access the gatt commands. In the past I
>> could just type "list-attributes" but now it says "Invalid command".
>>
>> None of the following commands work:
>>
>> - gatt
>> - gatt help
>> - help gatt
>> - list-attributes
>>
>> I had a quick look at the source code and I have the feeling that there
>> is actually no way to access these commands.
>>
>> If there is a way already, please make it easier and more intuitive to find.
>>
>
> You can input "menu gatt" to enter gatt submenu and can use available commands
> in gatt submenu (e.g. "list-attributes"). If you want to return to main menu,
> you input "back". Then you can use available commands in main menu or enter
> another submenu.
>
> When inputting an invalid command, we may be able to add the messages like
>
>   [bluetooth]# gatt
>   Invalid command: gatt
>
>   Use "help" for a list of available commands in a menu.
>   Use "menu <submenu>" if you want to enter any submenu.
>   Use "back" if you want to return to main menu.
>
> with the following patch.
>
> ---
>  src/shared/shell.c | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/src/shared/shell.c b/src/shared/shell.c
> index f1b85f202..fad421ef1 100644
> --- a/src/shared/shell.c
> +++ b/src/shared/shell.c
> @@ -335,6 +335,16 @@ static int menu_exec(const struct bt_shell_menu_entry *entry,
>         return -ENOENT;
>  }
>
> +static void help_messages(char *arg)
> +{
> +       print_text(COLOR_HIGHLIGHT,
> +               "Invalid command: %s\n\n"
> +               "Use \"help\" for a list of available commands in a menu.\n"
> +               "Use \"menu <submenu>\" if you want to enter any submenu.\n"
> +               "Use \"back\" if you want to return to main menu.",
> +               arg);
> +}
> +
>  static void shell_exec(int argc, char *argv[])
>  {
>         if (!data.menu || !argv[0])
> @@ -342,7 +352,7 @@ static void shell_exec(int argc, char *argv[])
>
>         if (menu_exec(default_menu, argc, argv) == -ENOENT) {
>                 if (menu_exec(data.menu->entries, argc, argv) == -ENOENT)
> -                       print_text(COLOR_HIGHLIGHT, "Invalid command");
> +                       help_messages(argv[0]);
>         }
>  }
>
> --
> 2.14.1

Sounds good to me, do you care to send this as a proper patch?

>
> Regards,
> Eramoto
>
>> My env:
>> - openSUSE Tumbleweed snapshot 20180130
>> - bluez 5.48
>> - kernel 4.14.15-1-default
>>
>> Thanks,
>>
>> Vincent
>>
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
Luiz Augusto von Dentz

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

end of thread, other threads:[~2018-02-05 12:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-05  6:57 Cannot use any submenu in bluetoothctl since bluez 5.48 Vincent Petry
2018-02-05  8:21 ` ERAMOTO Masaya
2018-02-05 12:19   ` Luiz Augusto von Dentz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.