Commit 107fe048 authored by Kiran K's avatar Kiran K Committed by Marcel Holtmann

Bluetooth: Read codec capabilities only if supported

Read codec capabilities only if HCI_READ_LOCAL_CODEC_CAPABILITIES
command is supported. If capablities are not supported, then
cache codec data without caps.
Signed-off-by: default avatarKiran K <kiran.k@intel.com>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent 83775456
...@@ -25,9 +25,11 @@ static int hci_codec_list_add(struct list_head *list, ...@@ -25,9 +25,11 @@ static int hci_codec_list_add(struct list_head *list,
} }
entry->transport = sent->transport; entry->transport = sent->transport;
entry->len = len; entry->len = len;
entry->num_caps = rp->num_caps; entry->num_caps = 0;
if (rp->num_caps) if (rp) {
entry->num_caps = rp->num_caps;
memcpy(entry->caps, caps, len); memcpy(entry->caps, caps, len);
}
list_add(&entry->list, list); list_add(&entry->list, list);
return 0; return 0;
...@@ -58,6 +60,18 @@ static void hci_read_codec_capabilities(struct hci_dev *hdev, __u8 transport, ...@@ -58,6 +60,18 @@ static void hci_read_codec_capabilities(struct hci_dev *hdev, __u8 transport,
__u32 len; __u32 len;
cmd->transport = i; cmd->transport = i;
/* If Read_Codec_Capabilities command is not supported
* then just add codec to the list without caps
*/
if (!(hdev->commands[45] & 0x08)) {
hci_dev_lock(hdev);
hci_codec_list_add(&hdev->local_codecs, cmd,
NULL, NULL, 0);
hci_dev_unlock(hdev);
continue;
}
skb = __hci_cmd_sync(hdev, HCI_OP_READ_LOCAL_CODEC_CAPS, skb = __hci_cmd_sync(hdev, HCI_OP_READ_LOCAL_CODEC_CAPS,
sizeof(*cmd), cmd, sizeof(*cmd), cmd,
HCI_CMD_TIMEOUT); HCI_CMD_TIMEOUT);
......
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