obexctl: Add optional argument channel to connect command
Luiz Augusto von Dentz
maintainerPATCH v2 1/1 obexctl: Add optional argument channel to connect command
From: Luiz Augusto von Dentz <[email protected]>
This adds a third argument to connect command so a channel can be passed to CreateSession which is useful since it possible to force a specific RFCOMM channel.
---
v2: Fix passing Channel argument as DBUS_TYPE_UINT16 rather than DBUS_TYPE_BYTE.
tools/obexctl.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-)
tools/obexctl.c +21 -6
@@ -114,6 +114,7 @@ static void connect_reply(DBusMessage *message, void *user_data)struct connect_args {char *dev;char *target; +uint8_t channel; };static void connect_args_free (void *data)
@@ -139,13 +140,14 @@ static void connect_setup(DBusMessageIter *iter, void *user_data)DBUS_DICT_ENTRY_END_CHAR_AS_STRING , &dict); -if (args->target ==NULL ) - goto done; - -g_dbus_dict_append_entry (&dict,"Target" , +if (args->target) +g_dbus_dict_append_entry (&dict,"Target" ,DBUS_TYPE_STRING , &args->target); -done: +if (args->channel) +g_dbus_dict_append_entry (&dict,"Channel" , +DBUS_TYPE_BYTE , &args->channel); +dbus_message_iter_close_container (iter, &dict); }
@@ -153,6 +155,7 @@ static void cmd_connect(int argc, char *argv[]) {struct connect_args *args;const char *target ="opp" ; +int channel =0 ;if (!client) {bt_shell_printf ("Client proxy not available\n" );
@@ -162,9 +165,20 @@ static void cmd_connect(int argc, char *argv[])if (argc >2 ) target = argv[2 ]; +if (argc >3 ) { +char *endptr =NULL ; + + channel =strtol (argv[3 ], &endptr,0 ); +if (!endptr || *endptr !='\0' || channel >UINT8_MAX ) { +bt_shell_printf ("Invalid channel\n" ); +return bt_shell_noninteractive_quit (EXIT_FAILURE ); + } + } + args = g_new0(struct connect_args, 1); args->dev =g_strdup (argv[1 ]); args->target =g_strdup (target); + args->channel = channel;if (g_dbus_proxy_method_call (client,"CreateSession" , connect_setup, connect_reply, args, connect_args_free) == FALSE) {
@@ -1832,7 +1846,8 @@ static void cmd_mkdir(int argc, char *argv[])static const struct bt_shell_menu main_menu = { .name ="main" , .entries = { - {"connect" ,"<dev> [uuid]" , cmd_connect,"Connect session" }, + {"connect" ,"<dev> [uuid] [channel]" , cmd_connect, +"Connect session" }, {"disconnect" ,"[session]" , cmd_disconnect,"Disconnect session" , session_generator }, {"list" ,NULL , cmd_list,"List available sessions" },
Signature · 1 line
2.34.1
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=614281
---Test result---
Test Summary:
CheckPatch PASS 1.51 seconds GitLint PASS 0.98 seconds Prep - Setup ELL PASS 55.48 seconds Build - Prep PASS 0.95 seconds Build - Configure PASS 10.18 seconds Build - Make PASS 1793.79 seconds Make Check PASS 12.13 seconds Make Check w/Valgrind PASS 533.60 seconds Make Distcheck PASS 293.74 seconds Build w/ext ELL - Configure PASS 10.75 seconds Build w/ext ELL - Make PASS 1791.47 seconds Incremental Build with patchesPASS 0.00 seconds
---
Regards,
Linux Bluetooth