From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ 5/5] adapter: Enable codec offload when Experimental is set
Date: Tue, 7 Sep 2021 15:30:08 -0700 [thread overview]
Message-ID: <20210907223008.2322035-5-luiz.dentz@gmail.com> (raw)
In-Reply-To: <20210907223008.2322035-1-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This enables codec offload experimental feature if its UUIDs has been
enabled by main.conf:Experimental or -E has been passed in the command
line.
---
src/adapter.c | 42 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 42 insertions(+)
diff --git a/src/adapter.c b/src/adapter.c
index bc6469e0a..ce715766c 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -135,6 +135,13 @@ static const struct mgmt_exp_uuid rpa_resolution_uuid = {
.str = "15c0a148-c273-11ea-b3de-0242ac130004"
};
+/* a6695ace-ee7f-4fb9-881a-5fac66c629af */
+static const struct mgmt_exp_uuid codec_offload_uuid = {
+ .val = { 0xaf, 0x29, 0xc6, 0x66, 0xac, 0x5f, 0x1a, 0x88,
+ 0xb9, 0x4f, 0x7f, 0xee, 0xce, 0x5a, 0x69, 0xa6 },
+ .str = "a6695ace-ee7f-4fb9-881a-5fac66c629af"
+};
+
static DBusConnection *dbus_conn = NULL;
static uint32_t kernel_features = 0;
@@ -9555,6 +9562,40 @@ static void rpa_resolution_func(struct btd_adapter *adapter, uint8_t action)
btd_error(adapter->dev_id, "Failed to set RPA Resolution");
}
+static void codec_offload_complete(uint8_t status, uint16_t len,
+ const void *param, void *user_data)
+{
+ struct btd_adapter *adapter = user_data;
+ uint8_t action = btd_opts.experimental ? 0x01 : 0x00;
+
+ if (status != 0) {
+ error("Set Codec Offload failed with status 0x%02x (%s)",
+ status, mgmt_errstr(status));
+ return;
+ }
+
+ DBG("Codec Offload successfully set");
+
+ if (action)
+ queue_push_tail(adapter->exps, (void *)codec_offload_uuid.val);
+}
+
+static void codec_offload_func(struct btd_adapter *adapter, uint8_t action)
+{
+ struct mgmt_cp_set_exp_feature cp;
+
+ memset(&cp, 0, sizeof(cp));
+ memcpy(cp.uuid, codec_offload_uuid.val, 16);
+ cp.action = action;
+
+ if (mgmt_send(adapter->mgmt, MGMT_OP_SET_EXP_FEATURE,
+ adapter->dev_id, sizeof(cp), &cp,
+ codec_offload_complete, adapter, NULL) > 0)
+ return;
+
+ btd_error(adapter->dev_id, "Failed to set Codec Offload");
+}
+
static const struct exp_feat {
const struct mgmt_exp_uuid *uuid;
void (*func)(struct btd_adapter *adapter, uint8_t action);
@@ -9564,6 +9605,7 @@ static const struct exp_feat {
le_simult_central_peripheral_func),
EXP_FEAT(&quality_report_uuid, quality_report_func),
EXP_FEAT(&rpa_resolution_uuid, rpa_resolution_func),
+ EXP_FEAT(&codec_offload_uuid, codec_offload_func),
};
static void read_exp_features_complete(uint8_t status, uint16_t length,
--
2.31.1
next prev parent reply other threads:[~2021-09-07 22:30 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-07 22:30 [PATCH BlueZ 1/5] adapter-api: Add Experimental property Luiz Augusto von Dentz
2021-09-07 22:30 ` [PATCH BlueZ 2/5] adapter: Implement " Luiz Augusto von Dentz
2021-09-07 22:30 ` [PATCH BlueZ 3/5] client: Add support for printing ExperimentalFeatures property Luiz Augusto von Dentz
2021-09-07 22:30 ` [PATCH BlueZ 4/5] main.conf: Allow passing a list of UUIDs to Experimental Luiz Augusto von Dentz
2021-09-07 22:30 ` Luiz Augusto von Dentz [this message]
2021-09-07 22:56 ` [BlueZ,1/5] adapter-api: Add Experimental property bluez.test.bot
2021-09-08 21:13 ` Luiz Augusto von Dentz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210907223008.2322035-5-luiz.dentz@gmail.com \
--to=luiz.dentz@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox