Received: by 2002:a05:7412:ba23:b0:fa:4c10:6cad with SMTP id jp35csp1064820rdb; Fri, 19 Jan 2024 07:12:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IG36i9Iw5Abnci2ZbscwABGiG7zp1MxhR+7kR/eXukiUWEjGVWgPDZlgsd+sgdMvv/z+3EQ X-Received: by 2002:a17:90a:9a9:b0:290:36a2:fa6b with SMTP id 38-20020a17090a09a900b0029036a2fa6bmr27253pjo.17.1705677145538; Fri, 19 Jan 2024 07:12:25 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705677145; cv=pass; d=google.com; s=arc-20160816; b=QYpiNHfTmEx68TNeu4T5cEAC0mPnLiO9gSdgHrztFG4L9Kw7Kn/8fCHC/Olf+BaBvD mNQrKR9ZSLX6sAcEog9DfLvfqwpiGVRaqGjWH1c2QimtURhy0dS5D166AhPVHruyqPxd xO8hSRL1H8k9RkP1YFxQyOREvf/p3SiCQTW+caar++3QFQQfkOrt+7xVdrc/BIPOOVSm MAr0aCAsUIvERCqDXgZje0Z1MkQdf1kMum+ELiE7lkNtJ83eL6kvZBnkodpD2M3Su0uI /cELPQ7x/NkEZ0Deo6BsY4RdV5nvODeMSlKJzhzoGjpMi/hyA0DT4bGryvF6/Pp/Mzo8 qEBw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=dypkvvb1rjZx1eTM7p7HScF6sNLIWiTPsbmKYQYD3Rg=; fh=xJv+Klyytov3KGiQwAoOi4HC6j6hVaI+tOcmqPTIfBg=; b=n9+VJXEHICUGHfY0mvdqT41ZruVDfRP2X6VgpC3cyyBznNhIfDtWpZLqxQn1WIq1/e ehCvTF37ahVF5SukhT8m3uBjPz4EWxHmgZppyLfc8k3UCNqlSmp1C2hI1+j8JnjrDTNv go6kn81IKUF2lqjfnlsudVvmZ+SthaFlDxqutxuQ7OhFxJevt4inqMiMtObY5CBetbSF 1A33JwCIg0ZlvcSxmdF/T3K1PslE9k4IVnf9VNJ5C2kZ/t7a+PhvS0WEafTkGYBlDbf9 kDN96VgJ4CH4g/oJXgkLnaBjerzUUqTZYVhjgX61LLpn8F7bBjzgXR3nKQT/QSd9H/8U trNA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=jQVGDSHi; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-bluetooth+bounces-1204-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-1204-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id v11-20020a17090ad58b00b0028df10dc333si3483806pju.76.2024.01.19.07.12.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jan 2024 07:12:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-bluetooth+bounces-1204-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=jQVGDSHi; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-bluetooth+bounces-1204-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-1204-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 5A1C4B2279A for ; Fri, 19 Jan 2024 15:12:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 55E675467B; Fri, 19 Jan 2024 15:12:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="jQVGDSHi" X-Original-To: linux-bluetooth@vger.kernel.org Received: from mail-lj1-f175.google.com (mail-lj1-f175.google.com [209.85.208.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 276B75467F for ; Fri, 19 Jan 2024 15:12:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705677134; cv=none; b=t1i8eaRU6fIjxR3QFj2d6DWr10m7h8LjKC8yrjNgyGbsVW/ASrDav7zgoGWnG9250dakUT0FU9mE0ZtVgAism8eZB4IDpyb/z+RZ9YKWo2rBzvr227ByljuvATls7qZBkQVdMyBU8ZFF5QDRIA8CrosBMCq1uYoy+knz/g2qlGs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705677134; c=relaxed/simple; bh=VeWYgV1pyEyf7jAmLV16uzlDQc1jrQac+asXwi+/gIU=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=Ak7H1EPs1flhpWRwM3nF6BhUJFZfFnx1k1sFGvIsPh46VoM2jIglMCcpQqOoXRj4NVmTNBGhQXB6EIu1cgmS9mk7VEA/TOKvbnnjb7AqvuWVd58qEKyNjmIrIS4H0eGGSGGHw3adbLFWlmtXpKw/i6tGT8yReSbSaGa7qQqxMn4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=jQVGDSHi; arc=none smtp.client-ip=209.85.208.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lj1-f175.google.com with SMTP id 38308e7fff4ca-2ccea11b6bbso9041151fa.0 for ; Fri, 19 Jan 2024 07:12:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705677131; x=1706281931; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=dypkvvb1rjZx1eTM7p7HScF6sNLIWiTPsbmKYQYD3Rg=; b=jQVGDSHiMvBTOLZLz+vByRgWSbUEiOgoUYg/zRLe5/1/0uyy1S0BmyIFAdN6HsCdx6 yBZUemnFkZ/RPbXd09OwC2fJhOSS9lphQ3/eER1GH1OGLnpovv2bq8h+rsmDzOJvPIqh tw7U8IjKgNOpNuP5SFpo3om98YhvQVsQTFMwfctytZP0R0ncksUg0nvXxO/fiDvIWU85 6TGKKUGAY+u3mERAQTIgk3QfhoLXRMWjqdS3UO+vTlCW2OmeQYMTACWtd8xIzvYcmW6w DraSf/a9kAyE1teQdti9ac4z4wBTzLyQuuxJjoAX/OpAhzCYbWTovdoyL9yNj8GkC21i igKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705677131; x=1706281931; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dypkvvb1rjZx1eTM7p7HScF6sNLIWiTPsbmKYQYD3Rg=; b=K/hjXgx9LIWIg+ild2uDin9EQWpC3tmvCizEZP6R5+3IuijI+tETKbxUfg4exmsD3b 3/U+Tx5Gss+1rLquTzCGlw3RzBTKyQUqBKSGuELzaQDM4Ka3h6TKLvwayRep/N+2MQ+x NfbQcalkmRP81Vh+Zu0ONmHRiVnoH4YQlJG55MF0+qhlzwa729x/t7pAIW1vWKkerUQJ Y3jz1zlMJxSgCM02oVxjo0/+Hv9y9bNJTsQa4ONVjXbdJ8T74ABog9eWrBBKJjVHzxtR khFgJFiYxFBMDqGhm4SbaRqrmJ6jJzhLr9UGHgzp9iXO6mzxOls7lUxlXKBS9FrT2XEi tjnA== X-Gm-Message-State: AOJu0YzbL4ohqfNSfDy4SVxLMpovYN9GAIngro+27iDJXjAmqfHuZfzH iHbeZcj+lTfyvUeTKDxyTIAQGU0U6yOtIXz7hU9Sy4/3VqYWMn6PVpNMH57bDtjjzGSCprxiV7l xsrEnGWtPA/bR+TnvEv9UoNg2U14K03Cgcak= X-Received: by 2002:a2e:bcc2:0:b0:2cd:8ec5:87d2 with SMTP id z2-20020a2ebcc2000000b002cd8ec587d2mr31238ljp.0.1705677131081; Fri, 19 Jan 2024 07:12:11 -0800 (PST) Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240119150443.3163-1-iulia.tanasescu@nxp.com> <20240119150443.3163-2-iulia.tanasescu@nxp.com> In-Reply-To: <20240119150443.3163-2-iulia.tanasescu@nxp.com> From: Luiz Augusto von Dentz Date: Fri, 19 Jan 2024 10:11:58 -0500 Message-ID: Subject: Re: [PATCH BlueZ 1/1] bap: Fix bcast endpoint config To: Iulia Tanasescu Cc: linux-bluetooth@vger.kernel.org, claudia.rosu@nxp.com, mihai-octavian.urzica@nxp.com, silviu.barbulescu@nxp.com, vlad.pruteanu@nxp.com, andrei.istodorescu@nxp.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Iulia, On Fri, Jan 19, 2024 at 10:04=E2=80=AFAM Iulia Tanasescu wrote: > > This updates the way broadcast is differentiated from unicast > at endpoint configuration: Instead of checking if setup->base > is allocated, check lpac type. > > --- > profiles/audio/bap.c | 39 ++++++++++++++++++--------------------- > 1 file changed, 18 insertions(+), 21 deletions(-) > > diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c > index b88876485..137ed7d39 100644 > --- a/profiles/audio/bap.c > +++ b/profiles/audio/bap.c > @@ -4,7 +4,7 @@ > * BlueZ - Bluetooth protocol stack for Linux > * > * Copyright (C) 2022 Intel Corporation. All rights reserved. > - * Copyright 2023 NXP > + * Copyright 2023-2024 NXP > * > * > */ > @@ -617,15 +617,16 @@ static int parse_bcast_qos(const char *key, int var= , DBusMessageIter *iter, > return 0; > } > > -static int parse_qos(DBusMessageIter *iter, struct bt_bap_qos *qos, > - struct iovec **base) > +static int parse_qos(DBusMessageIter *iter, uint8_t pac_type, > + struct bt_bap_qos *qos) > { > DBusMessageIter array; > const char *key; > int (*parser)(const char *key, int var, DBusMessageIter *iter, > struct bt_bap_qos *qos); > > - if (*base) > + if ((pac_type =3D=3D BT_BAP_BCAST_SOURCE) || > + (pac_type =3D=3D BT_BAP_BCAST_SINK)) > parser =3D parse_bcast_qos; > else > parser =3D parse_ucast_qos; > @@ -656,9 +657,9 @@ static int parse_qos(DBusMessageIter *iter, struct bt= _bap_qos *qos, > return 0; > } > > -static int parse_configuration(DBusMessageIter *props, struct iovec **ca= ps, > - struct iovec **metadata, struct iovec **b= ase, > - struct bt_bap_qos *qos) > +static int parse_configuration(DBusMessageIter *props, uint8_t pac_type, > + struct iovec **caps, struct iovec **metad= ata, > + struct iovec **base, struct bt_bap_qos *q= os) > { > const char *key; > struct iovec iov; > @@ -686,6 +687,12 @@ static int parse_configuration(DBusMessageIter *prop= s, struct iovec **caps, > > util_iov_free(*caps, 1); > *caps =3D util_iov_dup(&iov, 1); > + > + /* Currently, the base iovec only duplicates > + * setup->caps. TODO: Dynamically generate > + * base using received caps. > + */ > + *base =3D util_iov_dup(*caps, 1); > } else if (!strcasecmp(key, "Metadata")) { > if (var !=3D DBUS_TYPE_ARRAY) > goto fail; > @@ -699,24 +706,13 @@ static int parse_configuration(DBusMessageIter *pro= ps, struct iovec **caps, > if (var !=3D DBUS_TYPE_ARRAY) > goto fail; > > - if (parse_qos(&value, qos, base)) > + if (parse_qos(&value, pac_type, qos)) > goto fail; > } > > dbus_message_iter_next(props); > } > > - if (*base) { > - uint32_t presDelay; > - uint8_t numSubgroups, numBis; > - struct bt_bap_codec codec; > - > - util_iov_memcpy(*base, (*caps)->iov_base, (*caps)->iov_le= n); > - parse_base((*caps)->iov_base, (*caps)->iov_len, bap_debug= , > - &presDelay, &numSubgroups, &numBis, &codec, > - caps, NULL); > - } > - > return 0; > > fail: > @@ -882,8 +878,9 @@ static DBusMessage *set_configuration(DBusConnection = *conn, DBusMessage *msg, > setup->qos.ucast.cis_id =3D BT_ISO_QOS_CIS_UNSET; > } > > - if (parse_configuration(&props, &setup->caps, &setup->metadata, > - &setup->base, &setup->qos) < 0) { > + if (parse_configuration(&props, bt_bap_pac_get_type(ep->lpac), > + &setup->caps, &setup->metadata, &setup->b= ase, > + &setup->qos) < 0) { > DBG("Unable to parse configuration"); > setup_free(setup); > return btd_error_invalid_args(msg); > -- > 2.39.2 I sort of did the same thing but end up refactoring the code in the process= : https://patchwork.kernel.org/project/bluetooth/list/?series=3D817943 So it's worth checking if I didn't break it further. --=20 Luiz Augusto von Dentz