Linux-Bluetooth Archive on lore.kernel.org
 help / color / Atom feed
* [Bluez PATCH v2] doc: Add Suspend and Resume events
@ 2020-07-14 19:51 Abhishek Pandit-Subedi
  2020-07-22  3:18 ` Abhishek Pandit-Subedi
  2020-07-28  7:16 ` Marcel Holtmann
  0 siblings, 2 replies; 3+ messages in thread
From: Abhishek Pandit-Subedi @ 2020-07-14 19:51 UTC (permalink / raw)
  To: marcel, luiz.dentz
  Cc: chromeos-bluetooth-upstreaming, linux-bluetooth,
	Abhishek Pandit-Subedi, Alain Michaud, Miao-chen Chou

Add Controller Suspend Event and Controller Resume Event to identify
suspend or resume of the Bluetooth stack has occurred.

Also update Device Disconnected Event to indicate a new disconnect
reason: "Connection terminated by local host for suspend"

Reviewed-by: Alain Michaud <alainm@chromium.org>
Reviewed-by: Miao-chen Chou <mcchou@chromium.org>
---

Changes in v2:
- Moved Wake_Reason to first value
- Reduced Wake_Reason to not Bluetooth, unexpected event and remote wake

 doc/mgmt-api.txt | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)

diff --git a/doc/mgmt-api.txt b/doc/mgmt-api.txt
index ca0d38469..e7a713824 100644
--- a/doc/mgmt-api.txt
+++ b/doc/mgmt-api.txt
@@ -3834,6 +3834,7 @@ Device Disconnected Event
 		2	Connection terminated by local host
 		3	Connection terminated by remote host
 		4	Connection terminated due to authentication failure
+		5	Connection terminated by local host for suspend
 
 	Note that the local/remote distinction just determines which side
 	terminated the low-level connection, regardless of the
@@ -4577,3 +4578,50 @@ Advertisement Monitor Removed Event
 
 	The event will only be sent to management sockets other than the
 	one through which the command was sent.
+
+
+Controller Suspend Event
+========================
+
+	Event code:		0x002d
+	Controller Index:	<controller_id>
+	Event Parameters:	Suspend_State (1 octet)
+
+	This event indicates that the controller is suspended for host suspend.
+
+	Possible values for the Suspend_State parameter:
+		0	Running (not disconnected)
+		1	Disconnected and not scanning
+		2	Page scanning and/or passive scanning.
+
+	The value 0 is used for the running state and may be sent if the
+	controller could not be configured to suspend properly.
+
+	This event will be sent to all management sockets.
+
+
+Controller Resume Event
+=======================
+
+	Event code:		0x002e
+	Controller Index:	<controller_id>
+	Event Parameters:	Wake_Reason (1 octet)
+				Address (6 octets)
+				Address_Type (1 octet)
+
+	This event indicates that the controller has resumed from suspend.
+
+	Possible values for the Wake_Reason parameter:
+		0	Resume from non-Bluetooth wake source
+		1	Wake due to unexpected event
+		2	Remote wake due to peer device connection
+
+	Currently, we expect that only peer reconnections should wake us from
+	the suspended state. Any other events that occurred while the system
+	should have been suspended results in wake due to unexpected event.
+
+	If the Wake_Reason is Remote wake due to connection, the address of the
+	peer device that caused the event will be shared in Address and
+	Address_Type. Otherwise, Address and Address_Type will both be zero.
+
+	This event will be sent to all management sockets.
-- 
2.27.0.389.gc38d7665816-goog


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Bluez PATCH v2] doc: Add Suspend and Resume events
  2020-07-14 19:51 [Bluez PATCH v2] doc: Add Suspend and Resume events Abhishek Pandit-Subedi
@ 2020-07-22  3:18 ` Abhishek Pandit-Subedi
  2020-07-28  7:16 ` Marcel Holtmann
  1 sibling, 0 replies; 3+ messages in thread
From: Abhishek Pandit-Subedi @ 2020-07-22  3:18 UTC (permalink / raw)
  To: Marcel Holtmann, Luiz Augusto von Dentz
  Cc: ChromeOS Bluetooth Upstreaming, Bluez mailing list,
	Alain Michaud, Miao-chen Chou

Hi Marcel,

Please take a look at this v2 patch.

Thanks
Abhishek

On Tue, Jul 14, 2020 at 12:51 PM Abhishek Pandit-Subedi
<abhishekpandit@chromium.org> wrote:
>
> Add Controller Suspend Event and Controller Resume Event to identify
> suspend or resume of the Bluetooth stack has occurred.
>
> Also update Device Disconnected Event to indicate a new disconnect
> reason: "Connection terminated by local host for suspend"
>
> Reviewed-by: Alain Michaud <alainm@chromium.org>
> Reviewed-by: Miao-chen Chou <mcchou@chromium.org>
> ---
>
> Changes in v2:
> - Moved Wake_Reason to first value
> - Reduced Wake_Reason to not Bluetooth, unexpected event and remote wake
>
>  doc/mgmt-api.txt | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 48 insertions(+)
>
> diff --git a/doc/mgmt-api.txt b/doc/mgmt-api.txt
> index ca0d38469..e7a713824 100644
> --- a/doc/mgmt-api.txt
> +++ b/doc/mgmt-api.txt
> @@ -3834,6 +3834,7 @@ Device Disconnected Event
>                 2       Connection terminated by local host
>                 3       Connection terminated by remote host
>                 4       Connection terminated due to authentication failure
> +               5       Connection terminated by local host for suspend
>
>         Note that the local/remote distinction just determines which side
>         terminated the low-level connection, regardless of the
> @@ -4577,3 +4578,50 @@ Advertisement Monitor Removed Event
>
>         The event will only be sent to management sockets other than the
>         one through which the command was sent.
> +
> +
> +Controller Suspend Event
> +========================
> +
> +       Event code:             0x002d
> +       Controller Index:       <controller_id>
> +       Event Parameters:       Suspend_State (1 octet)
> +
> +       This event indicates that the controller is suspended for host suspend.
> +
> +       Possible values for the Suspend_State parameter:
> +               0       Running (not disconnected)
> +               1       Disconnected and not scanning
> +               2       Page scanning and/or passive scanning.
> +
> +       The value 0 is used for the running state and may be sent if the
> +       controller could not be configured to suspend properly.
> +
> +       This event will be sent to all management sockets.
> +
> +
> +Controller Resume Event
> +=======================
> +
> +       Event code:             0x002e
> +       Controller Index:       <controller_id>
> +       Event Parameters:       Wake_Reason (1 octet)
> +                               Address (6 octets)
> +                               Address_Type (1 octet)
> +
> +       This event indicates that the controller has resumed from suspend.
> +
> +       Possible values for the Wake_Reason parameter:
> +               0       Resume from non-Bluetooth wake source
> +               1       Wake due to unexpected event
> +               2       Remote wake due to peer device connection
> +
> +       Currently, we expect that only peer reconnections should wake us from
> +       the suspended state. Any other events that occurred while the system
> +       should have been suspended results in wake due to unexpected event.
> +
> +       If the Wake_Reason is Remote wake due to connection, the address of the
> +       peer device that caused the event will be shared in Address and
> +       Address_Type. Otherwise, Address and Address_Type will both be zero.
> +
> +       This event will be sent to all management sockets.
> --
> 2.27.0.389.gc38d7665816-goog
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Bluez PATCH v2] doc: Add Suspend and Resume events
  2020-07-14 19:51 [Bluez PATCH v2] doc: Add Suspend and Resume events Abhishek Pandit-Subedi
  2020-07-22  3:18 ` Abhishek Pandit-Subedi
@ 2020-07-28  7:16 ` Marcel Holtmann
  1 sibling, 0 replies; 3+ messages in thread
From: Marcel Holtmann @ 2020-07-28  7:16 UTC (permalink / raw)
  To: Abhishek Pandit-Subedi
  Cc: Luiz Augusto von Dentz, chromeos-bluetooth-upstreaming,
	linux-bluetooth, Alain Michaud, Miao-chen Chou

Hi Abhishek,

> Add Controller Suspend Event and Controller Resume Event to identify
> suspend or resume of the Bluetooth stack has occurred.
> 
> Also update Device Disconnected Event to indicate a new disconnect
> reason: "Connection terminated by local host for suspend"
> 
> Reviewed-by: Alain Michaud <alainm@chromium.org>
> Reviewed-by: Miao-chen Chou <mcchou@chromium.org>
> ---
> 
> Changes in v2:
> - Moved Wake_Reason to first value
> - Reduced Wake_Reason to not Bluetooth, unexpected event and remote wake
> 
> doc/mgmt-api.txt | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 48 insertions(+)
> 
> diff --git a/doc/mgmt-api.txt b/doc/mgmt-api.txt
> index ca0d38469..e7a713824 100644
> --- a/doc/mgmt-api.txt
> +++ b/doc/mgmt-api.txt
> @@ -3834,6 +3834,7 @@ Device Disconnected Event
> 		2	Connection terminated by local host
> 		3	Connection terminated by remote host
> 		4	Connection terminated due to authentication failure
> +		5	Connection terminated by local host for suspend
> 
> 	Note that the local/remote distinction just determines which side
> 	terminated the low-level connection, regardless of the
> @@ -4577,3 +4578,50 @@ Advertisement Monitor Removed Event
> 
> 	The event will only be sent to management sockets other than the
> 	one through which the command was sent.
> +
> +
> +Controller Suspend Event
> +========================
> +
> +	Event code:		0x002d
> +	Controller Index:	<controller_id>
> +	Event Parameters:	Suspend_State (1 octet)
> +
> +	This event indicates that the controller is suspended for host suspend.
> +
> +	Possible values for the Suspend_State parameter:
> +		0	Running (not disconnected)
> +		1	Disconnected and not scanning
> +		2	Page scanning and/or passive scanning.
> +
> +	The value 0 is used for the running state and may be sent if the
> +	controller could not be configured to suspend properly.
> +
> +	This event will be sent to all management sockets.
> +
> +
> +Controller Resume Event
> +=======================
> +
> +	Event code:		0x002e
> +	Controller Index:	<controller_id>
> +	Event Parameters:	Wake_Reason (1 octet)
> +				Address (6 octets)
> +				Address_Type (1 octet)
> +
> +	This event indicates that the controller has resumed from suspend.
> +
> +	Possible values for the Wake_Reason parameter:
> +		0	Resume from non-Bluetooth wake source
> +		1	Wake due to unexpected event
> +		2	Remote wake due to peer device connection
> +
> +	Currently, we expect that only peer reconnections should wake us from
> +	the suspended state. Any other events that occurred while the system
> +	should have been suspended results in wake due to unexpected event.
> +
> +	If the Wake_Reason is Remote wake due to connection, the address of the
> +	peer device that caused the event will be shared in Address and
> +	Address_Type. Otherwise, Address and Address_Type will both be zero.
> +
> +	This event will be sent to all management sockets.

so far so good. I am going to have second look once you have RFC implementation to review.

Regards

Marcel


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-14 19:51 [Bluez PATCH v2] doc: Add Suspend and Resume events Abhishek Pandit-Subedi
2020-07-22  3:18 ` Abhishek Pandit-Subedi
2020-07-28  7:16 ` Marcel Holtmann

Linux-Bluetooth Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-bluetooth/0 linux-bluetooth/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-bluetooth linux-bluetooth/ https://lore.kernel.org/linux-bluetooth \
		linux-bluetooth@vger.kernel.org
	public-inbox-index linux-bluetooth

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-bluetooth


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git