Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp790132ybh; Wed, 15 Jul 2020 15:40:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwpQ5Eq9uOj7h+30EghQpVV4NRFG3yLQXMKYDuBZb/uD4qJovHlLNuuDiDymqKmsROxyGWP X-Received: by 2002:a17:907:7245:: with SMTP id ds5mr1063731ejc.1.1594852838000; Wed, 15 Jul 2020 15:40:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594852837; cv=none; d=google.com; s=arc-20160816; b=pA01i2GL+cvJeerYDhCx0rg/qTO5WS6N6o6EvVFN0NZORGqIY1b/RrCNRhT6Vzmeyt RHlj38hYTY6Q57a3DliG02/SmvbKYSTJTbYy3nmukZC9rdV9x1z1WpRPl41GyqKdOyp5 C9CDCqIxtgUNhKtD5385Z0wJ8QWguG5170GNSZxf9AFCVpalomyV9VKmBgXsyO57O0iE ComYq3nm2RS69dzut3rQsnIp/lvkYCLC3XM9BWG+LOd4CQRilhwigg9iwOurHDlnIRkZ zFZr9+iJCER0bO5L3NX09eRWHvlZK9wzgl3o2LJ1cJ2BklO18shm7hfielCEMzPbqf2w brGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=QN6u4lUItqEbRecJZob9CnZ8D7gORmssXE47u/uPVag=; b=knMjAVWEPsk38FE01HqmwKENRdNTzu16CprOwoAryLbJkLYCKcTJu8zEVyigvIWkVn 13w22m5pmM9olQx7CISgXIz2zJ13JW19KP1KOaBo+TLMixKZmZt+pM3biQ+j/hTkjpia pfLTM7YUqn0eyEky+mpisUvo6iG0j0FSBRL5ZVGsOwr5tFVgJRmoRiKEdBTPx1zAsdih s4bYSuFna3toxF90InqHyDGsmimFEAjQhz+WDo5h3tXFwYkvIFRvmiSFqXDdBzQhBHGv N9O2nCYmgl/ACVkGk23lGH1QaMYDkppo/5wFGf+lEEfWEza2MTwc/mYS0EbEYVLCxD2X xATg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="ByQyMjc/"; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v6si1986766ejw.169.2020.07.15.15.40.09; Wed, 15 Jul 2020 15:40:37 -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=@gmail.com header.s=20161025 header.b="ByQyMjc/"; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726998AbgGOWkF (ORCPT + 99 others); Wed, 15 Jul 2020 18:40:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42502 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726986AbgGOWkF (ORCPT ); Wed, 15 Jul 2020 18:40:05 -0400 Received: from mail-oi1-x241.google.com (mail-oi1-x241.google.com [IPv6:2607:f8b0:4864:20::241]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB342C061755 for ; Wed, 15 Jul 2020 15:40:04 -0700 (PDT) Received: by mail-oi1-x241.google.com with SMTP id h17so3546668oie.3 for ; Wed, 15 Jul 2020 15:40:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=QN6u4lUItqEbRecJZob9CnZ8D7gORmssXE47u/uPVag=; b=ByQyMjc/bt5tEsHpQlc/V1P6wi4kdox1kZnT7+Yic+JI61vo5UtKE1YKXmp+8pJpeY tF9ON/ldQ4OaMqy5SqqMOBth5w0Fg5wU6vNNxZqcGcJ9YonKgR+R3/dqyvMPbtOMgzfK cokdXxuB/sy68Lt1yt5/UYscb/mPcYOjMk93asThh9/YD4CfcCkontaXTcjzP80rXfwf WT5EackBPBxwe9om7H7moOuC3pImrSYERwwdb+p+oDfCh8rCdlinbSB4ndsHB0eXsHWk SlePQKN4FdyXbyDpDIuzNRWoeAewHpxiM3rsQkIk5eYzo1YlZFtZa4VvqtamnC2ePXI/ 8JSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=QN6u4lUItqEbRecJZob9CnZ8D7gORmssXE47u/uPVag=; b=Tqx8ALx3SE9PO2Ht3T5zGgc1fc+nCiGKlWFEcYWyxSHlHohH1V8g+KZN9k07eVgPQF djqjFoHWCHIUhmYElE6b+kqWjw3oENdNfWyhTt9GQfDLJJsOechpWPvSw2v43KviSbvF jveqk0Uv5C28dPEfYyfIPCkAe+lWZ7CUD/e/JRgVk5QRm/wWfPIzi6NxUDq6dv+Q/dtH vYoEQOqmd/3MhabR6Mp8wi8SHhwARFcSiUVrSj88DzhuFYTxKGDXQKyKgxJv3L5k4dwX w1nGoshqezPLv45S8wsh19uDDEtqPqkBMlE4dsRVVrpHK3kgVgR3h9M1kDgd8nIUt5+E y4mw== X-Gm-Message-State: AOAM5321bm4yMQYgrbG+kervxqPz1yaH/QC+9f41LIXNyqkBq2EpF2ab aVVfpXt6HTRqO+Ub7Nt3QoLjpLL5liOWDpe0KkdHyql8 X-Received: by 2002:aca:cf81:: with SMTP id f123mr1673052oig.137.1594852804053; Wed, 15 Jul 2020 15:40:04 -0700 (PDT) MIME-Version: 1.0 References: <20200715222812.238172-1-sonnysasaka@chromium.org> In-Reply-To: <20200715222812.238172-1-sonnysasaka@chromium.org> From: Luiz Augusto von Dentz Date: Wed, 15 Jul 2020 15:39:52 -0700 Message-ID: Subject: Re: [PATCH BlueZ] profile: Add exception from being claimed internally To: Sonny Sasaka Cc: "linux-bluetooth@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hi Sonny, On Wed, Jul 15, 2020 at 3:32 PM Sonny Sasaka wrote: > > This adds a flag to give exception to profiles that are considered safe > to be both handled internally and externally via GATT API. Currently > this includes the battery profile. > > --- > profiles/battery/battery.c | 1 + > src/device.c | 2 +- > src/profile.h | 5 +++++ > 3 files changed, 7 insertions(+), 1 deletion(-) > > diff --git a/profiles/battery/battery.c b/profiles/battery/battery.c > index 4da4355a1..20aa47727 100644 > --- a/profiles/battery/battery.c > +++ b/profiles/battery/battery.c > @@ -354,6 +354,7 @@ static struct btd_profile batt_profile = { > .device_remove = batt_remove, > .accept = batt_accept, > .disconnect = batt_disconnect, > + .claim_service_exception = true, > }; > > static int batt_init(void) > diff --git a/src/device.c b/src/device.c > index 0deee2707..cfa52461f 100644 > --- a/src/device.c > +++ b/src/device.c > @@ -3818,7 +3818,7 @@ done: > profile = btd_service_get_profile(service); > > /* Claim attributes of internal profiles */ > - if (!profile->external) { > + if (!profile->external && !profile->claim_service_exception) { The external field was added exactly to allow it to be used externally. > /* Mark the service as claimed by the existing profile. */ > gatt_db_service_set_claimed(attr, true); > } > diff --git a/src/profile.h b/src/profile.h > index 4448a2a6d..25e83381b 100644 > --- a/src/profile.h > +++ b/src/profile.h > @@ -36,6 +36,11 @@ struct btd_profile { > > bool auto_connect; > bool external; > + /* Some profiles are considered safe to be handled internally and also > + * be exposed in the GATT API. This flag give such profiles exception > + * from being claimed internally. > + */ > + bool claim_service_exception; > > int (*device_probe) (struct btd_service *service); > void (*device_remove) (struct btd_service *service); > -- > 2.26.2 > -- Luiz Augusto von Dentz