Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp792463ybl; Wed, 29 Jan 2020 09:45:46 -0800 (PST) X-Google-Smtp-Source: APXvYqxMl7nELu//8/cTWyKqeP66cIzZb0lfHCYlBcqi3BMDNmZtmAXRpDBCFhBskifBtTjmOPX7 X-Received: by 2002:a9d:74c4:: with SMTP id a4mr314762otl.119.1580319946252; Wed, 29 Jan 2020 09:45:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580319946; cv=none; d=google.com; s=arc-20160816; b=RYYudQvVSsmQ/4kYzmvL+DZ3HPh5kXAxMFn1fKGbHYEEM3E6WOpXAEtXmm2IAwxH// makUcvkfuGdnKPiqKxJDNFSB535MFd66MPT5dtNRktoA1VEtdzArQGc1j/9q7fv0JT4+ aFFoLg5k7L48kQH8F1vOvVB1W4kFFZtxuCQybZ7mzC7cmp/djUFbHLtFbXtsT+Pv0OBC D0WrqbgFaV/ArbzKifw8i018ytRLScsQgZq9YKs8XFon4lvIq2iGXRDq7MS6JPRqy/ra K29F5dFUNuQJE/D28ibAu+bap8N/LjHcjEgJRvaWgokNJt+hSpqjCimeWnsqzeEtMEyR en9A== 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=gNBQo7/fAVJnvsft4+lLo38CwgZoQc9XWH9MjqmimI4=; b=rDRSRGz730qalhF219Dr/dDJpS2HJKF+L0uCVKQ91TxcA3MPCWXJNBCpzDC5cVIS+7 1KLQX7WceZNpp4teRtOy390Yn+JVe3CgW8hD2e6mHjJCgJ5aOfLoJBxA/w5CZCCs/Goa i7Uy/PxYTguiXxhBWCEjEbW766r+t80c2lyMSq9MVQEDc1ymlFdHdaAjtXN924KXcgQ6 MargKFg1wONoW5P6Uapdbol9hM513xkrqGljT6T9YQdz2K+T4pNaD063eSkwibKHT6hv i85lUKu/t4Gi9lvpczSaLb76YqzWcNpncNr9cS7iq/xtuGbbeqcKpWlNkFG7jrqb7j98 AzHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=R+ERco5k; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n21si1427010oic.0.2020.01.29.09.45.15; Wed, 29 Jan 2020 09:45:46 -0800 (PST) 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; dkim=pass header.i=@chromium.org header.s=google header.b=R+ERco5k; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727119AbgA2Ro6 (ORCPT + 99 others); Wed, 29 Jan 2020 12:44:58 -0500 Received: from mail-vs1-f68.google.com ([209.85.217.68]:35327 "EHLO mail-vs1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726733AbgA2Ro6 (ORCPT ); Wed, 29 Jan 2020 12:44:58 -0500 Received: by mail-vs1-f68.google.com with SMTP id x123so296476vsc.2 for ; Wed, 29 Jan 2020 09:44:57 -0800 (PST) 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=gNBQo7/fAVJnvsft4+lLo38CwgZoQc9XWH9MjqmimI4=; b=R+ERco5kVIv1fe6x/QEYjdkdwGmrOy15OplML1Day5n6julmY3AmVLD2TnVW7ZlzNP TMsndb1ZeqHw8WO9VfWmgZyiyUxwpncNKr2DadH8uo/+Gf7SW1BJaN+fmTn39bgQ2Wv5 vqwWIyBnoVf4m4GA+b/LK85I8bxJHqIY/yCUI= 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=gNBQo7/fAVJnvsft4+lLo38CwgZoQc9XWH9MjqmimI4=; b=lNuZV+oAKIdyRR8QYoVg8NTnnguRRP30IFcYRNgmXVpuAKB2flNQ/3pija0fWwptO0 5Ch0Qgs/tSu90DrbfsfZNVMYx40ZqGPDEeAuCK6b0HdQpVohg+dOWMW26Fprx0HWB78e RjoVZeYoLMDXgyIE0PdP0Imvyfk/XylJ6C/74muIffoWAS1+rVSVw6LyGLNS3UL9fDoo Z4VanYRXpr/q0DN+q5HO5xov8JgjKs2YnNmyGlTvlAny0RRtEE9aci0Mos2NCkt9W+Cw 2cT/43JozGoC+iJwrYoOURuvsJSu5prynYmHB5X9m/xPzGkdrT8i5gIvIaY1bv9Wj2C4 /7nQ== X-Gm-Message-State: APjAAAWCgqynOPiGKZQpLVnKvLOSO7wAmvZL2S5H0/q8oXNr2wKkFJJZ SvD3y1n4VsSZyI/U+l8wSeIIh2J8n0KXN0vngUOEmA== X-Received: by 2002:a67:f641:: with SMTP id u1mr448690vso.86.1580319897199; Wed, 29 Jan 2020 09:44:57 -0800 (PST) MIME-Version: 1.0 References: <20200128020505.239349-1-abhishekpandit@chromium.org> <20200127180433.BlueZ.v3.1.I999b93b65e613324dbbd16a1cf493be72fa06ad1@changeid> <137EB79B-88E6-43E0-894F-A0C8D5F9B710@holtmann.org> In-Reply-To: <137EB79B-88E6-43E0-894F-A0C8D5F9B710@holtmann.org> From: Abhishek Pandit-Subedi Date: Wed, 29 Jan 2020 09:44:46 -0800 Message-ID: Subject: Re: [BlueZ PATCH v3 1/5] mgmt: Add docs for Set Wake Capable To: Marcel Holtmann Cc: Luiz Augusto von Dentz , Alain Michaud , Bluez mailing list , chromeos-bluetooth-upstreaming@chromium.org 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 Hi Marcel, On Tue, Jan 28, 2020 at 8:33 PM Marcel Holtmann wrote= : > > Hi Abhishek, > > > Add docs for new management operation to mark a device as wake capable. > > > > --- > > > > Changes in v3: None > > Changes in v2: > > * Separated docs/mgmt-api.txt into its own patch > > > > doc/mgmt-api.txt | 19 +++++++++++++++++++ > > 1 file changed, 19 insertions(+) > > > > diff --git a/doc/mgmt-api.txt b/doc/mgmt-api.txt > > index 1e59acc54..8a73a9bb9 100644 > > --- a/doc/mgmt-api.txt > > +++ b/doc/mgmt-api.txt > > @@ -3047,6 +3047,25 @@ Load Blocked Keys Command > > Possible errors: Invalid Parameters > > Invalid Index > > > > +Set Wake Capable 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: 0x0047 > > + Controller Index: > > + Command Parameters: Address (6 Octets) > > + Address_Type (1 Octet) > > + Wake Capable (1 Octet) > > + Return Parameters: Address (6 Octets) > > + Address_Type (1 Octet) > > + Wake Capable (1 Octet) > > + > > + This command sets whether a bluetooth device is capable of waking= the > > + system from suspend. This property is used to set the event filte= r and > > + LE whitelist when the system enters suspend. > > + > > + Possible errors: Failed > > + Invalid Parameters > > + Invalid Index > > > > my current thinking goes into this API addition: > > --- a/doc/mgmt-api.txt > +++ b/doc/mgmt-api.txt > @@ -2003,6 +2003,7 @@ Add Device Command > 0 Background scan for device > 1 Allow incoming connection > 2 Auto-connect remote device > + 3 Allow incoming connection to wake up the system > > With the Action 0, when the device is found, a new Device Found > event will be sent indicating this device is available. This > @@ -2018,6 +2019,9 @@ Add Device Command > and if successful a Device Connected event will be sent. This > action is only valid for LE Public and LE Random address types. > > + With the Action 3, the device is allowed to connect the same way > + as with Action 1, but allows to wake up the system from suspend. > + > When a device is blocked using Block Device command, then it is > valid to add the device here, but all actions will be ignored > until the device is unblocked. > > Since we are really talking about incoming connections, then the Add Devi= ce command is the one that handles this. Giving a device the option to wake= us up that is not set up for incoming connections makes no sense. We can d= iscuss if certain LE advertising packets should wake us up, but that is a t= otal different API in my book. I originally tried implementing this with the Add Device api as you suggested in the RFC email back in November (when we first talked about this). I had trouble figuring out when/where in bluez to actually send the Add Device command. Whether a device supports wake-up is a profile level setting (i.e. HID only so far). As far as I can tell, Add Device is called before the profile connection is established. Bluez has two apis that call MGMT_OP_ADD_DEVICE: * adapter_auto_connect_add (this seems to be LE) * adapter_whitelist_add (this seems to be BR/EDR) Both seem to be called BEFORE the registered profiles have a chance to accept the connection. > > Regards > > Marcel >