From: Mateusz Lemusisk <mrlemux@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH] client: Display address if calling 'disconnect' without arguments
Date: Thu, 4 Jun 2015 21:06:26 +0200 [thread overview]
Message-ID: <20150604190626.GA6440@localhost.Belkin> (raw)
Before:
[PHILIPS BTM2180]# disconnect
Attempting to disconnect from
Successful disconnected
After:
[PHILIPS BTM2180]# disconnect
Attempting to disconnect from XX:XX:XX:XX:XX:XX
Successful disconnected
---
client/main.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/client/main.c b/client/main.c
index 41e95b2..88ae5ed 100644
--- a/client/main.c
+++ b/client/main.c
@@ -1422,7 +1422,19 @@ static void cmd_disconn(const char *arg)
return;
}
- rl_printf("Attempting to disconnect from %s\n", arg);
+ if (strlen(arg) == 0) {
+ const char *default_address;
+ DBusMessageIter iter;
+
+ if (g_dbus_proxy_get_property(proxy, "Address", &iter) == FALSE)
+ default_address = "";
+ else
+ dbus_message_iter_get_basic(&iter, &default_address);
+
+ rl_printf("Attempting to disconnect from %s\n", default_address);
+ } else {
+ rl_printf("Attempting to disconnect from %s\n", arg);
+ }
}
static void cmd_list_attributes(const char *arg)
--
2.4.2
next reply other threads:[~2015-06-04 19:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-04 19:06 Mateusz Lemusisk [this message]
2015-06-05 14:32 ` [PATCH] client: Display address if calling 'disconnect' without arguments 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=20150604190626.GA6440@localhost.Belkin \
--to=mrlemux@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
/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.