Skip to content

Commit

Permalink
Bluetooth: Shell: Restructure shell files
Browse files Browse the repository at this point in the history
Moves around the shell files so that they are placed nearer
to the features they expose access to.

A few changes as possible has been made.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
  • Loading branch information
Thalley committed Sep 11, 2024
1 parent 594bef8 commit 5530a07
Show file tree
Hide file tree
Showing 53 changed files with 82 additions and 111 deletions.
11 changes: 0 additions & 11 deletions MAINTAINERS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -345,9 +345,6 @@ Bluetooth controller:
- subsys/bluetooth/common/
- subsys/bluetooth/controller/
- subsys/bluetooth/crypto/
- subsys/bluetooth/shell/ll.c
- subsys/bluetooth/shell/ll.h
- subsys/bluetooth/shell/ticker.c
- tests/bluetooth/controller/
- tests/bsim/bluetooth/ll/
labels:
Expand Down Expand Up @@ -376,7 +373,6 @@ Bluetooth Host:
- subsys/bluetooth/host/
- subsys/bluetooth/lib/
- subsys/bluetooth/services/
- subsys/bluetooth/shell/
- subsys/bluetooth/CMakeLists.txt
- subsys/bluetooth/Kconfig*
- tests/bluetooth/
Expand Down Expand Up @@ -404,11 +400,6 @@ Bluetooth Host:
- samples/bluetooth/tmap*/
- samples/bluetooth/iso_*/
- samples/bluetooth/mesh*/
- subsys/bluetooth/shell/bredr.c
- subsys/bluetooth/shell/iso.c
- subsys/bluetooth/shell/ll.c
- subsys/bluetooth/shell/ll.h
- subsys/bluetooth/shell/ticker.c
- subsys/bluetooth/Kconfig.iso
- subsys/bluetooth/host/iso.c
- subsys/bluetooth/host/iso_internal.h
Expand Down Expand Up @@ -500,7 +491,6 @@ Bluetooth Classic:
files:
- subsys/bluetooth/common/
- subsys/bluetooth/host/classic/
- subsys/bluetooth/shell/bredr.c
- include/zephyr/bluetooth/classic/
labels:
- "area: Bluetooth Classic"
Expand All @@ -518,7 +508,6 @@ Bluetooth ISO:
- include/zephyr/bluetooth/iso.h
- doc/connectivity/bluetooth/api/shell/iso.rst
- samples/bluetooth/iso_*/
- subsys/bluetooth/shell/iso.c
- subsys/bluetooth/Kconfig.iso
- subsys/bluetooth/host/iso.c
- subsys/bluetooth/host/iso_internal.h
Expand Down
1 change: 0 additions & 1 deletion subsys/bluetooth/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ target_include_directories(subsys__bluetooth INTERFACE ${CMAKE_CURRENT_SOURCE_DI

add_subdirectory(common)
add_subdirectory_ifdef(CONFIG_BT_HCI host)
add_subdirectory_ifdef(CONFIG_BT_SHELL shell)
add_subdirectory_ifdef(CONFIG_BT_CONN services)
add_subdirectory_ifdef(CONFIG_BT_MESH mesh)
add_subdirectory_ifdef(CONFIG_BT_AUDIO audio)
Expand Down
9 changes: 8 additions & 1 deletion subsys/bluetooth/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,18 @@ rsource "Kconfig.iso"
rsource "common/Kconfig"
rsource "host/Kconfig"
rsource "controller/Kconfig"
rsource "shell/Kconfig"
rsource "crypto/Kconfig"
rsource "lib/Kconfig"
rsource "Kconfig.logging"

config BT_SHELL
bool "Bluetooth shell"
select SHELL
select BT_TICKER_NEXT_SLOT_GET if BT_LL_SW_SPLIT
help
Activate shell module that provides Bluetooth commands to the
console.

config BT_USE_PSA_API
bool "Use PSA APIs instead of TinyCrypt for crypto operations"
depends on BT_CRYPTO || BT_HOST_CRYPTO || BT_ECC
Expand Down
2 changes: 1 addition & 1 deletion subsys/bluetooth/audio/shell/audio.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include <zephyr/sys/util_macro.h>
#include <zephyr/sys_clock.h>

#include "shell/bt.h"
#include "host/shell/bt.h"

#define SHELL_PRINT_INDENT_LEVEL_SIZE 2
#define MAX_CODEC_FRAMES_PER_SDU 4U
Expand Down
2 changes: 1 addition & 1 deletion subsys/bluetooth/audio/shell/bap.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
#include <zephyr/sys/util_macro.h>
#include <zephyr/sys_clock.h>

#include "shell/bt.h"
#include "host/shell/bt.h"
#include "audio.h"

/* Determines if we can initiate streaming */
Expand Down
2 changes: 1 addition & 1 deletion subsys/bluetooth/audio/shell/bap_broadcast_assistant.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include <zephyr/sys/util_macro.h>
#include <zephyr/types.h>

#include "shell/bt.h"
#include "host/shell/bt.h"
#include "../../host/hci_core.h"
#include "audio.h"

Expand Down
2 changes: 1 addition & 1 deletion subsys/bluetooth/audio/shell/bap_scan_delegator.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include <zephyr/types.h>

#include <audio/bap_internal.h>
#include "shell/bt.h"
#include "host/shell/bt.h"

#define PA_SYNC_INTERVAL_TO_TIMEOUT_RATIO 20 /* Set the timeout relative to interval */
#define PA_SYNC_SKIP 5
Expand Down
2 changes: 1 addition & 1 deletion subsys/bluetooth/audio/shell/cap_acceptor.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include <zephyr/bluetooth/gatt.h>
#include <zephyr/bluetooth/bluetooth.h>
#include <zephyr/bluetooth/audio/cap.h>
#include "shell/bt.h"
#include "host/shell/bt.h"

static size_t ad_cap_announcement_data_add(struct bt_data data[], size_t data_size)
{
Expand Down
2 changes: 1 addition & 1 deletion subsys/bluetooth/audio/shell/cap_commander.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include <zephyr/sys/util.h>
#include <zephyr/types.h>

#include "shell/bt.h"
#include "host/shell/bt.h"
#include "audio.h"

static void cap_discover_cb(struct bt_conn *conn, int err,
Expand Down
2 changes: 1 addition & 1 deletion subsys/bluetooth/audio/shell/cap_initiator.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include <zephyr/bluetooth/bluetooth.h>
#include <zephyr/bluetooth/audio/cap.h>

#include "shell/bt.h"
#include "host/shell/bt.h"
#include "audio.h"

#if defined(CONFIG_BT_BAP_UNICAST_CLIENT)
Expand Down
2 changes: 1 addition & 1 deletion subsys/bluetooth/audio/shell/csip_set_coordinator.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include <zephyr/types.h>
#include <zephyr/shell/shell.h>

#include "shell/bt.h"
#include "host/shell/bt.h"

static uint8_t members_found;
static struct k_work_delayable discover_members_timer;
Expand Down
2 changes: 1 addition & 1 deletion subsys/bluetooth/audio/shell/csip_set_member.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include <zephyr/types.h>
#include <zephyr/shell/shell.h>

#include "shell/bt.h"
#include "host/shell/bt.h"

extern const struct shell *ctx_shell;
struct bt_csip_set_member_svc_inst *svc_inst;
Expand Down
2 changes: 1 addition & 1 deletion subsys/bluetooth/audio/shell/gmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include <zephyr/sys/util.h>
#include <zephyr/sys/util_macro.h>

#include "shell/bt.h"
#include "host/shell/bt.h"
#include "audio.h"

#define UNICAST_SINK_SUPPORTED (CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SNK_COUNT > 0)
Expand Down
2 changes: 1 addition & 1 deletion subsys/bluetooth/audio/shell/has.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include <zephyr/shell/shell.h>
#include <zephyr/shell/shell_string_conv.h>

#include "shell/bt.h"
#include "host/shell/bt.h"

static int preset_select(uint8_t index, bool sync)
{
Expand Down
2 changes: 1 addition & 1 deletion subsys/bluetooth/audio/shell/has_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include <zephyr/kernel.h>
#include <zephyr/shell/shell_string_conv.h>

#include "shell/bt.h"
#include "host/shell/bt.h"

static struct bt_has *inst;

Expand Down
2 changes: 1 addition & 1 deletion subsys/bluetooth/audio/shell/mcc.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include <zephyr/shell/shell_string_conv.h>
#include <zephyr/sys/util.h>

#include "shell/bt.h"
#include "host/shell/bt.h"

#include "../media_proxy_internal.h"

Expand Down
2 changes: 1 addition & 1 deletion subsys/bluetooth/audio/shell/media_controller.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

#include "../media_proxy_internal.h" /* For MPL_NO_TRACK_ID - TODO: Fix */

#include "shell/bt.h"
#include "host/shell/bt.h"

LOG_MODULE_REGISTER(bt_media_controller_shell, CONFIG_BT_MCS_LOG_LEVEL);

Expand Down
2 changes: 1 addition & 1 deletion subsys/bluetooth/audio/shell/micp_mic_ctlr.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include <zephyr/shell/shell_string_conv.h>
#include <zephyr/types.h>

#include "shell/bt.h"
#include "host/shell/bt.h"

static struct bt_micp_mic_ctlr *micp_mic_ctlr;
#if defined(CONFIG_BT_MICP_MIC_CTLR_AICS)
Expand Down
2 changes: 1 addition & 1 deletion subsys/bluetooth/audio/shell/micp_mic_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include <zephyr/sys/util.h>
#include <zephyr/types.h>

#include "shell/bt.h"
#include "host/shell/bt.h"

static void micp_mic_dev_mute_cb(uint8_t mute)
{
Expand Down
2 changes: 1 addition & 1 deletion subsys/bluetooth/audio/shell/mpl.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include <zephyr/shell/shell.h>
#include <zephyr/shell/shell_string_conv.h>

#include "shell/bt.h"
#include "host/shell/bt.h"

#include "../mpl_internal.h"

Expand Down
2 changes: 1 addition & 1 deletion subsys/bluetooth/audio/shell/pbp.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include <zephyr/sys/__assert.h>
#include <zephyr/sys/util.h>

#include "shell/bt.h"
#include "host/shell/bt.h"

#define PBS_DEMO 'P', 'B', 'P'

Expand Down
2 changes: 1 addition & 1 deletion subsys/bluetooth/audio/shell/tbs.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include <zephyr/shell/shell_string_conv.h>
#include <zephyr/sys/util_macro.h>

#include "shell/bt.h"
#include "host/shell/bt.h"

static struct bt_conn *tbs_authorized_conn;
static bool cbs_registered;
Expand Down
2 changes: 1 addition & 1 deletion subsys/bluetooth/audio/shell/tbs_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include <zephyr/sys/util.h>
#include <zephyr/types.h>

#include "shell/bt.h"
#include "host/shell/bt.h"

static int cmd_tbs_client_discover(const struct shell *sh, size_t argc,
char *argv[])
Expand Down
2 changes: 1 addition & 1 deletion subsys/bluetooth/audio/shell/tmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include <zephyr/shell/shell.h>
#include <zephyr/sys/util.h>

#include "shell/bt.h"
#include "host/shell/bt.h"

static int cmd_tmap_init(const struct shell *sh, size_t argc, char **argv)
{
Expand Down
2 changes: 1 addition & 1 deletion subsys/bluetooth/audio/shell/vcp_vol_ctlr.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include <zephyr/sys/util.h>
#include <zephyr/types.h>

#include "shell/bt.h"
#include "host/shell/bt.h"

static struct bt_vcp_vol_ctlr *vcp_vol_ctlr;
static struct bt_vcp_included vcp_included;
Expand Down
2 changes: 1 addition & 1 deletion subsys/bluetooth/audio/shell/vcp_vol_rend.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include <zephyr/sys/util.h>
#include <zephyr/sys/util_macro.h>

#include "shell/bt.h"
#include "host/shell/bt.h"

static struct bt_vcp_included vcp_included;

Expand Down
2 changes: 2 additions & 0 deletions subsys/bluetooth/controller/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ endif()
zephyr_library()
zephyr_library_link_libraries(subsys__bluetooth)

add_subdirectory_ifdef(CONFIG_BT_SHELL ticker/shell ll_sw/shell)

zephyr_library_sources(
util/mem.c
util/memq.c
Expand Down
5 changes: 5 additions & 0 deletions subsys/bluetooth/controller/ll_sw/shell/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

zephyr_library()
zephyr_library_sources_ifdef(CONFIG_BT_LL_SW_SPLIT ll.c)
zephyr_include_directories(${ZEPHYR_BASE}/subsys/bluetooth/controller/ll_sw/nordic)
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include "../controller/util/memq.h"
#include "../controller/include/ll.h"

#include "bt.h"
#include "host/shell/bt.h"

int cmd_ll_addr_read(const struct shell *sh, size_t argc, char *argv[])
{
Expand Down
File renamed without changes.
4 changes: 4 additions & 0 deletions subsys/bluetooth/controller/ticker/shell/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# SPDX-License-Identifier: Apache-2.0

zephyr_library()
zephyr_library_sources(ticker.c)
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#define TICKERS_MAX 2
#endif

#include "bt.h"
#include "host/shell/bt.h"

static void ticker_op_done(uint32_t err, void *context)
{
Expand Down
1 change: 1 addition & 0 deletions subsys/bluetooth/host/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ zephyr_library()
zephyr_library_link_libraries(subsys__bluetooth)

add_subdirectory_ifdef(CONFIG_BT_CLASSIC classic)
add_subdirectory_ifdef(CONFIG_BT_SHELL shell)

zephyr_library_sources_ifdef(CONFIG_BT_HCI_RAW hci_raw.c hci_common.c)
zephyr_library_sources_ifdef(CONFIG_BT_MONITOR monitor.c)
Expand Down
2 changes: 2 additions & 0 deletions subsys/bluetooth/host/classic/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# SPDX-License-Identifier: Apache-2.0

add_subdirectory_ifdef(CONFIG_BT_SHELL shell)

zephyr_library()
zephyr_library_link_libraries(subsys__bluetooth)

Expand Down
6 changes: 6 additions & 0 deletions subsys/bluetooth/host/classic/shell/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# SPDX-License-Identifier: Apache-2.0

zephyr_library()
zephyr_library_sources(bredr.c)
zephyr_library_sources_ifdef(CONFIG_BT_RFCOMM rfcomm.c)
zephyr_library_sources_ifdef(CONFIG_BT_A2DP a2dp.c)
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

#include <zephyr/shell/shell.h>

#include "bt.h"
#include "host/shell/bt.h"

struct bt_a2dp *default_a2dp;
static uint8_t a2dp_sink_sdp_registered;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

#include <zephyr/shell/shell.h>

#include "bt.h"
#include "host/shell/bt.h"

#if defined(CONFIG_BT_CONN)
/* Connection context for BR/EDR legacy pairing in sec mode 3 */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

#include <zephyr/shell/shell.h>

#include "bt.h"
#include "host/shell/bt.h"

#define DATA_MTU 48

Expand Down
7 changes: 7 additions & 0 deletions subsys/bluetooth/host/shell/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# SPDX-License-Identifier: Apache-2.0

zephyr_library()
zephyr_library_sources(bt.c)
zephyr_library_sources_ifdef(CONFIG_BT_CONN gatt.c)
zephyr_library_sources_ifdef(CONFIG_BT_L2CAP_DYNAMIC_CHANNEL l2cap.c)
zephyr_library_sources_ifdef(CONFIG_BT_ISO iso.c)
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@

#include <zephyr/shell/shell.h>

#include "bt.h"
#include "ll.h"
#include "hci.h"
#include "../audio/shell/audio.h"
#include "audio/shell/audio.h"
#include "controller/ll_sw/shell/ll.h"
#include "host/shell/bt.h"
#include "mesh/shell/hci.h"

static bool no_settings_load;

Expand Down
File renamed without changes.
Loading

0 comments on commit 5530a07

Please sign in to comment.