Commit b15bfa4d authored by Tedd Ho-Jeong An's avatar Tedd Ho-Jeong An Committed by Marcel Holtmann

Bluetooth: mgmt: Fix Experimental Feature Changed event

This patch fixes the controller index in the Experimental Features
Changed event for the offload_codec and the quality_report features to
use the actual hdev index instead of non-controller index(0xffff) so the
client can receive the event and know which controller the event is for.

Fixes: ad933151 ("Bluetooth: Add offload feature under experimental flag")
Fixes: ae7d925b ("Bluetooth: Support the quality report events")
Signed-off-by: default avatarTedd Ho-Jeong An <tedd.an@intel.com>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent 8b89637d
...@@ -3927,7 +3927,9 @@ static int exp_debug_feature_changed(bool enabled, struct sock *skip) ...@@ -3927,7 +3927,9 @@ static int exp_debug_feature_changed(bool enabled, struct sock *skip)
} }
#endif #endif
static int exp_quality_report_feature_changed(bool enabled, struct sock *skip) static int exp_quality_report_feature_changed(bool enabled,
struct hci_dev *hdev,
struct sock *skip)
{ {
struct mgmt_ev_exp_feature_changed ev; struct mgmt_ev_exp_feature_changed ev;
...@@ -3935,7 +3937,7 @@ static int exp_quality_report_feature_changed(bool enabled, struct sock *skip) ...@@ -3935,7 +3937,7 @@ static int exp_quality_report_feature_changed(bool enabled, struct sock *skip)
memcpy(ev.uuid, quality_report_uuid, 16); memcpy(ev.uuid, quality_report_uuid, 16);
ev.flags = cpu_to_le32(enabled ? BIT(0) : 0); ev.flags = cpu_to_le32(enabled ? BIT(0) : 0);
return mgmt_limited_event(MGMT_EV_EXP_FEATURE_CHANGED, NULL, return mgmt_limited_event(MGMT_EV_EXP_FEATURE_CHANGED, hdev,
&ev, sizeof(ev), &ev, sizeof(ev),
HCI_MGMT_EXP_FEATURE_EVENTS, skip); HCI_MGMT_EXP_FEATURE_EVENTS, skip);
} }
...@@ -4156,14 +4158,15 @@ static int set_quality_report_func(struct sock *sk, struct hci_dev *hdev, ...@@ -4156,14 +4158,15 @@ static int set_quality_report_func(struct sock *sk, struct hci_dev *hdev,
&rp, sizeof(rp)); &rp, sizeof(rp));
if (changed) if (changed)
exp_quality_report_feature_changed(val, sk); exp_quality_report_feature_changed(val, hdev, sk);
unlock_quality_report: unlock_quality_report:
hci_req_sync_unlock(hdev); hci_req_sync_unlock(hdev);
return err; return err;
} }
static int exp_offload_codec_feature_changed(bool enabled, struct sock *skip) static int exp_offload_codec_feature_changed(bool enabled, struct hci_dev *hdev,
struct sock *skip)
{ {
struct mgmt_ev_exp_feature_changed ev; struct mgmt_ev_exp_feature_changed ev;
...@@ -4171,7 +4174,7 @@ static int exp_offload_codec_feature_changed(bool enabled, struct sock *skip) ...@@ -4171,7 +4174,7 @@ static int exp_offload_codec_feature_changed(bool enabled, struct sock *skip)
memcpy(ev.uuid, offload_codecs_uuid, 16); memcpy(ev.uuid, offload_codecs_uuid, 16);
ev.flags = cpu_to_le32(enabled ? BIT(0) : 0); ev.flags = cpu_to_le32(enabled ? BIT(0) : 0);
return mgmt_limited_event(MGMT_EV_EXP_FEATURE_CHANGED, NULL, return mgmt_limited_event(MGMT_EV_EXP_FEATURE_CHANGED, hdev,
&ev, sizeof(ev), &ev, sizeof(ev),
HCI_MGMT_EXP_FEATURE_EVENTS, skip); HCI_MGMT_EXP_FEATURE_EVENTS, skip);
} }
...@@ -4229,7 +4232,7 @@ static int set_offload_codec_func(struct sock *sk, struct hci_dev *hdev, ...@@ -4229,7 +4232,7 @@ static int set_offload_codec_func(struct sock *sk, struct hci_dev *hdev,
&rp, sizeof(rp)); &rp, sizeof(rp));
if (changed) if (changed)
exp_offload_codec_feature_changed(val, sk); exp_offload_codec_feature_changed(val, hdev, sk);
return err; return err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment