From: "Frédéric Danis" <frederic.danis@collabora.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ v2] tools/obexctl: Add support to connect using PSM port
Date: Mon, 14 Oct 2024 19:10:58 +0200 [thread overview]
Message-ID: <20241014171058.75235-1-frederic.danis@collabora.com> (raw)
Since commit 5d7d3ac25bd5 ("obexd: Add PSM support to session create")
obexd supports to connect the session using a L2CAP PSM.
---
tools/obexctl.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/tools/obexctl.c b/tools/obexctl.c
index 56a76915c..c3db11b67 100644
--- a/tools/obexctl.c
+++ b/tools/obexctl.c
@@ -114,7 +114,7 @@ static void connect_reply(DBusMessage *message, void *user_data)
struct connect_args {
char *dev;
char *target;
- uint8_t channel;
+ uint16_t channel;
};
static void connect_args_free(void *data)
@@ -144,9 +144,14 @@ static void connect_setup(DBusMessageIter *iter, void *user_data)
g_dbus_dict_append_entry(&dict, "Target",
DBUS_TYPE_STRING, &args->target);
- if (args->channel)
- g_dbus_dict_append_entry(&dict, "Channel",
+ if (args->channel) {
+ if (args->channel > 31)
+ g_dbus_dict_append_entry(&dict, "PSM",
+ DBUS_TYPE_UINT16, &args->channel);
+ else
+ g_dbus_dict_append_entry(&dict, "Channel",
DBUS_TYPE_BYTE, &args->channel);
+ }
dbus_message_iter_close_container(iter, &dict);
}
@@ -169,8 +174,8 @@ static void cmd_connect(int argc, char *argv[])
char *endptr = NULL;
channel = strtol(argv[3], &endptr, 0);
- if (!endptr || *endptr != '\0' || channel > UINT8_MAX) {
- bt_shell_printf("Invalid channel\n");
+ if (!endptr || *endptr != '\0' || channel > UINT16_MAX) {
+ bt_shell_printf("Invalid channel or PSM\n");
return bt_shell_noninteractive_quit(EXIT_FAILURE);
}
}
@@ -1846,7 +1851,7 @@ static void cmd_mkdir(int argc, char *argv[])
static const struct bt_shell_menu main_menu = {
.name = "main",
.entries = {
- { "connect", "<dev> [uuid] [channel]", cmd_connect,
+ { "connect", "<dev> [uuid] [channel|PSM]", cmd_connect,
"Connect session" },
{ "disconnect", "[session]", cmd_disconnect, "Disconnect session",
session_generator },
--
2.34.1
next reply other threads:[~2024-10-14 17:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-14 17:10 Frédéric Danis [this message]
2024-10-14 18:38 ` [BlueZ,v2] tools/obexctl: Add support to connect using PSM port bluez.test.bot
2024-10-18 14:10 ` [PATCH BlueZ v2] " patchwork-bot+bluetooth
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=20241014171058.75235-1-frederic.danis@collabora.com \
--to=frederic.danis@collabora.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox