Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3592143ybb; Mon, 6 Apr 2020 11:36:50 -0700 (PDT) X-Google-Smtp-Source: APiQypIPdRmDGLU7E9w9IGQLrqEtwFPXXmP+qjEF+bTA33W+74y+ju6hfQLvNqhANS/6pzr1VUKr X-Received: by 2002:aca:4d47:: with SMTP id a68mr664953oib.56.1586198210871; Mon, 06 Apr 2020 11:36:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586198210; cv=none; d=google.com; s=arc-20160816; b=XHb+xKMopkaCQTK8qukg3q460Frsfi1KNUDEU8LTIhpdFxMJLRo+J/5DthCoVWgkD+ EingfQHKq4SafN89bM7ewx9xK7uH6QHf+GxTDkY3wfP09ToWSOXdZac+5x8amTSD/A1M D//tMhtFoOOkgnm3Y95b3ksUi6r0KSOd1nNCHBNPa4o2/iUsUT7DY4Pg3NFFUrwmdEBv sR2QYPFJkAAirMF8fIwe4s5mCBYqwGWjgALIhQJXOboWjkk5jRYbyjFnqlQMu3SHBS17 96sOJ92r2duNaJ6OemB+1Bh3Cb0T+lGp/swI9Qq5bj7rWCztftScsIl9doMZAyJ4QxXm EeTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version; bh=h9JHtf+mJTvf1ok0ds0P+bepnnakADLrxIzEtbTAMXc=; b=ZskoYL4SGtmBONhNwsrJ+nW3eVeRIw+GUvrMuBa9IXK7hUA0RJMT9nbXOa7gb39deB NkpTRNKRRGrgJ0a9tBAgr/EpqOmCk+EVz5WyQOKolyyec7LPfDtUPTbElvmHsJ60lDOh XNSTmMfL1HT9UL+3zn04yR9Ww9wHawb8i5PiEhCTlExJkXXraLTmd76rS3Qyv42w7UI1 tzjVbl/ewlKk7EfQbsPwaLgRteK/q4tF00EYjoB4J5fsvKxyt3+uoTR8jNUz4icMhkXv dYYVMNfofg45Vz+ae3M/VP0js1xvxITa6m8jWScOujEwjrgd4wciN4UYbEyEwkdJf4eY mOvA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v22si7351807oic.271.2020.04.06.11.36.36; Mon, 06 Apr 2020 11:36:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725876AbgDFSgf convert rfc822-to-8bit (ORCPT + 99 others); Mon, 6 Apr 2020 14:36:35 -0400 Received: from coyote.holtmann.net ([212.227.132.17]:60247 "EHLO mail.holtmann.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725787AbgDFSgf (ORCPT ); Mon, 6 Apr 2020 14:36:35 -0400 Received: from marcel-macbook.fritz.box (p4FEFC5A7.dip0.t-ipconnect.de [79.239.197.167]) by mail.holtmann.org (Postfix) with ESMTPSA id 9107DCECCA; Mon, 6 Apr 2020 20:46:08 +0200 (CEST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.80.23.2.2\)) Subject: Re: [PATCH] doc: Add commands and event for handling device flags From: Marcel Holtmann In-Reply-To: Date: Mon, 6 Apr 2020 20:36:34 +0200 Cc: Bluez mailing list Content-Transfer-Encoding: 8BIT Message-Id: References: <20200406180331.891822-1-marcel@holtmann.org> To: Abhishek Pandit-Subedi X-Mailer: Apple Mail (2.3608.80.23.2.2) Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org 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 >> +======================== >> + >> + 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 following >> + 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 >> +======================== >> + >> + 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 “mask” proposal and I am not a fan of that. I want to keep the design of the API somewhat consistent. Hence the Device Flags 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 adding Set Device Flags, add one command per flag and rename Device Flags Changed to New Device Flags. Set Device Wakeable Command =========================== 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 settings. I need to sleep about this. Regards Marcel