Bluetooth: aosp: Support AOSP Bluetooth Quality Report
This patch adds the support of the AOSP Bluetooth Quality Report (BQR) events. Multiple vendors have supported the AOSP Bluetooth Quality Report. When a Bluetooth controller supports the capability, it can enable the aosp capability through hci_set_aosp_capable. Then hci_core will set up the hdev->aosp_set_quality_report callback through aosp_do_open if the controller responds to support the quality report capability. Note that Intel also supports a distinct telemetry quality report specification. Intel sets up the hdev->set_quality_report callback in the btusb driver module. Reviewed-by: Miao-chen Chou <mcchou@chromium.org> Signed-off-by: Joseph Hwang <josephsih@chromium.org> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
This commit is contained in:
committed by
Marcel Holtmann
parent
749a6c5942
commit
258f56d11b
@@ -39,6 +39,7 @@
|
||||
#include "mgmt_config.h"
|
||||
#include "msft.h"
|
||||
#include "eir.h"
|
||||
#include "aosp.h"
|
||||
|
||||
#define MGMT_VERSION 1
|
||||
#define MGMT_REVISION 21
|
||||
@@ -3934,7 +3935,8 @@ static int read_exp_features_info(struct sock *sk, struct hci_dev *hdev,
|
||||
idx++;
|
||||
}
|
||||
|
||||
if (hdev && hdev->set_quality_report) {
|
||||
if (hdev && (aosp_has_quality_report(hdev) ||
|
||||
hdev->set_quality_report)) {
|
||||
if (hci_dev_test_flag(hdev, HCI_QUALITY_REPORT))
|
||||
flags = BIT(0);
|
||||
else
|
||||
@@ -4198,7 +4200,7 @@ static int set_quality_report_func(struct sock *sk, struct hci_dev *hdev,
|
||||
val = !!cp->param[0];
|
||||
changed = (val != hci_dev_test_flag(hdev, HCI_QUALITY_REPORT));
|
||||
|
||||
if (!hdev->set_quality_report) {
|
||||
if (!aosp_has_quality_report(hdev) && !hdev->set_quality_report) {
|
||||
err = mgmt_cmd_status(sk, hdev->id,
|
||||
MGMT_OP_SET_EXP_FEATURE,
|
||||
MGMT_STATUS_NOT_SUPPORTED);
|
||||
@@ -4206,13 +4208,18 @@ static int set_quality_report_func(struct sock *sk, struct hci_dev *hdev,
|
||||
}
|
||||
|
||||
if (changed) {
|
||||
err = hdev->set_quality_report(hdev, val);
|
||||
if (hdev->set_quality_report)
|
||||
err = hdev->set_quality_report(hdev, val);
|
||||
else
|
||||
err = aosp_set_quality_report(hdev, val);
|
||||
|
||||
if (err) {
|
||||
err = mgmt_cmd_status(sk, hdev->id,
|
||||
MGMT_OP_SET_EXP_FEATURE,
|
||||
MGMT_STATUS_FAILED);
|
||||
goto unlock_quality_report;
|
||||
}
|
||||
|
||||
if (val)
|
||||
hci_dev_set_flag(hdev, HCI_QUALITY_REPORT);
|
||||
else
|
||||
@@ -4224,8 +4231,8 @@ static int set_quality_report_func(struct sock *sk, struct hci_dev *hdev,
|
||||
memcpy(rp.uuid, quality_report_uuid, 16);
|
||||
rp.flags = cpu_to_le32(val ? BIT(0) : 0);
|
||||
hci_sock_set_flag(sk, HCI_MGMT_EXP_FEATURE_EVENTS);
|
||||
err = mgmt_cmd_complete(sk, hdev->id,
|
||||
MGMT_OP_SET_EXP_FEATURE, 0,
|
||||
|
||||
err = mgmt_cmd_complete(sk, hdev->id, MGMT_OP_SET_EXP_FEATURE, 0,
|
||||
&rp, sizeof(rp));
|
||||
|
||||
if (changed)
|
||||
|
||||
Reference in New Issue
Block a user