Skip to contentSkip to conversation

shell: Make bt_shell_add_submenu set main menu if none has been set

PATCH In review Luiz Augusto von Dentz 3 participants 4 messages Mar 28, 2022 – Mar 30, 2022

Subsystems (2)
lore
Share & tools
lore

Luiz Augusto von Dentz

author maintainer
#0 lore raw

PATCH 1/2 shell: Make bt_shell_add_submenu set main menu if none has been set

From: Luiz Augusto von Dentz <[email protected]>

If not main menu has been set when calling bt_shell_add_submenu then turns it on it main menu.

---
 src/shared/shell.c | 3 +++
 1 file changed, 3 insertions(+)
src/shared/shell.c +3 -0
index 0d82bc282..7ba264b99 100644
@@ -1248,6 +1248,9 @@ bool bt_shell_add_submenu(const struct bt_shell_menu *menu)
 	if (!menu)
 		return false;
 
+	if (!data.main)
+		return bt_shell_set_menu(menu);
+
 	if (!data.submenus)
 		data.submenus = queue_new();
 
Signature · 1 line
2.35.1
author maintainer
#1 lore raw

PATCH 2/2 client: Add support for player submenu

From: Luiz Augusto von Dentz <[email protected]>

This moves adds the functionality of bluetooth-player into bluetoothctl.

---
 Makefile.tools                              |    6 +-
 client/main.c                               |    5 +
 tools/bluetooth-player.c => client/player.c |   70 +-
 client/player.h                             |   12 +
 tools/bluetooth-player.c                    | 1081 +------------------
 5 files changed, 64 insertions(+), 1110 deletions(-)
 copy tools/bluetooth-player.c => client/player.c (96%)
 create mode 100644 client/player.h
Makefile.tools +3 -3
index bd902fd83..b7d893248 100644
@@ -10,8 +10,8 @@ client_bluetoothctl_SOURCES = client/main.c \
 					client/adv_monitor.h \
 					client/adv_monitor.c \
 					client/gatt.h client/gatt.c \
-					client/admin.h \
-					client/admin.c
+					client/admin.h client/admin.c \
+					client/player.h client/player.c
 client_bluetoothctl_LDADD = gdbus/libgdbus-internal.la src/libshared-glib.la \
 				$(GLIB_LIBS) $(DBUS_LIBS) -lreadline
 endif
@@ -456,7 +456,7 @@ tools_obex_server_tool_SOURCES = $(gobex_sources) $(btio_sources) \
 tools_obex_server_tool_LDADD = lib/libbluetooth-internal.la \
 			       src/libshared-glib.la $(GLIB_LIBS)
 
-tools_bluetooth_player_SOURCES = tools/bluetooth-player.c
+tools_bluetooth_player_SOURCES = tools/bluetooth-player.c client/player.c
 tools_bluetooth_player_LDADD = gdbus/libgdbus-internal.la \
 				src/libshared-glib.la \
 				$(GLIB_LIBS) $(DBUS_LIBS) -lreadline
client/main.c +5 -0
index 6bb11b1ad..589268c3a 100644
@@ -30,6 +30,7 @@
 #include "advertising.h"
 #include "adv_monitor.h"
 #include "admin.h"
+#include "player.h"
 
 /* String display constants */
 #define COLORED_NEW	COLOR_GREEN "NEW" COLOR_OFF
@@ -3215,6 +3216,8 @@ int main(int argc, char *argv[])
 
 	bt_shell_set_env("DBUS_CONNECTION", dbus_conn);
 
+	player_add_submenu();
+
 	client = g_dbus_client_new(dbus_conn, "org.bluez", "/org/bluez");
 
 	g_dbus_client_set_connect_watch(client, connect_handler, NULL);
@@ -3228,6 +3231,8 @@ int main(int argc, char *argv[])
 
 	status = bt_shell_run();
 
+	player_remove_submenu();
+
 	g_dbus_client_unref(client);
 
 	dbus_connection_unref(dbus_conn);
client/player.c renamed from tools/bluetooth-player.c +29 -41

142 lines not on this page · raw message

client/player.h new file +12 -0
new file mode 100644
index 000000000..e7778cb1e
@@ -0,0 +1,12 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ *
+ *  BlueZ - Bluetooth protocol stack for Linux
+ *
+ *  Copyright (C) 2020 Intel Corporation. All rights reserved.
+ *
+ *
+ */
+
+void player_add_submenu(void);
+void player_remove_submenu(void);
tools/bluetooth-player.c +15 -1066

1,124 lines not on this page · raw message

Signature · 1 line
2.35.1
#2 lore raw
In reply to Luiz Augusto von Dentz

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=627009

---Test result---

Test Summary:

CheckPatch                    FAIL      1.64 seconds
GitLint                       PASS      0.99 seconds
Prep - Setup ELL              PASS      53.47 seconds
Build - Prep                  PASS      0.70 seconds
Build - Configure             PASS      10.70 seconds
Build - Make                  PASS      1802.68 seconds
Make Check                    PASS      13.23 seconds
Make Check w/Valgrind         PASS      545.21 seconds
Make Distcheck                PASS      282.63 seconds
Build w/ext ELL - Configure   PASS      10.07 seconds
Build w/ext ELL - Make        PASS      1754.57 seconds
Incremental Build with patchesPASS      3577.10 seconds

Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script with rule in .checkpatch.conf Output:
[BlueZ,2/2] client: Add support for player submenu ERROR:SPACING: need consistent spacing around '*' (ctx:WxV) #272: FILE: client/player.c:1102:

+static GDBusClient *client;
                    ^

/github/workspace/src/12794262.patch total: 1 errors, 0 warnings, 1319 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/12794262.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

#3 lore raw
In reply to Luiz Augusto von Dentz
This series was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:

Hello:

This series was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:

Quoted 7 lines · On Mon, 28 Mar 2022 14:25:17 -0700 you wrote:

From: Luiz Augusto von Dentz <[email protected]>

If not main menu has been set when calling bt_shell_add_submenu then turns it on it main menu.

---
 src/shared/shell.c | 3 +++
 1 file changed, 3 insertions(+)

Here is the summary with links:
- [BlueZ,1/2] shell: Make bt_shell_add_submenu set main menu if none has been set

    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=0cc480a546e9

- [BlueZ,2/2] client: Add support for player submenu (no matching commit)

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html