Thread (4 messages) read the whole thread 4 messages, 3 authors, 2021-08-18

Re: [PATCH v2] mgmt: Set offload codec mgmt feature

From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Date: 2021-08-17 23:49:13

Hi Kiran,

On Mon, Aug 16, 2021 at 8:06 PM Kiran K [off-list ref] wrote:
quoted hunk ↗ jump to hunk
Add mgmt support to toggle offload codec feature
---
changes in v2:
 - fix warnings reported by checkpatch
 - add uuid to /src/shared/util.c:uuid128_table
 - remove sign-off from commit message

 src/shared/util.c |  1 +
 tools/btmgmt.c    | 44 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 45 insertions(+)
diff --git a/src/shared/util.c b/src/shared/util.c
index 854b48d38f09..2447564566ce 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -1027,6 +1027,7 @@ static const struct {
                "BlueZ Experimental LL privacy" },
        { "330859bc-7506-492d-9370-9a6f0614037f",
                "BlueZ Experimental Bluetooth Quality Report" },
+       { "a6695ace-ee7f-4fb9-881a-5fac66c629af", "BlueZ Offload Codecs"},
Please have it as a separate patch.
quoted hunk ↗ jump to hunk
        { }
 };
diff --git a/tools/btmgmt.c b/tools/btmgmt.c
index 7d908238156d..a840c428cc74 100644
--- a/tools/btmgmt.c
+++ b/tools/btmgmt.c
@@ -2554,6 +2554,48 @@ static void cmd_privacy(int argc, char **argv)
        }
 }

+static void exp_offload_rsp(uint8_t status, uint16_t len, const void *param,
+                                                       void *user_data)
+{
+       if (status != 0)
+               error("Set offload codec failed with status 0x%02x (%s)",
+                                               status, mgmt_errstr(status));
+       else
+               print("Offload codec feature successfully set");
+
+       bt_shell_noninteractive_quit(EXIT_SUCCESS);
+}
+
+static void cmd_exp_offload_codecs(int argc, char **argv)
+{
+       /* a6695ace-ee7f-4fb9-881a-5fac66c629af */
+       static const uint8_t uuid[16] = {
+                               0xaf, 0x29, 0xc6, 0x66, 0xac, 0x5f, 0x1a, 0x88,
+                               0xb9, 0x4f, 0x7f, 0xee, 0xce, 0x5a, 0x69, 0xa6,
+       };
+
+       struct mgmt_cp_set_exp_feature cp;
+       uint8_t val;
+       uint16_t index;
+
+       if (parse_setting(argc, argv, &val) == false)
+               return bt_shell_noninteractive_quit(EXIT_FAILURE);
+
+       index = mgmt_index;
+       if (index == MGMT_INDEX_NONE)
+               index = 0;
+
+       memset(&cp, 0, sizeof(cp));
+       memcpy(cp.uuid, uuid, 16);
+       cp.action = val;
+
+       if (mgmt_send(mgmt, MGMT_OP_SET_EXP_FEATURE, index,
+                       sizeof(cp), &cp, exp_offload_rsp, NULL, NULL) == 0) {
+               error("Unable to send offload codecs feature cmd");
+               return bt_shell_noninteractive_quit(EXIT_FAILURE);
+       }
+}
+
 static void class_rsp(uint16_t op, uint16_t id, uint8_t status, uint16_t len,
                                                        const void *param)
 {
@@ -5595,6 +5637,8 @@ static const struct bt_shell_menu main_menu = {
                cmd_exp_privacy,        "Set LL privacy feature"        },
        { "exp-quality",        "<on/off>", cmd_exp_quality,
                "Set bluetooth quality report feature"                  },
+       { "exp-offload",                "<on/off>",
+               cmd_exp_offload_codecs, "Toggle codec support"          },
        { "read-sysconfig",     NULL,
                cmd_read_sysconfig,     "Read System Configuration"     },
        { "set-sysconfig",      "<-v|-h> [options...]",
--
2.17.1

-- 
Luiz Augusto von Dentz
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help