Skip to content

Commit 2af4ae1

Browse files
fredrikdanebjercarlescufi
authored andcommitted
Bluetooth: audio: Fix shell available context
This fixes a bug where the shell will reject setting available context to 0x0. This has now been moved to only affect supported context instead. Signed-off-by: Fredrik Danebjer <[email protected]>
1 parent b800be3 commit 2af4ae1

File tree

1 file changed

+7
-2
lines changed
  • subsys/bluetooth/audio/shell

1 file changed

+7
-2
lines changed

subsys/bluetooth/audio/shell/bap.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3643,8 +3643,7 @@ static int cmd_context(const struct shell *sh, size_t argc, char *argv[])
36433643
return err;
36443644
}
36453645

3646-
if (ctx_val == BT_AUDIO_CONTEXT_TYPE_PROHIBITED ||
3647-
ctx_val > BT_AUDIO_CONTEXT_TYPE_ANY) {
3646+
if (ctx_val > BT_AUDIO_CONTEXT_TYPE_ANY) {
36483647
shell_error(sh, "Invalid context: %lu", ctx_val);
36493648

36503649
return -ENOEXEC;
@@ -3653,6 +3652,12 @@ static int cmd_context(const struct shell *sh, size_t argc, char *argv[])
36533652
ctx = ctx_val;
36543653

36553654
if (!strcmp(argv[3], "supported")) {
3655+
if (ctx_val == BT_AUDIO_CONTEXT_TYPE_PROHIBITED) {
3656+
shell_error(sh, "Invalid context: %lu", ctx_val);
3657+
3658+
return -ENOEXEC;
3659+
}
3660+
36563661
err = bt_pacs_set_supported_contexts(dir, ctx);
36573662
if (err) {
36583663
shell_error(ctx_shell, "Set supported contexts err %d", err);

0 commit comments

Comments
 (0)