Skip to content

Commit a0b1e75

Browse files
Thalleykartben
authored andcommitted
Bluetooth: MPL: Fix build issues with the MPL shell
If logging (CONFIG_LOGGING) was disabled, then the shell could not build. Ideally the (test) functions should not depend on logging, but rather only CONFIG_BT_TESTING. The shell commands were also properly guarded. Signed-off-by: Emil Gydesen <[email protected]>
1 parent dd0446a commit a0b1e75

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

subsys/bluetooth/audio/mpl.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2526,8 +2526,7 @@ void mpl_debug_dump_state(void)
25262526
}
25272527
#endif /* CONFIG_BT_MPL_LOG_LEVEL_DBG */
25282528

2529-
#if defined(CONFIG_BT_MPL_LOG_LEVEL_DBG) && \
2530-
defined(CONFIG_BT_TESTING) /* Special commands for testing */
2529+
#if defined(CONFIG_BT_TESTING) /* Special commands for testing */
25312530

25322531
#if CONFIG_BT_MPL_OBJECTS
25332532
void mpl_test_unset_parent_group(void)
@@ -2626,4 +2625,4 @@ void mpl_test_search_results_changed_cb(void)
26262625
}
26272626
#endif /* CONFIG_BT_MPL_OBJECTS */
26282627

2629-
#endif /* CONFIG_BT_MPL_LOG_LEVEL_DBG && CONFIG_BT_TESTING */
2628+
#endif /* CONFIG_BT_TESTING */

subsys/bluetooth/audio/shell/mpl.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ LOG_MODULE_REGISTER(bt_mpl_shell, CONFIG_BT_MPL_LOG_LEVEL);
2929

3030
#if defined(CONFIG_BT_MPL)
3131

32-
#if defined(CONFIG_BT_MPL_LOG_LEVEL_DBG) && defined(CONFIG_BT_TESTING)
32+
#if defined(CONFIG_BT_TESTING)
3333
int cmd_mpl_test_set_media_state(const struct shell *sh, size_t argc,
3434
char *argv[])
3535
{
@@ -63,7 +63,7 @@ int cmd_mpl_test_unset_parent_group(const struct shell *sh, size_t argc,
6363
return 0;
6464
}
6565
#endif /* CONFIG_BT_MPL_OBJECTS */
66-
#endif /* CONFIG_BT_MPL_LOG_LEVEL_DBG && CONFIG_BT_TESTING */
66+
#endif /* CONFIG_BT_TESTING */
6767

6868
#if defined(CONFIG_BT_MPL_LOG_LEVEL_DBG)
6969
int cmd_mpl_debug_dump_state(const struct shell *sh, size_t argc,
@@ -90,6 +90,7 @@ int cmd_media_proxy_pl_init(const struct shell *sh, size_t argc, char *argv[])
9090
return err;
9191
}
9292

93+
#if defined(CONFIG_BT_TESTING)
9394
int cmd_mpl_test_player_name_cb(const struct shell *sh, size_t argc,
9495
char *argv[])
9596
{
@@ -207,6 +208,7 @@ int cmd_mpl_test_search_results_changed_cb(const struct shell *sh, size_t argc,
207208
return 0;
208209
}
209210
#endif /* CONFIG_BT_MPL_OBJECTS */
211+
#endif /* CONFIG_BT_TESTING */
210212

211213
static int cmd_mpl(const struct shell *sh, size_t argc, char **argv)
212214
{
@@ -216,7 +218,7 @@ static int cmd_mpl(const struct shell *sh, size_t argc, char **argv)
216218
}
217219

218220
SHELL_STATIC_SUBCMD_SET_CREATE(mpl_cmds,
219-
#if defined(CONFIG_BT_MPL_LOG_LEVEL_DBG) && defined(CONFIG_BT_TESTING)
221+
#if defined(CONFIG_BT_TESTING)
220222
SHELL_CMD_ARG(test_set_media_state, NULL,
221223
"Set the media player state (test) <state>",
222224
cmd_mpl_test_set_media_state, 2, 0),
@@ -225,7 +227,7 @@ SHELL_STATIC_SUBCMD_SET_CREATE(mpl_cmds,
225227
"Set current group to be its own parent (test)",
226228
cmd_mpl_test_unset_parent_group, 1, 0),
227229
#endif /* CONFIG_BT_MPL_OBJECTS */
228-
#endif /* CONFIG_BT_MPL_LOG_LEVEL_DBG && CONFIG_BT_TESTING */
230+
#endif /* CONFIG_BT_TESTING */
229231
#if defined(CONFIG_BT_MPL_LOG_LEVEL_DBG)
230232
SHELL_CMD_ARG(debug_dump_state, NULL,
231233
"Dump media player's state as debug output (debug)",
@@ -234,6 +236,7 @@ SHELL_STATIC_SUBCMD_SET_CREATE(mpl_cmds,
234236
SHELL_CMD_ARG(init, NULL,
235237
"Initialize media player",
236238
cmd_media_proxy_pl_init, 1, 0),
239+
#if defined(CONFIG_BT_TESTING)
237240
SHELL_CMD_ARG(player_name_changed_cb, NULL,
238241
"Trigger Player Name changed callback (test)",
239242
cmd_mpl_test_player_name_cb, 1, 0),
@@ -286,6 +289,7 @@ SHELL_STATIC_SUBCMD_SET_CREATE(mpl_cmds,
286289
"Trigger Search Results Object ID callback (test)",
287290
cmd_mpl_test_search_results_changed_cb, 1, 0),
288291
#endif /* CONFIG_BT_MPL_OBJECTS */
292+
#endif /* CONFIG_BT_TESTING */
289293
SHELL_SUBCMD_SET_END
290294
);
291295

0 commit comments

Comments
 (0)