Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp794155ybh; Wed, 15 Jul 2020 15:49:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxPQ5v64Ca3dlHr+llCq+rkp4JDIyepR9IR+Dq7D/4JETTSgN67I+/+gOLG0leB8+mEBHBV X-Received: by 2002:a17:906:b16:: with SMTP id u22mr1086606ejg.53.1594853391879; Wed, 15 Jul 2020 15:49:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594853391; cv=none; d=google.com; s=arc-20160816; b=cUoQ3ugkDjejDGChzoaJAYksg1wUFXxgK6I1odZBssXGeGrIXbLoE3Fwi8ltveP5PX j1ohu8PeiF4mlNq+89rVGl1c25zCXyr47y2tIAPh3hnl/MBZyBj32jM7r1rQf1rSFW3n Nq9eMFa4K0Mx4R8aDULM2GM6+rbvU+hJbmV0zqWY3izmzj2pGJR2sr8TU0EXL7Um5hDf vyxuvbZsP3IJyTpQYEXRfbC6QGn+k5I7HtKF+752Ll6pJlo74NXx15xCDd0v20u9eR+X bJVBqqF07+3RVhKM9eZ2ahJiziKW2AMcQ71Un3UEwpHSq9dMVvNojYZA1G0pUNQoN8TL 6AZQ== 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=4udghYGtUYeaRoul7B0YgVKGSlph/H2QPmKSktA8esE=; b=fg26pCJQ0JP7U02KmEzID1Fe8k07a9L52bmzSDGYW1dbZyZfHYrWzbjnXHcj5dcDg7 y6CrDKE4iFqAA/Y1kuwIFqPIWBWt+OvEL49spDLws3KQMnloEsJ0RSlMB6DfLBfw90yX h+g/o2MrksvtD2yfe4bBRuxQz1dEsObtqzgyZ+709uJfQXFlfIETUM+S3iQHa3e/H+CB 9nNXJq3gaLOHGo6WTUEKhw02RN/3nFGqDYGq3wiq/4zJqPT2Q7AOWEChXVUHXwqzV7PV waSJILl6s3gZCZLsx9G83uwZUO0EQDdbc2/qcmDNOKrE6CFTxh8mZ1+INpGXKfFz2z7v bwNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=ZHQfBgno; 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=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u12si1966043eja.373.2020.07.15.15.49.26; Wed, 15 Jul 2020 15:49:51 -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=@chromium.org header.s=google header.b=ZHQfBgno; 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=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726770AbgGOWtZ (ORCPT + 99 others); Wed, 15 Jul 2020 18:49:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726479AbgGOWtZ (ORCPT ); Wed, 15 Jul 2020 18:49:25 -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 8AE89C061755 for ; Wed, 15 Jul 2020 15:49:25 -0700 (PDT) Received: by mail-oi1-x241.google.com with SMTP id j11so3525509oiw.12 for ; Wed, 15 Jul 2020 15:49:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=4udghYGtUYeaRoul7B0YgVKGSlph/H2QPmKSktA8esE=; b=ZHQfBgnoIyqczd+dSUqiH9XRQINki3vuivj2cPIrgNBXg49yYfDtSx8Bsf8G5X625/ mOptg48RQARzcQ+rkH/uxDWqdwae+2uxF2ifZ9Q3/iyD9Fmb+iR5XcBHgQATA/bPQjn1 /NTLL7bPw8se2pZ7UmNBotzg2w1+cViAYuvMw= 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=4udghYGtUYeaRoul7B0YgVKGSlph/H2QPmKSktA8esE=; b=a+qlPV9ZasHf8smSdZyVFndm8GgkkzIhg6g2vrMQoRhCanfj+hj8eiQ4pd7fxqX7Om /6PjcWWEXyEJhwfk1bSyp9lRkY8xMAzMlH2tIEnLlYu/g+1+o8PQ5sBQweGnKBjVFCJ9 neE/T1rAlXrcV+8AWtYJQVjZceUvJ4SQwAIfFBtov+bP3hZ+FzL5Boc51A7DWdbgj8V8 p0DmCX1ApbBZERaEMv8PybO651dAmBIYThHRDioK/hlor6zQ6KmSHpqsnRYdmYtp+OKt dzGAANNUJHPAK7toTIRJ/VLLHIb8bqPc/cFWb3fNLp8aed8SDnrIH77vqWN75wG3FAGQ CHfQ== X-Gm-Message-State: AOAM532aX09nGRaOINduAWISwg2S3jjJ5uGXYsFAp2dbF3Zoam4Ntzro Y4ZdH5bUNW8GC3tPL+e6w4JavXbwZ2uftsZ33tKrDQ== X-Received: by 2002:aca:4fd3:: with SMTP id d202mr1727356oib.142.1594853364963; Wed, 15 Jul 2020 15:49:24 -0700 (PDT) MIME-Version: 1.0 References: <20200715222812.238172-1-sonnysasaka@chromium.org> In-Reply-To: From: Sonny Sasaka Date: Wed, 15 Jul 2020 15:49:13 -0700 Message-ID: Subject: Re: [PATCH BlueZ] profile: Add exception from being claimed internally To: Luiz Augusto von Dentz 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 Luiz, On Wed, Jul 15, 2020 at 3:40 PM Luiz Augusto von Dentz wrote: > > 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. Oh, I was misled by the field name, I thought it's to mark profiles which are not handled internally. I have sent another patch also clarifying the field with a comment. > > > /* 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