shared/bap: Fix handling for Company ID and Vendor Codec ID
authorAbhay Maheta <abhay.maheshbhai.maheta@intel.com>
Thu, 29 Dec 2022 15:52:55 +0000 (21:22 +0530)
committerAyush Garg <ayush.garg@samsung.com>
Fri, 5 Jan 2024 10:11:34 +0000 (15:41 +0530)
This adds fixes for handing for Company ID and Vendor Codec ID
while adding PAC record to database and responding to Attribute
Read Request for Sink/Source PAC Characteristics.

src/shared/bap.c
src/shared/bap.h

index 2919f24..0cafb75 100644 (file)
@@ -344,6 +344,8 @@ static void pac_foreach(void *data, void *user_data)
 
        p = util_iov_push(iov, sizeof(*p));
        p->codec.id = pac->codec.id;
+       p->codec.cid = pac->codec.cid;
+       p->codec.vid = pac->codec.vid;
 
        if (pac->data) {
                p->cc_len = pac->data->iov_len;
@@ -2383,6 +2385,9 @@ struct bt_bap_pac *bt_bap_add_vendor_pac(struct gatt_db *db,
        if (!bdb)
                return NULL;
 
+       if ((id != 0xff) && ((cid != 0U)  || (vid != 0U)))
+               return NULL;
+
        codec.id = id;
        codec.cid = cid;
        codec.vid = vid;
index 3558d04..47a1563 100644 (file)
@@ -39,8 +39,8 @@ struct bt_bap_stream;
 
 struct bt_bap_codec {
        uint8_t  id;
-       uint16_t vid;
        uint16_t cid;
+       uint16_t vid;
 } __packed;
 
 struct bt_ltv {