Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp712592ybg; Tue, 9 Jun 2020 10:54:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxHhIrj9/FBzdvYgv81LJ26mKGeEH2SEDY3XIDPZzayv3Bj/a16kbsow6IwJT7IAe1AWiKB X-Received: by 2002:a05:6402:311c:: with SMTP id dc28mr27650964edb.184.1591725268521; Tue, 09 Jun 2020 10:54:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591725268; cv=none; d=google.com; s=arc-20160816; b=e/pTQM0Iz06dfNpA0ryskRv/ZTW/dDl2NBmfx/b6leL1Ai3WJqWZvJ/LsQRxTbUZ/L Q+JYoti3bD9pqxOKR8Ry7sfRVXJ3l1DzuBtPa5cRhMYXv3XdZSqdMKuE+0W32oFuoXOx BstbrkSk3wLDxOumggtnbKLQzMC3w9U8whf8odTm1a95ZfCCnVq/ytBG/oPAzC5fPbTB l2GSn022HZN962m8KhubhdXXTK45VjTJSuFg2sebYRm7h5cOeeISSiyGbvLaQzHavnM1 Dvh+OQR2p2/2eX2Nx+c4aC7bkEXxoJy6JpViJdqU845ZoEzQGb7xd+yhEblL2H4alm2h rzvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=qcfEUjiW7dMJADGYNzo6Tezy1WfS7SP+7CqZdgcOrio=; b=0vEKIBI7K37AGs3LYxH5I70ipwouarhzfkHDwd+jlvYpL2TKN7Twnc0SYGAymApPXa nYntl4YJvsB858L3loY35QyR2o09clhpgUhRzS0TePBBcA4TwQiRq1aymJarU8i6IHaP BthPApTDV8kEETV6P41AvWETF61lKB5r1y3sp37qUq2YP5OHJlBO7pvJqC3f8fMQv/I3 pPimUFs22z0TjDXdob+0XB7BUrXLFsFkphupH+7KTCXHgZbfap6tQQ22HCkSWlO5MmBx saF9asfmm5WAyuAzDRSfW96sXb15Ytx/rXjZVbfhB7YAH9hPcEHiiBvb+0JjDWPQ4kQi SfHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=DPURd7DH; 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 h18si11405035eja.48.2020.06.09.10.53.45; Tue, 09 Jun 2020 10:54:28 -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=DPURd7DH; 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 S1729328AbgFIRn1 (ORCPT + 99 others); Tue, 9 Jun 2020 13:43:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40380 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728472AbgFIRn0 (ORCPT ); Tue, 9 Jun 2020 13:43:26 -0400 Received: from mail-vs1-xe41.google.com (mail-vs1-xe41.google.com [IPv6:2607:f8b0:4864:20::e41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 29955C05BD1E for ; Tue, 9 Jun 2020 10:43:24 -0700 (PDT) Received: by mail-vs1-xe41.google.com with SMTP id q2so12536609vsr.1 for ; Tue, 09 Jun 2020 10:43:23 -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:content-transfer-encoding; bh=qcfEUjiW7dMJADGYNzo6Tezy1WfS7SP+7CqZdgcOrio=; b=DPURd7DH3oiFR9PdsrQ2B0/b1twSlVm9t4B7E2kkZxAi7KsflXYmw7BJ4RXuz9MZa7 LMMEuQLoGB/cRkT40MJkHU3CzKyW99BkQFgjvDa54BC7thmIKWjQzODgczNFBGEZplm8 db3EGKo5begdiYwhDtNxq7vLjhBtGuB3ETUu0= 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:content-transfer-encoding; bh=qcfEUjiW7dMJADGYNzo6Tezy1WfS7SP+7CqZdgcOrio=; b=koN2z89kQuahKQ2jBLmnpLuiagcblY5kg6WwfvuaOpnZCHKCuO/I8Pn4nkaYPlDn4c vBqeBRg1HZSGF7+JfRCqtjTmr5Ta91XxaYftytTgqKGzPOACUOhE3HM5NZyPZORvlpqa O9T0JEOu2lk4me9980zM6AmI4A1MeoA/m/m1BWDg2tt54Z++KP2on5RbTnUAqEBk4dJi Tul8Ke6oRS+/P6IcUTJuvzLqD6icWmhJKxKzdY3jGlZ0Sty+ZqsBFCvYcAJ8vnDKULmu CCcWeffB0uXF1C0LEE0WPwUV36WuKov+ZXMEGdpR2qx+vNRm+6a/oRu8DYC5yEY0ahbU 6zCA== X-Gm-Message-State: AOAM530K8pqoBzkZR0xcCG6pFx+FbCS6hyjbVOYQdMl/kOTLs1i6GQCD iNaXG/6I7+fnyahedHCPwgFQq88dKhhoEotgVOwqhbompLU= X-Received: by 2002:a67:6583:: with SMTP id z125mr4558134vsb.196.1591724603057; Tue, 09 Jun 2020 10:43:23 -0700 (PDT) MIME-Version: 1.0 References: <20200406180331.891822-1-marcel@holtmann.org> In-Reply-To: From: Abhishek Pandit-Subedi Date: Tue, 9 Jun 2020 10:43:12 -0700 Message-ID: Subject: Re: [PATCH] doc: Add commands and event for handling device flags To: Marcel Holtmann Cc: Bluez mailing list Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hey Marcel, Coming back to this device flags idea, I think I would prefer the original design over adding new management commands for each flag. Bluez will just have to maintain the current flags and pending flags (i.e. mgmt call) to decide when to emit property changed events for the device WakeAllowed property. 0x0049 and 0x004A are now taken for experimental features but you have my reviewed-by for the next available values for the original patch. Reviewed-by: Abhishek Pandit-Subedi Thanks Abhishek On Mon, Apr 6, 2020 at 11:36 AM Marcel Holtmann wrote= : > > Hi Abhishek, > > >> --- > >> doc/mgmt-api.txt | 96 ++++++++++++++++++++++++++++++++++++++++++++++++ > >> 1 file changed, 96 insertions(+) > >> > >> diff --git a/doc/mgmt-api.txt b/doc/mgmt-api.txt > >> index 39f23c456080..ac5b6c97d64a 100644 > >> --- a/doc/mgmt-api.txt > >> +++ b/doc/mgmt-api.txt > >> @@ -3138,6 +3138,74 @@ Read Security Information Command > >> Invalid Index > >> > >> > >> +Get Device Flags Command > >> +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D > >> + > >> + Command Code: 0x0049 > >> + Controller Index: > >> + Command Parameters: Address (6 Octets) > >> + Address_Type (1 Octet) > >> + Return Parameters: Address (6 Octets) > >> + Address_Type (1 Octet) > >> + Supported_Flags (4 Octets) > >> + Current_Flags (4 Octets) > >> + > >> + This command is used to retrieve additional flags and settings > >> + for devices that are added via Add Device command. > >> + > >> + Possible values for the Address_Type parameter: > >> + 0 BR/EDR > >> + 1 LE Public > >> + 2 LE Random > >> + > >> + The Flags parameters are a bitmask with currently the followin= g > >> + available bits: > >> + > >> + 0 Remote Wakeup enabled > >> + > >> + This command generates a Command Complete event on success > >> + or a Command Status event on failure. > >> + > >> + Possible errors: Invalid Parameters > >> + Invalid Index > >> + > >> + > > > > Get device flags looks good to me. > > > >> +Set Device Flags Command > >> +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D > >> + > >> + Command Code: 0x004a > >> + Controller Index: > >> + Command Parameters: Address (6 Octets) > >> + Address_Type (1 Octet) > >> + Current_Flags (4 Octets) > > > > I would prefer to use a mask and value rather than current_flags here. > > > >> + Return Parameters: Address (6 Octets) > >> + Address_Type (1 Octet) > > > > Prefer to also return an updated_mask and current_flags. This > > simplifies completion for userspace. Otherwise, we would need to keep > > a "pending flags" value on the device structure. > > I saw your =E2=80=9Cmask=E2=80=9D proposal and I am not a fan of that. I = want to keep the design of the API somewhat consistent. Hence the Device Fl= ags Changed event should be send after Add Device completed and also after = Device Added has been sent out. > > One other option is to keep Get Device Flags as is and then instead of ad= ding Set Device Flags, add one command per flag and rename Device Flags Cha= nged to New Device Flags. > > Set Device Wakeable Command > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > > Command Code: 0x004a > Controller Index: > Command Parameters: Address (6 Octets) > Address_Type (1 Octet) > Wakeable (1 Octet) > Return Parameters: Address (6 Octets) > Address_Type (1 Octet) > Current_Flags (4 Octets) > > Maybe this is not a bad idea either and is similar on how we handle setti= ngs. I need to sleep about this. > > Regards > > Marcel >