From: Kiran K <kiran.k@intel.com>
To: linux-bluetooth@vger.kernel.org
Cc: ravishankar.srivatsa@intel.com, chethan.tumkur.narayan@intel.com,
luiz.von.dentz@intel.com, Kiran K <kiran.k@intel.com>
Subject: [PATCH v4 09/14] Bluetooth: Handle MSFT avdtp open event
Date: Fri, 19 Nov 2021 13:50:22 +0530 [thread overview]
Message-ID: <20211119082027.12809-9-kiran.k@intel.com> (raw)
In-Reply-To: <20211119082027.12809-1-kiran.k@intel.com>
Handle MSFT avdtp open event
Signed-off-by: Kiran K <kiran.k@intel.com>
Reviewed-by: Chethan T N <chethan.tumkur.narayan@intel.com>
Reviewed-by: Srivatsa Ravishankar <ravishankar.srivatsa@intel.com>
---
net/bluetooth/hci_event.c | 4 +++
net/bluetooth/msft.c | 57 ++++++++++++++++++++++++++++++++++++++-
net/bluetooth/msft.h | 3 +++
3 files changed, 63 insertions(+), 1 deletion(-)
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index efc5458b1345..70ee07e8f27e 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -3812,6 +3812,10 @@ static void hci_cmd_complete_evt(struct hci_dev *hdev, struct sk_buff *skb,
hci_cc_le_read_transmit_power(hdev, skb);
break;
+ case MSFT_OP_AVDTP:
+ msft_cc_avdtp(hdev, skb);
+ break;
+
default:
BT_DBG("%s opcode 0x%4.4x", hdev->name, *opcode);
break;
diff --git a/net/bluetooth/msft.c b/net/bluetooth/msft.c
index 60ed08d65a06..5953127b3521 100644
--- a/net/bluetooth/msft.c
+++ b/net/bluetooth/msft.c
@@ -99,7 +99,6 @@ struct msft_data {
__u8 filter_enabled;
};
-#define MSFT_OP_AVDTP 0xfc1e
struct msft_cp_avdtp {
__u8 sub_opcode;
__u8 len;
@@ -121,6 +120,13 @@ struct msft_cp_avdtp_open {
__u8 caps[0];
} __packed;
+struct msft_rp_avdtp_open {
+ __u8 status;
+ __u8 sub_opcode;
+ __le16 avdtp_handle;
+ __u8 audio_intf_param_cnt;
+} __packed;
+
static int __msft_add_monitor_pattern(struct hci_dev *hdev,
struct adv_monitor *monitor);
static int __msft_remove_monitor(struct hci_dev *hdev,
@@ -916,3 +922,52 @@ int msft_avdtp_cmd(struct hci_dev *hdev, struct l2cap_chan *chan,
fail:
return err;
}
+
+static void msft_cc_avdtp_open(struct hci_dev *hdev, struct sk_buff *skb)
+{
+ struct msft_rp_avdtp_open *rp;
+ struct msft_cp_avdtp_open *sent;
+ struct hci_conn *hconn;
+
+ if (skb->len < sizeof(*rp))
+ return;
+
+ rp = (void *)skb->data;
+
+ sent = hci_sent_cmd_data(hdev, MSFT_OP_AVDTP);
+
+ hconn = hci_conn_hash_lookup_handle(hdev, le16_to_cpu(sent->handle));
+
+ if (!hconn)
+ return;
+
+ /* wake up the task waiting on avdtp handle */
+}
+
+void msft_cc_avdtp(struct hci_dev *hdev, struct sk_buff *skb)
+{
+ void *sent;
+ __u8 status;
+
+ if (skb->len < 2)
+ return;
+
+ status = skb->data[0];
+
+ bt_dev_dbg(hdev, "status 0x%2.2x", status);
+
+ sent = hci_sent_cmd_data(hdev, MSFT_OP_AVDTP);
+ if (!sent)
+ return;
+
+ switch (skb->data[1]) {
+ case MSFT_OP_AVDTP_OPEN:
+ msft_cc_avdtp_open(hdev, skb);
+ break;
+
+ default:
+ bt_dev_err(hdev, "Invalid MSFT sub opcode 0x%2.2x",
+ skb->data[1]);
+ break;
+ }
+}
diff --git a/net/bluetooth/msft.h b/net/bluetooth/msft.h
index 7628c87e6358..ba26c43431dc 100644
--- a/net/bluetooth/msft.h
+++ b/net/bluetooth/msft.h
@@ -10,6 +10,8 @@
#define MSFT_FEATURE_MASK_CURVE_VALIDITY BIT(4)
#define MSFT_FEATURE_MASK_CONCURRENT_ADV_MONITOR BIT(5)
+#define MSFT_OP_AVDTP 0xfc1e
+
#if IS_ENABLED(CONFIG_BT_MSFTEXT)
bool msft_monitor_supported(struct hci_dev *hdev);
@@ -80,3 +82,4 @@ static inline bool msft_curve_validity(struct hci_dev *hdev)
int msft_avdtp_cmd(struct hci_dev *hdev, struct l2cap_chan *chan,
sockptr_t optval, int optlen);
+void msft_cc_avdtp(struct hci_dev *hdev, struct sk_buff *skb);
--
2.17.1
next prev parent reply other threads:[~2021-11-19 8:15 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-19 8:20 [PATCH v4 01/14] Bluetooth: Refactor code to read supported codecs in getsockopt Kiran K
2021-11-19 8:20 ` [PATCH v4 02/14] Bluetooth: Support reading of codecs supported over l2cap socket Kiran K
2021-11-19 8:20 ` [PATCH v4 03/14] Bluetooth: btintel: cache offload use case data Kiran K
2021-11-19 8:20 ` [PATCH v4 04/14] Bluetooth: Pass transport type in get_data_path_id Kiran K
2021-11-23 23:43 ` Luiz Augusto von Dentz
2021-11-19 8:20 ` [PATCH v4 05/14] Bluetooth: btintel: Add support to fetch data path id for a2dp offload Kiran K
2021-11-23 23:49 ` Luiz Augusto von Dentz
2021-11-19 8:20 ` [PATCH v4 06/14] Bluetooth: Remove unused member in struct hci_vnd_codec_v2 Kiran K
2021-11-23 23:52 ` Luiz Augusto von Dentz
2021-11-19 8:20 ` [PATCH v4 07/14] Bluetooth: Read Output codec capabilities Kiran K
2021-11-19 8:20 ` [PATCH v4 08/14] Bluetooth: Implement MSFT avdtp open command Kiran K
2021-11-24 1:26 ` Luiz Augusto von Dentz
2021-11-19 8:20 ` Kiran K [this message]
2021-11-19 8:20 ` [PATCH v4 10/14] Bluetooth: Handle MSFT avdtp open event Kiran K
2021-11-19 8:20 ` [PATCH v4 11/14] Bluetooth: Implment MSFT avdtp start command Kiran K
2021-11-19 8:20 ` [PATCH v4 12/14] Bluetooth: Implment MSFT avdtp suspend command Kiran K
2021-11-19 8:20 ` [PATCH v4 13/14] Bluetooth: Implment MSFT avdtp close command Kiran K
2021-11-19 8:20 ` [PATCH v4 14/14] Bluetooth: Add MSFT a2dp offload codec under experimental flag Kiran K
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=20211119082027.12809-9-kiran.k@intel.com \
--to=kiran.k@intel.com \
--cc=chethan.tumkur.narayan@intel.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=luiz.von.dentz@intel.com \
--cc=ravishankar.srivatsa@intel.com \
/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;
as well as URLs for NNTP newsgroup(s).