Bluetooth: Read list of local codecs supported by the controller
authorMarcel Holtmann <marcel@holtmann.org>
Wed, 23 Jul 2014 17:24:56 +0000 (19:24 +0200)
committerJohan Hedberg <johan.hedberg@intel.com>
Wed, 23 Jul 2014 17:34:06 +0000 (20:34 +0300)
If the Bluetooth controller supports Read Local Supported Codecs
command, then issue it during initialization so that the list of
codecs is known.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
include/net/bluetooth/hci.h
net/bluetooth/hci_core.c

index f0a3d88907605eab81264a8a9ee10a07ef32cce1..5d30919eaba94ffb3c9a6ffe8757b3b24635582c 100644 (file)
@@ -1074,6 +1074,8 @@ struct hci_rp_read_data_block_size {
        __le16   num_blocks;
 } __packed;
 
+#define HCI_OP_READ_LOCAL_CODECS       0x100b
+
 #define HCI_OP_READ_PAGE_SCAN_ACTIVITY 0x0c1b
 struct hci_rp_read_page_scan_activity {
        __u8     status;
index cfcb6055ced8f21df5f559484ac910d0e25e965e..f3e14103b76be31d31e7be7cff6c431478a7d1bd 100644 (file)
@@ -1686,6 +1686,10 @@ static void hci_init4_req(struct hci_request *req, unsigned long opt)
        if (hdev->commands[22] & 0x04)
                hci_set_event_mask_page_2(req);
 
+       /* Read local codec list if the HCI command is supported */
+       if (hdev->commands[29] & 0x20)
+               hci_req_add(req, HCI_OP_READ_LOCAL_CODECS, 0, NULL);
+
        /* Check for Synchronization Train support */
        if (lmp_sync_train_capable(hdev))
                hci_req_add(req, HCI_OP_READ_SYNC_TRAIN_PARAMS, 0, NULL);