Skip to content
Browse files

Bluetooth: Shell: Fix unregister GATT Metrics vendor service

The 'registered' flag was not cleared when 'gatt metrics off'
was called so that one was unable to register the service again.
Remove 'registered' variable that is actually not needed as there
is no tracking if service is already registered in similar
cmd_register_test_svc command. If the service is already registered,
the host will log an error.

Fixes: #17882
Signed-off-by: Mariusz Skamra <>
  • Loading branch information...
MariuszSkamra authored and carlescufi committed Aug 1, 2019
1 parent e55f3eb commit 7c6030075330b45515914a4f41a6f362ec9c7762
Showing with 2 additions and 8 deletions.
  1. +2 −8 subsys/bluetooth/shell/gatt.c
@@ -881,14 +881,8 @@ static int cmd_metrics(const struct shell *shell, size_t argc, char *argv[])

if (!strcmp(argv[1], "on")) {
static bool registered;

if (!registered) {
shell_print(shell, "Registering GATT metrics test "
err = bt_gatt_service_register(&met_svc);
registered = true;
shell_print(shell, "Registering GATT metrics test Service.");
err = bt_gatt_service_register(&met_svc);
} else if (!strcmp(argv[1], "off")) {
shell_print(shell, "Unregistering GATT metrics test Service.");
err = bt_gatt_service_unregister(&met_svc);

0 comments on commit 7c60300

Please sign in to comment.
You can’t perform that action at this time.