All of lore.kernel.org
 help / color / mirror / Atom feed
From: Howard Chung <howardchung@google.com>
To: linux-bluetooth@vger.kernel.org, luiz.dentz@gmail.com
Cc: Yun-Hao Chung <howardchung@chromium.org>,
	Archie Pusaka <apusaka@chromium.org>
Subject: [Bluez PATCH v1] btmgmt: add non-interactive quit on read-sysconfig
Date: Tue, 31 Aug 2021 13:44:36 +0800	[thread overview]
Message-ID: <20210831134420.Bluez.v1.1.Iea4821c4c33d0a0f1986b97a1f6cd885427348a8@changeid> (raw)

From: Yun-Hao Chung <howardchung@chromium.org>

This fixes the erros that read-sysconfig doesn't exit in non-interactive
mode.

Reviewed-by: Archie Pusaka <apusaka@chromium.org>
---
Test with following commands
run "btmgmt read-sysconfig" and make sure it exits correctly

 tools/btmgmt.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/btmgmt.c b/tools/btmgmt.c
index a840c428cc74..42ef9acefaea 100644
--- a/tools/btmgmt.c
+++ b/tools/btmgmt.c
@@ -1906,17 +1906,18 @@ static void read_sysconfig_rsp(uint8_t status, uint16_t len, const void *param,
 	if (status != 0) {
 		error("Read system configuration failed with status "
 				"0x%02x (%s)", status, mgmt_errstr(status));
-		return;
+		return bt_shell_noninteractive_quit(EXIT_FAILURE);
 	}
 
 	tlv_list = mgmt_tlv_list_load_from_buf(param, len);
 	if (!tlv_list) {
 		error("Unable to parse response of read system configuration");
-		return;
+		return bt_shell_noninteractive_quit(EXIT_FAILURE);
 	}
 
 	mgmt_tlv_list_foreach(tlv_list, print_mgmt_tlv, NULL);
 	mgmt_tlv_list_free(tlv_list);
+	bt_shell_noninteractive_quit(EXIT_SUCCESS);
 }
 
 static void cmd_read_sysconfig(int argc, char **argv)
-- 
2.33.0.259.gc128427fd7-goog


             reply	other threads:[~2021-08-31  5:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-31  5:44 Howard Chung [this message]
2021-08-31  6:39 ` [Bluez,v1] btmgmt: add non-interactive quit on read-sysconfig bluez.test.bot
2021-09-01  0:57   ` Luiz Augusto von Dentz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210831134420.Bluez.v1.1.Iea4821c4c33d0a0f1986b97a1f6cd885427348a8@changeid \
    --to=howardchung@google.com \
    --cc=apusaka@chromium.org \
    --cc=howardchung@chromium.org \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=luiz.dentz@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.