Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp4698082rwe; Tue, 30 Aug 2022 15:21:48 -0700 (PDT) X-Google-Smtp-Source: AA6agR5qbn4lbWLu7gHjYo5C47wbjvxW4X83KSaLk7jfB+fyBwlijJ+AjM469Qdjho/rUrdm5kh1 X-Received: by 2002:a17:90a:c782:b0:1fb:307f:7cbd with SMTP id gn2-20020a17090ac78200b001fb307f7cbdmr192121pjb.14.1661898108561; Tue, 30 Aug 2022 15:21:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661898108; cv=none; d=google.com; s=arc-20160816; b=l6cBXUatn8rtFDST9/usUemkwPs6P6f2R6QY+qaZIOgZ/hOoS504zOdd3NFcAFj5W7 Qh+RW7WayDbcMYYS4K1kRFyprAcUlg5BHIksIivKwBrgalAxgtYR5OoH7kJMVxFf/VZX 89+1dKRcX/xHVgUQqrbffMhys92aYeIXT6DIiLSF+k3VHJKtzdsjaRVwvaOd6tVSZKTf YYXv2BQ4e5iiiufSySVniAPLBvgWxCLh1cjNyKMKuwg+q/INZAZ8Cscx0NTYcJfe6Ykd 2NWuE0oowZMPF+IbEDcsETn3Qu7n/d3Y7l2BHzbJVUmgNeNoiXcUwJKCEdeQG/FSEY4e Uz5Q== 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 :message-id:date:subject:to:from:dkim-signature; bh=TucAG9rZhLPFUqqSZyFxm7GU+bmlAjsdmyZ0/Tfa2uA=; b=JuipOvbXE8czGTf+nu5KIYnDud6AiDHEtUjMuW2G++i6sr7fXqJjvGiNq1FVGrsOQF VevBFjVEufu8LMbgGL3BAYi1goAqemL2BdmTD38ctIXpiq2w6OLt3ypBwyXVM7fZPzaK 69DDApJW4ZlGVmloWkh72bdOpdEq9blvWoXi/D/VlDSsBME3/QIzp90scIgUcVm6flBJ GZpl1AHieLy8+9kGBwk0zi6d7oTs5ioqewm4JCwdtnXqLzn5+LC4W3h3ruYo5V2pvS2K 4l55ulFmmAD9XAP+bZFtOMpFjmoSxJdjZzE4CWXiwS3gESMYuWbICM8ugFhMAZXGekUE AOJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=cPbsCO+7; 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 c3-20020a170902f30300b00173324b1981si7776910ple.59.2022.08.30.15.21.10; Tue, 30 Aug 2022 15:21:48 -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=20210112 header.b=cPbsCO+7; 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 S231775AbiH3WAV (ORCPT + 99 others); Tue, 30 Aug 2022 18:00:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231741AbiH3V7s (ORCPT ); Tue, 30 Aug 2022 17:59:48 -0400 Received: from mail-qv1-xf2a.google.com (mail-qv1-xf2a.google.com [IPv6:2607:f8b0:4864:20::f2a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F53061129 for ; Tue, 30 Aug 2022 14:55:39 -0700 (PDT) Received: by mail-qv1-xf2a.google.com with SMTP id x14so5302133qvr.6 for ; Tue, 30 Aug 2022 14:55:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc; bh=TucAG9rZhLPFUqqSZyFxm7GU+bmlAjsdmyZ0/Tfa2uA=; b=cPbsCO+7rmlvgOIADR8DqGb2ALwCbYCcHxyAV5FToS/AQT3+nFDJ0RDxmlP8Ivmh1t DNo/tE7kBZt9fMkaciKAREBbL69T1/LQpbis3CNomX1mNK/L8fDNKb55ToNGp6sUyTIP k9V5/8dBuoo8JR5NyTJWIjG2bE+l0C89R06Mmryweza+MwxuBXT/4UE7m9fueTvLOwq9 U+AsGZ9no3uEh3itQI7ObxyOh9TpCGy0dspxbP9le0swOObRwl97lR/IqG4WwZkEFZt0 y2rHkb7FoIFeUcZ3zps1QFPrEirUAPQRGl+mXpOwRREWDBbCRkg58uGtNsACpbQuLgRF KlRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc; bh=TucAG9rZhLPFUqqSZyFxm7GU+bmlAjsdmyZ0/Tfa2uA=; b=KfTu29aHvPbA/ojJ+nqvr+iZCL4RDErdRtLbom2CIBElMHu2I4AFOoXthlXcJ0NMtN ulEjdrUfiJTStOXgOtA2maGiDBnZK7VMmHOqEXSPKwIihsmlmwVsNnsYTyhwx4A6WxRJ M3hfkSRqJQF9A3pP/hI+BkK5KcUa9Sgx/WEjopWVJlnhltoUA2lBkmJZSehuATp7o/M4 AWPfzUw83jKQEmWYhCMEp4gCO7xvKpjBoTqrFn3Xm3TprhBEp92qLoSaKBwndo5+InQj e4wvTuqhWhR83ZKE4yoDxI2UAHGJ7aGYCXXKYve1ai2qAhwZhQfAKeWJXouEXSzru19Q BnrQ== X-Gm-Message-State: ACgBeo0Q/XJfS+9B4pAUxN+AIarflkEETwbBpT419UOpUCSegb91vcQU mSCOkzsSt+MEc2n3T5fCh8PS0ExJcrc= X-Received: by 2002:a05:6214:21e4:b0:499:3a0:47fd with SMTP id p4-20020a05621421e400b0049903a047fdmr9626444qvj.61.1661896486559; Tue, 30 Aug 2022 14:54:46 -0700 (PDT) Received: from lvondent-mobl4.. (c-71-56-157-77.hsd1.or.comcast.net. [71.56.157.77]) by smtp.gmail.com with ESMTPSA id y6-20020ae9f406000000b006baef6daa45sm8644289qkl.119.2022.08.30.14.54.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Aug 2022 14:54:46 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH BlueZ] media: Fix registering PAC endpoints if ISO socket are not supported Date: Tue, 30 Aug 2022 14:54:44 -0700 Message-Id: <20220830215444.1141653-1-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.37.2 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 If adapter don't support ISO sockets the PAC UUIDs shall not be allowed to be registered as they depend on ISO sockets to work properly. --- profiles/audio/media.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/profiles/audio/media.c b/profiles/audio/media.c index 85278a6d9be4..a7fa85d60310 100644 --- a/profiles/audio/media.c +++ b/profiles/audio/media.c @@ -1254,20 +1254,23 @@ static bool endpoint_properties_get(const char *uuid, return true; } -static bool endpoint_supported(void) +static bool endpoint_supported(struct btd_adapter *adapter) { return true; } -static bool experimental_endpoint_supported(void) +static bool experimental_endpoint_supported(struct btd_adapter *adapter) { + if (!btd_adapter_has_exp_feature(adapter, EXP_FEAT_ISO_SOCKET)) + return false; + return g_dbus_get_flags() & G_DBUS_FLAG_ENABLE_EXPERIMENTAL; } static struct media_endpoint_init { const char *uuid; bool (*func)(struct media_endpoint *endpoint, int *err); - bool (*supported)(void); + bool (*supported)(struct btd_adapter *adapter); } init_table[] = { { A2DP_SOURCE_UUID, endpoint_init_a2dp_source, endpoint_supported }, { A2DP_SINK_UUID, endpoint_init_a2dp_sink, endpoint_supported }, @@ -1315,6 +1318,9 @@ media_endpoint_create(struct media_adapter *adapter, for (i = 0; i < ARRAY_SIZE(init_table); i++) { init = &init_table[i]; + if (!init->supported(adapter->btd_adapter)) + continue; + if (!strcasecmp(init->uuid, uuid)) { succeeded = init->func(endpoint, err); break; @@ -2971,6 +2977,7 @@ static const GDBusMethodTable media_methods[] = { static gboolean supported_uuids(const GDBusPropertyTable *property, DBusMessageIter *iter, void *data) { + struct media_adapter *adapter = data; DBusMessageIter entry; size_t i; @@ -2980,7 +2987,7 @@ static gboolean supported_uuids(const GDBusPropertyTable *property, for (i = 0; i < ARRAY_SIZE(init_table); i++) { struct media_endpoint_init *init = &init_table[i]; - if (init->supported()) + if (init->supported(adapter->btd_adapter)) dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, &init->uuid); } -- 2.37.2