diff mbox series

[v2] mgmt: Set offload codec mgmt feature

Message ID 20210817030930.9211-1-kiran.k@intel.com (mailing list archive)
State Superseded
Headers show
Series [v2] mgmt: Set offload codec mgmt feature | expand

Commit Message

K, Kiran Aug. 17, 2021, 3:09 a.m. UTC
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(+)

Comments

bluez.test.bot@gmail.com Aug. 17, 2021, 3:39 a.m. UTC | #1
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=532441

---Test result---

Test Summary:
CheckPatch                    PASS      0.35 seconds
GitLint                       PASS      0.12 seconds
Prep - Setup ELL              PASS      48.10 seconds
Build - Prep                  PASS      0.11 seconds
Build - Configure             PASS      8.40 seconds
Build - Make                  PASS      208.49 seconds
Make Check                    PASS      9.26 seconds
Make Distcheck                PASS      246.27 seconds
Build w/ext ELL - Configure   PASS      8.42 seconds
Build w/ext ELL - Make        PASS      194.12 seconds

Details
##############################
Test: CheckPatch - PASS
Desc: Run checkpatch.pl script with rule in .checkpatch.conf

##############################
Test: GitLint - PASS
Desc: Run gitlint with rule in .gitlint

##############################
Test: Prep - Setup ELL - PASS
Desc: Clone, build, and install ELL

##############################
Test: Build - Prep - PASS
Desc: Prepare environment for build

##############################
Test: Build - Configure - PASS
Desc: Configure the BlueZ source tree

##############################
Test: Build - Make - PASS
Desc: Build the BlueZ source tree

##############################
Test: Make Check - PASS
Desc: Run 'make check'

##############################
Test: Make Distcheck - PASS
Desc: Run distcheck to check the distribution

##############################
Test: Build w/ext ELL - Configure - PASS
Desc: Configure BlueZ source with '--enable-external-ell' configuration

##############################
Test: Build w/ext ELL - Make - PASS
Desc: Build BlueZ source with '--enable-external-ell' configuration



---
Regards,
Linux Bluetooth
Luiz Augusto von Dentz Aug. 17, 2021, 11:48 p.m. UTC | #2
Hi Kiran,

On Mon, Aug 16, 2021 at 8:06 PM Kiran K <kiran.k@intel.com> wrote:
>
> 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.

>         { }
>  };
>
> 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
>
K, Kiran Aug. 18, 2021, 5:56 a.m. UTC | #3
Hi Luiz,

> -----Original Message-----
> From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
> Sent: Wednesday, August 18, 2021 5:19 AM
> To: K, Kiran <kiran.k@intel.com>
> Cc: linux-bluetooth@vger.kernel.org; Srivatsa, Ravishankar
> <ravishankar.srivatsa@intel.com>
> Subject: Re: [PATCH v2] mgmt: Set offload codec mgmt feature
> 
> Hi Kiran,
> 
> On Mon, Aug 16, 2021 at 8:06 PM Kiran K <kiran.k@intel.com> wrote:
> >
> > 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.

Ack.  I will send an updated patch.
> 
> >         { }
> >  };
> >
> > 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

Thanks,
Kiran
diff mbox series

Patch

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"},
 	{ }
 };
 
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...]",