All of lore.kernel.org
 help / color / mirror / Atom feed
* [Bluez PATCH v1 1/2] doc/mgmt-api: Add opcode for adding advertisement monitor with RSSI
@ 2020-12-15  8:33 Archie Pusaka
  2020-12-15  8:33 ` [Bluez PATCH v1 2/2] lib/mgmt: Adding Add Adv Patterns Monitor RSSI opcode Archie Pusaka
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Archie Pusaka @ 2020-12-15  8:33 UTC (permalink / raw)
  To: linux-bluetooth, Luiz Augusto von Dentz
  Cc: CrosBT Upstreaming, Archie Pusaka, Manish Mandlik, Miao-chen Chou,
	Yun-Hao Chung

From: Archie Pusaka <apusaka@chromium.org>

This is to leverage the filtering by RSSI feature on those controllers
which supports advertisement packet filtering. To avoid changing the
existing API and breaking it, a new opcode is required.

Reviewed-by: Manish Mandlik <mmandlik@chromium.org>
Reviewed-by: Miao-chen Chou <mcchou@chromium.org>
Reviewed-by: Yun-Hao Chung <howardchung@google.com>

Signed-off-by: Archie Pusaka <apusaka@chromium.org>
---

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

diff --git a/doc/mgmt-api.txt b/doc/mgmt-api.txt
index 1aa43d6c3c..d5c7169630 100644
--- a/doc/mgmt-api.txt
+++ b/doc/mgmt-api.txt
@@ -3800,6 +3800,58 @@ Add Extended Advertising Data Command
 				Busy
 
 
+Add Advertisement Patterns Monitor With RSSI Threshold Command
+==============================================================
+
+	Command Code:		0x0056
+	Controller Index:	<controller id>
+	Command Parameters:	Pattern_Count (1 Octet)
+				RSSI_Data {
+					High_Threshold (1 Octet)
+					High_Threshold_Timer (2 Octets)
+					Low_Threshold (1 Octet)
+					Low_Threshold_Timer (2 Octets)
+					Sampling_Period (1 Octet)
+				}
+				Pattern1 {
+					AD_Type (1 Octet)
+					Offset (1 Octet)
+					Length (1 Octet)
+					Value (31 Octets)
+				}
+				Pattern2 { }
+				...
+	Return Parameters:	Monitor_Handle (2 Octets)
+
+	This command is essentially the same as Add Advertisement Patterns
+	Monitor Command (0x0052), but with an additional RSSI parameters.
+	As such, if the kernel supports advertisement filtering, then the
+	advertisement data will be filtered in accordance with the set
+	RSSI parameters. Otherwise, it would behave exactly the same as the
+	Add Advertisement Patterns Monitor Command.
+
+	Devices would be considered "in-range" if the RSSI of the received adv
+	packets are greater than High_Threshold dBm for High_Threshold_Timer
+	seconds. Similarly, devices would be considered lost if no received
+	adv have RSSI greater than Low_Threshold dBm for Low_Threshold_Timer
+	seconds. Only adv packets of "in-range" device would be propagated.
+
+	The meaning of Sampling_Period is as follows:
+		0x00	All adv packets from "in-range" devices would be
+			propagated.
+		0xFF	Only the first adv data of "in-range" devices would be
+			propagated. If the device becomes lost, then the first
+			data when it is found again will also be propagated.
+		other	Advertisement data would be grouped into 100ms * N
+			time period. Data in the same group will only be
+			reported once, with the RSSI value being averaged out.
+
+	Possible errors:	Failed
+				Busy
+				No Resources
+				Invalid Parameters
+
+
 Command Complete Event
 ======================
 
-- 
2.29.2.684.gfbc64c5ab5-goog


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

* [Bluez PATCH v1 2/2] lib/mgmt: Adding Add Adv Patterns Monitor RSSI opcode.
  2020-12-15  8:33 [Bluez PATCH v1 1/2] doc/mgmt-api: Add opcode for adding advertisement monitor with RSSI Archie Pusaka
@ 2020-12-15  8:33 ` Archie Pusaka
  2020-12-15  8:58 ` [Bluez,v1,1/2] doc/mgmt-api: Add opcode for adding advertisement monitor with RSSI bluez.test.bot
  2020-12-15 17:54 ` [Bluez PATCH v1 1/2] " Luiz Augusto von Dentz
  2 siblings, 0 replies; 5+ messages in thread
From: Archie Pusaka @ 2020-12-15  8:33 UTC (permalink / raw)
  To: linux-bluetooth, Luiz Augusto von Dentz
  Cc: CrosBT Upstreaming, Archie Pusaka, Manish Mandlik, Miao-chen Chou,
	Yun-Hao Chung

From: Archie Pusaka <apusaka@chromium.org>

The new op is to utilize RSSI in advertisement monitor

Reviewed-by: Manish Mandlik <mmandlik@chromium.org>
Reviewed-by: Miao-chen Chou <mcchou@chromium.org>
Reviewed-by: Yun-Hao Chung <howardchung@google.com>
---

 lib/mgmt.h | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/lib/mgmt.h b/lib/mgmt.h
index f37f7e6540..1b8fcc0e10 100644
--- a/lib/mgmt.h
+++ b/lib/mgmt.h
@@ -738,6 +738,21 @@ struct mgmt_rp_add_ext_adv_data {
 	uint8_t	instance;
 } __packed;
 
+struct mgmt_adv_rssi_thresholds {
+	int8_t   high_threshold;
+	uint16_t high_threshold_timeout;
+	int8_t   low_threshold;
+	uint16_t low_threshold_timeout;
+	uint8_t  sampling_period;
+} __packed;
+
+#define MGMT_OP_ADD_ADV_PATTERNS_MONITOR_RSSI	0x0056
+struct mgmt_cp_add_adv_patterns_monitor_rssi {
+	uint8_t pattern_count;
+	struct mgmt_adv_rssi_thresholds rssi;
+	struct mgmt_adv_pattern patterns[0];
+} __packed;
+
 #define MGMT_EV_CMD_COMPLETE		0x0001
 struct mgmt_ev_cmd_complete {
 	uint16_t opcode;
-- 
2.29.2.684.gfbc64c5ab5-goog


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

* RE: [Bluez,v1,1/2] doc/mgmt-api: Add opcode for adding advertisement monitor with RSSI
  2020-12-15  8:33 [Bluez PATCH v1 1/2] doc/mgmt-api: Add opcode for adding advertisement monitor with RSSI Archie Pusaka
  2020-12-15  8:33 ` [Bluez PATCH v1 2/2] lib/mgmt: Adding Add Adv Patterns Monitor RSSI opcode Archie Pusaka
@ 2020-12-15  8:58 ` bluez.test.bot
  2020-12-15 17:54 ` [Bluez PATCH v1 1/2] " Luiz Augusto von Dentz
  2 siblings, 0 replies; 5+ messages in thread
From: bluez.test.bot @ 2020-12-15  8:58 UTC (permalink / raw)
  To: linux-bluetooth, apusaka

[-- Attachment #1: Type: text/plain, Size: 720 bytes --]

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=402091

---Test result---

##############################
Test: CheckPatch - PASS

##############################
Test: CheckGitLint - FAIL
Output:
lib/mgmt: Adding Add Adv Patterns Monitor RSSI opcode.
1: T3 Title has trailing punctuation (.): "lib/mgmt: Adding Add Adv Patterns Monitor RSSI opcode."


##############################
Test: CheckBuild - PASS

##############################
Test: MakeCheck - PASS



---
Regards,
Linux Bluetooth


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

* Re: [Bluez PATCH v1 1/2] doc/mgmt-api: Add opcode for adding advertisement monitor with RSSI
  2020-12-15  8:33 [Bluez PATCH v1 1/2] doc/mgmt-api: Add opcode for adding advertisement monitor with RSSI Archie Pusaka
  2020-12-15  8:33 ` [Bluez PATCH v1 2/2] lib/mgmt: Adding Add Adv Patterns Monitor RSSI opcode Archie Pusaka
  2020-12-15  8:58 ` [Bluez,v1,1/2] doc/mgmt-api: Add opcode for adding advertisement monitor with RSSI bluez.test.bot
@ 2020-12-15 17:54 ` Luiz Augusto von Dentz
  2020-12-16  3:45   ` Archie Pusaka
  2 siblings, 1 reply; 5+ messages in thread
From: Luiz Augusto von Dentz @ 2020-12-15 17:54 UTC (permalink / raw)
  To: Archie Pusaka
  Cc: linux-bluetooth, CrosBT Upstreaming, Archie Pusaka,
	Manish Mandlik, Miao-chen Chou, Yun-Hao Chung

Hi Archie,

On Tue, Dec 15, 2020 at 12:33 AM Archie Pusaka <apusaka@google.com> wrote:
>
> From: Archie Pusaka <apusaka@chromium.org>
>
> This is to leverage the filtering by RSSI feature on those controllers
> which supports advertisement packet filtering. To avoid changing the
> existing API and breaking it, a new opcode is required.
>
> Reviewed-by: Manish Mandlik <mmandlik@chromium.org>
> Reviewed-by: Miao-chen Chou <mcchou@chromium.org>
> Reviewed-by: Yun-Hao Chung <howardchung@google.com>
>
> Signed-off-by: Archie Pusaka <apusaka@chromium.org>
> ---
>
>  doc/mgmt-api.txt | 52 ++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 52 insertions(+)
>
> diff --git a/doc/mgmt-api.txt b/doc/mgmt-api.txt
> index 1aa43d6c3c..d5c7169630 100644
> --- a/doc/mgmt-api.txt
> +++ b/doc/mgmt-api.txt
> @@ -3800,6 +3800,58 @@ Add Extended Advertising Data Command
>                                 Busy
>
>
> +Add Advertisement Patterns Monitor With RSSI Threshold Command
> +==============================================================
> +
> +       Command Code:           0x0056
> +       Controller Index:       <controller id>
> +       Command Parameters:     Pattern_Count (1 Octet)

I'd move the pattern_count after the rssi if the rssi is not per
pattern, well in case the rssi is per pattern then it should be put
inside the Pattern directly.

> +                               RSSI_Data {
> +                                       High_Threshold (1 Octet)
> +                                       High_Threshold_Timer (2 Octets)
> +                                       Low_Threshold (1 Octet)
> +                                       Low_Threshold_Timer (2 Octets)
> +                                       Sampling_Period (1 Octet)
> +                               }
> +                               Pattern1 {
> +                                       AD_Type (1 Octet)
> +                                       Offset (1 Octet)
> +                                       Length (1 Octet)
> +                                       Value (31 Octets)
> +                               }
> +                               Pattern2 { }
> +                               ...
> +       Return Parameters:      Monitor_Handle (2 Octets)
> +
> +       This command is essentially the same as Add Advertisement Patterns
> +       Monitor Command (0x0052), but with an additional RSSI parameters.
> +       As such, if the kernel supports advertisement filtering, then the
> +       advertisement data will be filtered in accordance with the set
> +       RSSI parameters. Otherwise, it would behave exactly the same as the
> +       Add Advertisement Patterns Monitor Command.
> +
> +       Devices would be considered "in-range" if the RSSI of the received adv
> +       packets are greater than High_Threshold dBm for High_Threshold_Timer
> +       seconds. Similarly, devices would be considered lost if no received
> +       adv have RSSI greater than Low_Threshold dBm for Low_Threshold_Timer
> +       seconds. Only adv packets of "in-range" device would be propagated.
> +
> +       The meaning of Sampling_Period is as follows:
> +               0x00    All adv packets from "in-range" devices would be
> +                       propagated.
> +               0xFF    Only the first adv data of "in-range" devices would be
> +                       propagated. If the device becomes lost, then the first
> +                       data when it is found again will also be propagated.
> +               other   Advertisement data would be grouped into 100ms * N
> +                       time period. Data in the same group will only be
> +                       reported once, with the RSSI value being averaged out.
> +
> +       Possible errors:        Failed
> +                               Busy
> +                               No Resources
> +                               Invalid Parameters
> +
> +
>  Command Complete Event
>  ======================
>
> --
> 2.29.2.684.gfbc64c5ab5-goog
>


-- 
Luiz Augusto von Dentz

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

* Re: [Bluez PATCH v1 1/2] doc/mgmt-api: Add opcode for adding advertisement monitor with RSSI
  2020-12-15 17:54 ` [Bluez PATCH v1 1/2] " Luiz Augusto von Dentz
@ 2020-12-16  3:45   ` Archie Pusaka
  0 siblings, 0 replies; 5+ messages in thread
From: Archie Pusaka @ 2020-12-16  3:45 UTC (permalink / raw)
  To: Luiz Augusto von Dentz
  Cc: linux-bluetooth, CrosBT Upstreaming, Archie Pusaka,
	Manish Mandlik, Miao-chen Chou, Yun-Hao Chung

Hi Luiz,

On Wed, 16 Dec 2020 at 01:55, Luiz Augusto von Dentz
<luiz.dentz@gmail.com> wrote:
>
> Hi Archie,
>
> On Tue, Dec 15, 2020 at 12:33 AM Archie Pusaka <apusaka@google.com> wrote:
> >
> > From: Archie Pusaka <apusaka@chromium.org>
> >
> > This is to leverage the filtering by RSSI feature on those controllers
> > which supports advertisement packet filtering. To avoid changing the
> > existing API and breaking it, a new opcode is required.
> >
> > Reviewed-by: Manish Mandlik <mmandlik@chromium.org>
> > Reviewed-by: Miao-chen Chou <mcchou@chromium.org>
> > Reviewed-by: Yun-Hao Chung <howardchung@google.com>
> >
> > Signed-off-by: Archie Pusaka <apusaka@chromium.org>
> > ---
> >
> >  doc/mgmt-api.txt | 52 ++++++++++++++++++++++++++++++++++++++++++++++++
> >  1 file changed, 52 insertions(+)
> >
> > diff --git a/doc/mgmt-api.txt b/doc/mgmt-api.txt
> > index 1aa43d6c3c..d5c7169630 100644
> > --- a/doc/mgmt-api.txt
> > +++ b/doc/mgmt-api.txt
> > @@ -3800,6 +3800,58 @@ Add Extended Advertising Data Command
> >                                 Busy
> >
> >
> > +Add Advertisement Patterns Monitor With RSSI Threshold Command
> > +==============================================================
> > +
> > +       Command Code:           0x0056
> > +       Controller Index:       <controller id>
> > +       Command Parameters:     Pattern_Count (1 Octet)
>
> I'd move the pattern_count after the rssi if the rssi is not per
> pattern, well in case the rssi is per pattern then it should be put
> inside the Pattern directly.
>
It's not per pattern. I uploaded a newer version which flips the
declaration order, please take another look. Thanks!

> > +                               RSSI_Data {
> > +                                       High_Threshold (1 Octet)
> > +                                       High_Threshold_Timer (2 Octets)
> > +                                       Low_Threshold (1 Octet)
> > +                                       Low_Threshold_Timer (2 Octets)
> > +                                       Sampling_Period (1 Octet)
> > +                               }
> > +                               Pattern1 {
> > +                                       AD_Type (1 Octet)
> > +                                       Offset (1 Octet)
> > +                                       Length (1 Octet)
> > +                                       Value (31 Octets)
> > +                               }
> > +                               Pattern2 { }
> > +                               ...
> > +       Return Parameters:      Monitor_Handle (2 Octets)
> > +
> > +       This command is essentially the same as Add Advertisement Patterns
> > +       Monitor Command (0x0052), but with an additional RSSI parameters.
> > +       As such, if the kernel supports advertisement filtering, then the
> > +       advertisement data will be filtered in accordance with the set
> > +       RSSI parameters. Otherwise, it would behave exactly the same as the
> > +       Add Advertisement Patterns Monitor Command.
> > +
> > +       Devices would be considered "in-range" if the RSSI of the received adv
> > +       packets are greater than High_Threshold dBm for High_Threshold_Timer
> > +       seconds. Similarly, devices would be considered lost if no received
> > +       adv have RSSI greater than Low_Threshold dBm for Low_Threshold_Timer
> > +       seconds. Only adv packets of "in-range" device would be propagated.
> > +
> > +       The meaning of Sampling_Period is as follows:
> > +               0x00    All adv packets from "in-range" devices would be
> > +                       propagated.
> > +               0xFF    Only the first adv data of "in-range" devices would be
> > +                       propagated. If the device becomes lost, then the first
> > +                       data when it is found again will also be propagated.
> > +               other   Advertisement data would be grouped into 100ms * N
> > +                       time period. Data in the same group will only be
> > +                       reported once, with the RSSI value being averaged out.
> > +
> > +       Possible errors:        Failed
> > +                               Busy
> > +                               No Resources
> > +                               Invalid Parameters
> > +
> > +
> >  Command Complete Event
> >  ======================
> >
> > --
> > 2.29.2.684.gfbc64c5ab5-goog
> >
>
>
> --
> Luiz Augusto von Dentz

Regards,
Archie

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

end of thread, other threads:[~2020-12-16  3:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-15  8:33 [Bluez PATCH v1 1/2] doc/mgmt-api: Add opcode for adding advertisement monitor with RSSI Archie Pusaka
2020-12-15  8:33 ` [Bluez PATCH v1 2/2] lib/mgmt: Adding Add Adv Patterns Monitor RSSI opcode Archie Pusaka
2020-12-15  8:58 ` [Bluez,v1,1/2] doc/mgmt-api: Add opcode for adding advertisement monitor with RSSI bluez.test.bot
2020-12-15 17:54 ` [Bluez PATCH v1 1/2] " Luiz Augusto von Dentz
2020-12-16  3:45   ` Archie Pusaka

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.