diff mbox series

[BlueZ,v2] tools/obexctl: Add command line options to support session/system bus

Message ID 20241112045022.2743723-1-quic_dgangire@quicinc.com (mailing list archive)
State New
Headers show
Series [BlueZ,v2] tools/obexctl: Add command line options to support session/system bus | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/CheckPatch warning WARNING:STATIC_CONST_CHAR_ARRAY: static const char * array should probably be static const char * const #115: FILE: tools/obexctl.c:2152: +static const char *help[] = { /github/workspace/src/src/13871714.patch total: 0 errors, 1 warnings, 44 lines checked NOTE: For some of the reported defects, checkpatch may be able to mechanically convert to the typical style using --fix or --fix-inplace. /github/workspace/src/src/13871714.patch has style problems, please review. NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO NOTE: If any of the errors are false positives, please report them to the maintainer, see CHECKPATCH in MAINTAINERS.
tedd_an/GitLint success Gitlint PASS
tedd_an/BuildEll success Build ELL PASS
tedd_an/BluezMake success Bluez Make PASS
tedd_an/MakeCheck success Bluez Make Check PASS
tedd_an/MakeDistcheck success Make Distcheck PASS
tedd_an/CheckValgrind success Check Valgrind PASS
tedd_an/CheckSmatch success CheckSparse PASS
tedd_an/bluezmakeextell success Make External ELL PASS
tedd_an/IncrementalBuild success Incremental Build PASS
tedd_an/ScanBuild success Scan Build PASS

Commit Message

Damodar Reddy GangiReddy Nov. 12, 2024, 4:50 a.m. UTC
From: Damodar Reddy GangiReddy <quic_dgangire@quicinc.com>

Currently obexctl only uses session bus.
As obexd has been enabled support for both session and system bus.
Configuring obexctl to use session/system bus during the runtime
with command line options.
./obexctl --bustype=system or --bustype=session.
By Default session bus will be used.

---
 tools/obexctl.c | 30 ++++++++++++++++++++++++++++--
 1 file changed, 28 insertions(+), 2 deletions(-)

Comments

bluez.test.bot@gmail.com Nov. 12, 2024, 6:40 a.m. UTC | #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=908663

---Test result---

Test Summary:
CheckPatch                    FAIL      7.37 seconds
GitLint                       PASS      0.30 seconds
BuildEll                      PASS      24.44 seconds
BluezMake                     PASS      1687.47 seconds
MakeCheck                     PASS      13.18 seconds
MakeDistcheck                 PASS      178.69 seconds
CheckValgrind                 PASS      253.09 seconds
CheckSmatch                   PASS      356.69 seconds
bluezmakeextell               PASS      120.05 seconds
IncrementalBuild              PASS      1412.88 seconds
ScanBuild                     PASS      1008.18 seconds

Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
[BlueZ,v2] tools/obexctl: Add command line options to support session/system bus
WARNING:STATIC_CONST_CHAR_ARRAY: static const char * array should probably be static const char * const
#115: FILE: tools/obexctl.c:2152:
+static const char *help[] = {

/github/workspace/src/src/13871714.patch total: 0 errors, 1 warnings, 44 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

/github/workspace/src/src/13871714.patch has style problems, please review.

NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO

NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.




---
Regards,
Linux Bluetooth
Luiz Augusto von Dentz Nov. 12, 2024, 4:28 p.m. UTC | #2
Hi,

On Mon, Nov 11, 2024 at 11:50 PM <quic_dgangire@quicinc.com> wrote:
>
> From: Damodar Reddy GangiReddy <quic_dgangire@quicinc.com>
>
> Currently obexctl only uses session bus.
> As obexd has been enabled support for both session and system bus.
> Configuring obexctl to use session/system bus during the runtime
> with command line options.
> ./obexctl --bustype=system or --bustype=session.
> By Default session bus will be used.

I think we should probably attempt to detect at runtime if the name is
available over session or system.

> ---
>  tools/obexctl.c | 30 ++++++++++++++++++++++++++++--
>  1 file changed, 28 insertions(+), 2 deletions(-)
>
> diff --git a/tools/obexctl.c b/tools/obexctl.c
> index a398b095b..d88ffc9fe 100644
> --- a/tools/obexctl.c
> +++ b/tools/obexctl.c
> @@ -2149,16 +2149,42 @@ static void property_changed(GDBusProxy *proxy, const char *name,
>                 session_property_changed(proxy, name, iter);
>  }
>
> +static const char *help[] = {
> +               "Configures either session or system bus.By Default session bus is used",
> +};
> +
> +static const char *bustype_option;
> +
> +static const char **optargs[] = {
> +               &bustype_option
> +};
> +
> +static const struct option options[] = {
> +               { "bustype", required_argument, 0, 'b' },
> +               { 0, 0, 0, 0 }
> +};
> +
> +static const struct bt_shell_opt opt = {
> +               .options = options,
> +               .optno = sizeof(options) / sizeof(struct option),
> +               .optstr = "b",
> +               .optarg = optargs,
> +               .help = help,
> +};
> +
>  int main(int argc, char *argv[])
>  {
>         GDBusClient *client;
>         int status;
>
> -       bt_shell_init(argc, argv, NULL);
> +       bt_shell_init(argc, argv, &opt);
>         bt_shell_set_menu(&main_menu);
>         bt_shell_set_prompt(PROMPT, NULL);
>
> -       dbus_conn = g_dbus_setup_bus(DBUS_BUS_SESSION, NULL, NULL);
> +       if (bustype_option && !(strcmp(bustype_option, "system")))
> +               dbus_conn = g_dbus_setup_bus(DBUS_BUS_SYSTEM, NULL, NULL);
> +       else
> +               dbus_conn = g_dbus_setup_bus(DBUS_BUS_SESSION, NULL, NULL);
>
>         client = g_dbus_client_new(dbus_conn, "org.bluez.obex",
>                                                         "/org/bluez/obex");
> --
> 2.34.1
>
>
diff mbox series

Patch

diff --git a/tools/obexctl.c b/tools/obexctl.c
index a398b095b..d88ffc9fe 100644
--- a/tools/obexctl.c
+++ b/tools/obexctl.c
@@ -2149,16 +2149,42 @@  static void property_changed(GDBusProxy *proxy, const char *name,
 		session_property_changed(proxy, name, iter);
 }
 
+static const char *help[] = {
+		"Configures either session or system bus.By Default session bus is used",
+};
+
+static const char *bustype_option;
+
+static const char **optargs[] = {
+		&bustype_option
+};
+
+static const struct option options[] = {
+		{ "bustype", required_argument, 0, 'b' },
+		{ 0, 0, 0, 0 }
+};
+
+static const struct bt_shell_opt opt = {
+		.options = options,
+		.optno = sizeof(options) / sizeof(struct option),
+		.optstr = "b",
+		.optarg = optargs,
+		.help = help,
+};
+
 int main(int argc, char *argv[])
 {
 	GDBusClient *client;
 	int status;
 
-	bt_shell_init(argc, argv, NULL);
+	bt_shell_init(argc, argv, &opt);
 	bt_shell_set_menu(&main_menu);
 	bt_shell_set_prompt(PROMPT, NULL);
 
-	dbus_conn = g_dbus_setup_bus(DBUS_BUS_SESSION, NULL, NULL);
+	if (bustype_option && !(strcmp(bustype_option, "system")))
+		dbus_conn = g_dbus_setup_bus(DBUS_BUS_SYSTEM, NULL, NULL);
+	else
+		dbus_conn = g_dbus_setup_bus(DBUS_BUS_SESSION, NULL, NULL);
 
 	client = g_dbus_client_new(dbus_conn, "org.bluez.obex",
 							"/org/bluez/obex");