diff options
author | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2021-09-07 15:27:10 -0700 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2021-09-08 14:12:59 -0700 |
commit | 8c0c82c9e966654002350ada8489ca577896566a (patch) | |
tree | 7a2a6f65756f4b4ffcf3f958b133486f3c169dc0 /src/adapter.c | |
parent | 3c7823a1f575447a4c1f74b7ad8e88319f148ad0 (diff) | |
download | bluez-8c0c82c9e966654002350ada8489ca577896566a.tar.gz |
adapter: Enable codec offload when Experimental is set
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.
Diffstat (limited to 'src/adapter.c')
-rw-r--r-- | src/adapter.c | 42 |
1 files changed, 42 insertions, 0 deletions
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, |