Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp6860431rwd; Mon, 19 Jun 2023 13:44:39 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6HSOBT3mDo0cACxpxNlgbRR8wc/bgrulElO0lUvPf2us2zwXSoG6ocYIUCX/4vy55PRW1y X-Received: by 2002:a17:90a:9606:b0:259:a7a6:26f9 with SMTP id v6-20020a17090a960600b00259a7a626f9mr21469000pjo.21.1687207478774; Mon, 19 Jun 2023 13:44:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687207478; cv=none; d=google.com; s=arc-20160816; b=XkprEiRhCPWOfUQoUdZPQLC4KAg9U2gsII0W0GvcxAcsX8Ax/IbHWWO2EeA2QrVp1u YdqFJ0M9DmOMN4GKhrVXslRIPgjBPyIw3HDCM6OWU+nREb5RCp/ESf1Zs6fTyr1ab9/2 IMLt1eI0u50Y6zfkS43t6fyFZ2NkbP9Fn0hoB0I26T8ELeyKw4ZziCdj6qP+cXe4nfZS g0GvcPfhbSvMf+BUCxjw8nJrmPaqzc3LAKz4jBnWAD+l2GpWWwIfdZ3Gu0m9dl0W11du 5BSsihZkwpzWVPJjCcvfpq+TRMhAHmHvxAoFvtRliLZPZaad8DzzaQDl+N55fYnQsfXf B74Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=PgesgxoUiEnt7JhH7f+sQVTH/hKqR6THmg+oGF3TcV4=; b=j0zwxklxYhQSFMgC6MfNMsvB9TevvSvhjyHMq6GfT3n/x6ZW5do8ZPAVG+tsZHujdj XLgfcfiTvQEvuO9v2WxF88r6PVT4Xj0p0MmqbW26Tt7cD+uzsgJIVh3QgeTjbAVx5NrJ bM78TbKr626BnZFGv+PeaYoEUuhYFX64sAY+8zKD+yHuW8WUW0Xe1GQa/BLW+ZTfKd7Q Yb8KR63dBnESaCUEMPDEoCjonUYO9nFE+o159Nk3SqaUXfbO1QYqBSeTl9XaEnNnvYnl HhfZBdH/ZRMYtCCT6XfiEo2vnTZtnxuSIeAeW7CzI8/ogojIdAbZhwqu1odayejju7wf U7ig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=lAhuWM4f; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lw13-20020a17090b180d00b0025bc4b71dd5si515171pjb.150.2023.06.19.13.44.23; Mon, 19 Jun 2023 13:44:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=lAhuWM4f; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229940AbjFSUap (ORCPT + 99 others); Mon, 19 Jun 2023 16:30:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229929AbjFSUao (ORCPT ); Mon, 19 Jun 2023 16:30:44 -0400 Received: from mail-pg1-x52b.google.com (mail-pg1-x52b.google.com [IPv6:2607:f8b0:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C626E4A for ; Mon, 19 Jun 2023 13:30:43 -0700 (PDT) Received: by mail-pg1-x52b.google.com with SMTP id 41be03b00d2f7-52cb8e5e9f5so2465555a12.0 for ; Mon, 19 Jun 2023 13:30:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687206642; x=1689798642; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=PgesgxoUiEnt7JhH7f+sQVTH/hKqR6THmg+oGF3TcV4=; b=lAhuWM4fk6unp83MvzpBW17Lnxy/Trv/NNl/GQDWAEDIK6ZOW7EQyT1v4nPUuxTJk3 107IcfIufe+ZxLO+sfgoaIALj+PwfpDXw89V/BpwMLTGLGrU2z2kitK2bsqBk/rrQrgt C4Lbsm7zIi0gk7n/rObRELTCoNJuJdpDYxkSmAAgLx7821NQumpmp9ckg0bFlxsLwLoM TSrQS3hx8j5XwRIAAaAyG6rpdDZjo0vagBELEGRXd8mM7pthTG4aCuwjNrboothMGZoA jz4+qSI0yMLSJzccjzSZqCmLGxLBMsOvnMNGI/VR+ysNYDA22Bjfv+wiCuyw5smMofOb +EOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687206642; x=1689798642; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PgesgxoUiEnt7JhH7f+sQVTH/hKqR6THmg+oGF3TcV4=; b=NZkb6IaVzIrjDBYQYF0AHiBNchcoYXGf0Z0MsI2MiOx9W4mE1ascN3Famskr8AMh3R ES1Ic1FrJvKZg0obnsyREaLxGK7FmuUV5J7h1xUKEtuFc1saJui960IsO9CWuOyu9xTn LMArgMeniR2GWaNZ6yiJgCwNS57Z+I9kq+Au7Vt7aQ9ByhadO0AM2c+6wzAEp5IYjgK4 jyUl3n8FZTnpN2g+kx9W9V8RJLMu5YnkG+wKVelvebQD1rYA0YnNgQkHnpROct0qdF1Y popOHxjoQrrsHNopH5iE4AwWnMpXVNvYuKLhLr/B5sqXW4YBc1+N0YDVvIhDeF+6xokv 354Q== X-Gm-Message-State: AC+VfDxGknnGNxjvPyJpIYEOTcxR5HBhS2q1mziScoE1IpZxotDVEGwy QOPcgFurcW/QRI9NrAznXrgAtau24AoQww== X-Received: by 2002:a17:90a:bb09:b0:25e:d6f0:f0a5 with SMTP id u9-20020a17090abb0900b0025ed6f0f0a5mr9231343pjr.19.1687206641711; Mon, 19 Jun 2023 13:30:41 -0700 (PDT) Received: from lvondent-mobl3.. (c-71-59-129-171.hsd1.or.comcast.net. [71.59.129.171]) by smtp.gmail.com with ESMTPSA id ju18-20020a170903429200b001b045c9ababsm202714plb.264.2023.06.19.13.30.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Jun 2023 13:30:40 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ 5/5] shared/bap: Pass bcode as a reference instead of value Date: Mon, 19 Jun 2023 13:30:32 -0700 Message-Id: <20230619203032.6812-5-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230619203032.6812-1-luiz.dentz@gmail.com> References: <20230619203032.6812-1-luiz.dentz@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz This makes bcode field a pointer which makes it simpler to detect when it is set and also fixes the usage of util_iov_free which expects it to be allocated. --- profiles/audio/bap.c | 12 +++++------- src/shared/bap.h | 2 +- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c index f3564c9e8..8e2fc1556 100644 --- a/profiles/audio/bap.c +++ b/profiles/audio/bap.c @@ -427,12 +427,9 @@ static int parse_properties(DBusMessageIter *props, struct iovec **caps, dbus_message_iter_get_basic(&value, &qos->bcast.timeout); } else if (!strcasecmp(key, "BroadcastCode")) { - struct iovec *iov; - if (var != DBUS_TYPE_ARRAY) goto fail; - iov = &qos->bcast.bcode; - parse_array(&value, &iov); + parse_array(&value, &qos->bcast.bcode); } dbus_message_iter_next(props); @@ -624,7 +621,7 @@ static void ep_free(void *data) util_iov_free(ep->caps, 1); util_iov_free(ep->metadata, 1); if (bt_bap_stream_get_type(ep->stream) == BT_BAP_STREAM_TYPE_BCAST) - util_iov_free(&ep->qos.bcast.bcode, 1); + util_iov_free(ep->qos.bcast.bcode, 1); free(ep->path); free(ep); } @@ -1268,7 +1265,8 @@ static void bap_create_bcast_io(struct bap_data *data, struct bap_ep *ep, iso_qos.bcast.packing = ep->qos.bcast.packing; iso_qos.bcast.framing = ep->qos.bcast.framing; iso_qos.bcast.encryption = ep->qos.bcast.encryption; - memcpy(iso_qos.bcast.bcode, ep->qos.bcast.bcode.iov_base, 16); + if (ep->qos.bcast.bcode) + memcpy(iso_qos.bcast.bcode, ep->qos.bcast.bcode->iov_base, 16); iso_qos.bcast.options = ep->qos.bcast.options; iso_qos.bcast.skip = ep->qos.bcast.skip; iso_qos.bcast.sync_timeout = ep->qos.bcast.sync_timeout; @@ -1811,7 +1809,7 @@ static struct btd_profile bap_profile = { .disconnect = bap_disconnect, .adapter_probe = bap_adapter_probe, .adapter_remove = bap_adapter_remove, - .auto_connect = true, + .auto_connect = false, .experimental = true, }; diff --git a/src/shared/bap.h b/src/shared/bap.h index 8fc41864a..50b567663 100644 --- a/src/shared/bap.h +++ b/src/shared/bap.h @@ -79,7 +79,7 @@ struct bt_bap_bcast_qos { uint8_t packing; uint8_t framing; uint8_t encryption; - struct iovec bcode; + struct iovec *bcode; uint8_t options; uint16_t skip; uint16_t sync_timeout; -- 2.40.1