Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp1560341pxu; Fri, 16 Oct 2020 15:37:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxsRg1+1tOunL7mqMw2SdTpub38jPiXPsWTfKHzC3vUBBnKsNTIiEVBaPh5P6FVXRC3HBn2 X-Received: by 2002:aa7:cd93:: with SMTP id x19mr6282279edv.183.1602887834003; Fri, 16 Oct 2020 15:37:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602887833; cv=none; d=google.com; s=arc-20160816; b=rUx+Dj2z103W2OEFomyqkxg043YMiRuxPMgfBd+3D/oKsPu7ZCQyFPcFa3sIdA9hNo kQNyOWQihC2VEYl38iAZuq33pfTBiOr4hpBU/xFOvBae2Ht474cVo87dLeZHjrCjead8 GKOQ9GrHNXJa2RRQIkYUPtsy/XFx43zmT3uP10ddvCept55DUGySDoQLLIJIHPhYz3Tb Qqpcjv1Nhej/wRdzjUIWUmSU5DVyJ2ZM8AeajryEQjVG/v99WYwAGixxfnaKBUcMX+t1 5FkGUhPoDFI1dPLy8lPKIV4kahv915hNDmm+CNewM/YvDZQ56ZqeEcbV81DViWL+XOe9 fVkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :mime-version:user-agent:date:message-id:to:subject:from :dkim-signature; bh=kt50QO488Fqz+enFM7SXz9VGDepJqY0UVtwdiBU2L1k=; b=kzmqHAF6dx9BJwQG/PGvGuo6YmWZCfFJEhcyY5q7tIEKYvuwwqOF3NqKGB8r0LwF26 bQprsV8+HmnF+jX+sjUuCYWFHsOSxX2lmWkhcj+6v/cBG9N+x1W+NWaVgiAhwpjTHuka Zf++cSQ21vP4oPo96XFIU3O/1Zy1OcPtJsYigmQYgIwY4YHLfxIedC9Ylj746BgUEyFM OCpkF5th4NHkptwKomMyp8G3P6oYxI6KbzkMVqiPKSOaHHbcf4rdJQiLvKfZjozl3K99 Oj6+/8cuZd5xMX3LUbN7yKvqi6Y/+UWlPLB+VPaEhQuuTzbsqZxhfMmzqRRyxUFR5BY1 C8PQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tcd-ie.20150623.gappssmtp.com header.s=20150623 header.b=OG+1REu9; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lx7si2653628ejb.520.2020.10.16.15.36.51; Fri, 16 Oct 2020 15:37:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@tcd-ie.20150623.gappssmtp.com header.s=20150623 header.b=OG+1REu9; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388851AbgJPWJj (ORCPT + 99 others); Fri, 16 Oct 2020 18:09:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388807AbgJPWJi (ORCPT ); Fri, 16 Oct 2020 18:09:38 -0400 Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE235C061755 for ; Fri, 16 Oct 2020 15:09:38 -0700 (PDT) Received: by mail-pg1-x542.google.com with SMTP id x13so2225818pgp.7 for ; Fri, 16 Oct 2020 15:09:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tcd-ie.20150623.gappssmtp.com; s=20150623; h=from:subject:to:message-id:date:user-agent:mime-version :content-language:content-transfer-encoding; bh=kt50QO488Fqz+enFM7SXz9VGDepJqY0UVtwdiBU2L1k=; b=OG+1REu9F2CjqMzMFDA0usIIPphkv/KMq7XSVabVvyMXCY/D/Wyd4kJXoH5Y7Q3nEl LrjKEC3TTsZcR1fL1lNsQFHYpep1QWqZsqRO84aDJiwftCfR6T3mHSCfMWOpu9IgFnWs 10X7REqAtFMTxncqNYAOVeCpDUpwXERQGYyyBqFvD377d9R1GrsjBFkkU433ERf+hYKd K64KmfMHSchzUoqXz3BixSdB6WjqOFb8DmBVAEBep7aB7Di7x5Ux6kIoIfkGyqFdkU+N fHeoTx2mCtfzgQUMjl08uQaaOhH8TdyRZ59AM5fvzVzc79slL/QDcKEqIw+/ihEGIFLe mm8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:message-id:date:user-agent :mime-version:content-language:content-transfer-encoding; bh=kt50QO488Fqz+enFM7SXz9VGDepJqY0UVtwdiBU2L1k=; b=M9/MkD9Djof1fxod3qJjwikFW3jTIPKPDV8onfOf6gf0Zi0yfoAPmvqHjoNO4VJwsG j8sNsPHU0kbfupYLxOrqYjt8KgCTUnUpQYDotzUUs6skeNf3cbxh0Jl4Cn+1cXthEljF /KOYOy8PfsDQ2U4QgJGkKzic9jEunAE4tWQs3a3NsMbT8du2iherzfieQ2HGiGFXaojv d9EwS/3rG2zltprCi2O3GMIMOlq6XWoIjwQKbkfX+bOxcrycFs97Y98p74kRtuh1rC6e qBRFvzlwbEslccy5ktO7Pw5XdaTA6TH4Zz6OW1+MsfWGNVLRcat1ZxueVJ1RfWcnSH5q fuhQ== X-Gm-Message-State: AOAM531DJ7stC/R7uXxiRpOn+ASf+GgO6jh4rkk5ohbbN0/bfd7gJQbO VFXNmST/RJfU2xS1CU0wdy094E2HyCDgsCnS X-Received: by 2002:a65:628f:: with SMTP id f15mr5119328pgv.168.1602886178086; Fri, 16 Oct 2020 15:09:38 -0700 (PDT) Received: from [192.168.2.14] (216-19-182-159.dyn.novuscom.net. [216.19.182.159]) by smtp.gmail.com with ESMTPSA id s20sm3463811pfu.112.2020.10.16.15.09.37 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 16 Oct 2020 15:09:37 -0700 (PDT) From: Peter Mullen Subject: [PATCH BlueZ 2/3] policy: Avoid using UUID if field is not set To: "linux-bluetooth@vger.kernel.org" Message-ID: Date: Fri, 16 Oct 2020 15:09:37 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org --- plugins/policy.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/plugins/policy.c b/plugins/policy.c index dac1b7a24..e156c0db2 100644 --- a/plugins/policy.c +++ b/plugins/policy.c @@ -635,17 +635,19 @@ static void service_cb(struct btd_service *service, struct btd_profile *profile = btd_service_get_profile(service); struct reconnect_data *reconnect; - if (g_str_equal(profile->remote_uuid, A2DP_SINK_UUID)) - sink_cb(service, old_state, new_state); - else if (g_str_equal(profile->remote_uuid, A2DP_SOURCE_UUID)) - source_cb(service, old_state, new_state); - else if (g_str_equal(profile->remote_uuid, AVRCP_REMOTE_UUID)) - controller_cb(service, old_state, new_state); - else if (g_str_equal(profile->remote_uuid, AVRCP_TARGET_UUID)) - target_cb(service, old_state, new_state); - else if (g_str_equal(profile->remote_uuid, HFP_HS_UUID) || - g_str_equal(profile->remote_uuid, HSP_HS_UUID)) - hs_cb(service, old_state, new_state); + if (profile->remote_uuid) { + if (g_str_equal(profile->remote_uuid, A2DP_SINK_UUID)) + sink_cb(service, old_state, new_state); + else if (g_str_equal(profile->remote_uuid, A2DP_SOURCE_UUID)) + source_cb(service, old_state, new_state); + else if (g_str_equal(profile->remote_uuid, AVRCP_REMOTE_UUID)) + controller_cb(service, old_state, new_state); + else if (g_str_equal(profile->remote_uuid, AVRCP_TARGET_UUID)) + target_cb(service, old_state, new_state); + else if (g_str_equal(profile->remote_uuid, HFP_HS_UUID) || + g_str_equal(profile->remote_uuid, HSP_HS_UUID)) + hs_cb(service, old_state, new_state); + } /* * Return if the reconnection feature is not enabled (all @@ -687,7 +689,7 @@ static void service_cb(struct btd_service *service, * be the first profile that's connected so we might have an * entry but with the reconnect flag set to false. */ - if (!reconnect->reconnect) + if (!reconnect->reconnect && profile->remote_uuid) reconnect->reconnect = reconnect_match(profile->remote_uuid); DBG("Added %s reconnect %u", profile->name, reconnect->reconnect); -- 2.28.0