From: Sonny Sasaka <sonnysasaka@chromium.org>
To: linux-bluetooth-@vger.kernel.org, linux-bluetooth@vger.kernel.org
Cc: Sonny Sasaka <sonnysasaka@chromium.org>,
Alain Michaud <alainm@chromium.org>
Subject: [PATCH BlueZ 3/3] client: Add set-allow-internal-profiles command
Date: Mon, 13 Jul 2020 13:14:41 -0700 [thread overview]
Message-ID: <20200713201441.235959-4-sonnysasaka@chromium.org> (raw)
In-Reply-To: <20200713201441.235959-1-sonnysasaka@chromium.org>
Reviewed-by: Alain Michaud <alainm@chromium.org>
---
client/main.c | 38 ++++++++++++++++++++++++++++++++++++++
1 file changed, 38 insertions(+)
diff --git a/client/main.c b/client/main.c
index 9abada69f..c2b6e21e4 100644
--- a/client/main.c
+++ b/client/main.c
@@ -1678,6 +1678,7 @@ static void cmd_info(int argc, char *argv[])
print_property(proxy, "Connected");
print_property(proxy, "WakeAllowed");
print_property(proxy, "LegacyPairing");
+ print_property(proxy, "AllowInternalProfiles");
print_uuids(proxy);
print_property(proxy, "Modalias");
print_property(proxy, "ManufacturerData");
@@ -1838,6 +1839,39 @@ static void cmd_unblock(int argc, char *argv[])
return bt_shell_noninteractive_quit(EXIT_FAILURE);
}
+static void cmd_set_allow_internal_profiles(int argc, char *argv[])
+{
+ GDBusProxy *proxy;
+ dbus_bool_t allow_internal_profiles;
+ char *str;
+
+ proxy = find_device(argc, argv);
+ if (!proxy)
+ return bt_shell_noninteractive_quit(EXIT_FAILURE);
+
+ if (strcmp(argv[2], "true") != 0 && strcmp(argv[2], "false") != 0) {
+ bt_shell_printf("Invalid argument: %s\n", argv[2]);
+ return bt_shell_noninteractive_quit(EXIT_FAILURE);
+ }
+
+ allow_internal_profiles = strcmp(argv[2], "true") == 0 ? true : false;
+
+ str = g_strdup_printf("%s allow internal profiles",
+ proxy_address(proxy));
+
+ if (g_dbus_proxy_set_property_basic(proxy, "AllowInternalProfiles",
+ DBUS_TYPE_BOOLEAN,
+ &allow_internal_profiles,
+ generic_callback,
+ str,
+ g_free) == TRUE)
+ return;
+
+ g_free(str);
+
+ return bt_shell_noninteractive_quit(EXIT_FAILURE);
+}
+
static void remove_device_reply(DBusMessage *message, void *user_data)
{
DBusError error;
@@ -2824,6 +2858,10 @@ static const struct bt_shell_menu main_menu = {
dev_generator },
{ "unblock", "[dev]", cmd_unblock, "Unblock device",
dev_generator },
+ { "set-allow-internal-profiles", "<dev> <true/false>",
+ cmd_set_allow_internal_profiles,
+ "Set allow internal profiles",
+ dev_generator },
{ "remove", "<dev>", cmd_remove, "Remove device",
dev_generator },
{ "connect", "<dev>", cmd_connect, "Connect device",
--
2.26.2
next prev parent reply other threads:[~2020-07-13 20:15 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-13 20:14 [PATCH BlueZ 0/3] Per-device option to enable/disable internal profiles Sonny Sasaka
2020-07-13 20:14 ` [PATCH BlueZ 1/3] doc: Add "AllowInternalProfiles" property to org.bluez.Device1 Sonny Sasaka
2020-07-13 20:14 ` [PATCH BlueZ 2/3] device: " Sonny Sasaka
2020-07-13 20:14 ` Sonny Sasaka [this message]
2020-07-13 20:35 ` [PATCH BlueZ 0/3] Per-device option to enable/disable internal profiles Luiz Augusto von Dentz
2020-07-13 22:04 ` Sonny Sasaka
2020-07-13 22:59 ` Luiz Augusto von Dentz
2020-07-13 23:48 ` Sonny Sasaka
2020-07-14 5:28 ` Luiz Augusto von Dentz
2020-07-14 20:55 ` Sonny Sasaka
2020-07-15 16:25 ` Luiz Augusto von Dentz
2020-07-15 20:13 ` Sonny Sasaka
2020-07-15 21:08 ` Luiz Augusto von Dentz
2020-07-15 22:29 ` Sonny Sasaka
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=20200713201441.235959-4-sonnysasaka@chromium.org \
--to=sonnysasaka@chromium.org \
--cc=alainm@chromium.org \
--cc=linux-bluetooth-@vger.kernel.org \
--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 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).