public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [RFC v2 06/12] core: Check if device has RSI
Date: Tue,  7 Mar 2023 14:24:16 -0800	[thread overview]
Message-ID: <20230307222422.2608483-6-luiz.dentz@gmail.com> (raw)
In-Reply-To: <20230307222422.2608483-1-luiz.dentz@gmail.com>

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

This checks if device is advertising an RSI and if so disregards if it
is not discoverable since other members can be.
---
 src/adapter.c | 4 ++--
 src/eir.c     | 3 +++
 src/eir.h     | 2 ++
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/adapter.c b/src/adapter.c
index ae0eb364bad5..7947160a6c5c 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -7122,7 +7122,7 @@ void btd_adapter_update_found_device(struct btd_adapter *adapter,
 
 	dev = btd_adapter_find_device(adapter, bdaddr, bdaddr_type);
 	if (!dev) {
-		if (!discoverable && !monitoring) {
+		if (!discoverable && !monitoring && !eir_data.rsi) {
 			eir_data_free(&eir_data);
 			return;
 		}
@@ -7169,7 +7169,7 @@ void btd_adapter_update_found_device(struct btd_adapter *adapter,
 	/* If there is no matched Adv monitors, don't continue if not
 	 * discoverable or if active discovery filter don't match.
 	 */
-	if (!monitoring && (!discoverable ||
+	if (!eir_data.rsi && !monitoring && (!discoverable ||
 		(adapter->filtered_discovery && !is_filter_match(
 				adapter->discovery_list, &eir_data, rssi)))) {
 		eir_data_free(&eir_data);
diff --git a/src/eir.c b/src/eir.c
index 2f9ee036ffd5..52152c0d7f52 100644
--- a/src/eir.c
+++ b/src/eir.c
@@ -236,6 +236,9 @@ static void eir_parse_data(struct eir_data *eir, uint8_t type,
 	memcpy(ad->data, data, len);
 
 	eir->data_list = g_slist_append(eir->data_list, ad);
+
+	if (type == EIR_CSIP_RSI)
+		eir->rsi = true;
 }
 
 void eir_parse(struct eir_data *eir, const uint8_t *eir_data, uint8_t eir_len)
diff --git a/src/eir.h b/src/eir.h
index 6154e23ec266..a4bf5fbd33f3 100644
--- a/src/eir.h
+++ b/src/eir.h
@@ -37,6 +37,7 @@
 #define EIR_SVC_DATA32              0x20  /* LE: Service data, 32-bit UUID */
 #define EIR_SVC_DATA128             0x21  /* LE: Service data, 128-bit UUID */
 #define EIR_TRANSPORT_DISCOVERY     0x26  /* Transport Discovery Service */
+#define EIR_CSIP_RSI                0x2e  /* Resolvable Set Identifier */
 #define EIR_MANUFACTURER_DATA       0xFF  /* Manufacturer Specific Data */
 
 /* Flags Descriptions */
@@ -76,6 +77,7 @@ struct eir_data {
 	uint32_t class;
 	uint16_t appearance;
 	bool name_complete;
+	bool rsi;
 	int8_t tx_power;
 	uint8_t *hash;
 	uint8_t *randomizer;
-- 
2.39.2


  parent reply	other threads:[~2023-03-07 22:25 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-07 22:24 [RFC v2 01/12] shared/crypto: Add bt_crypto_sirk Luiz Augusto von Dentz
2023-03-07 22:24 ` [RFC v2 02/12] shared/ad: Add RSI data type Luiz Augusto von Dentz
2023-03-07 22:24 ` [RFC v2 03/12] doc: Add set-api Luiz Augusto von Dentz
2023-03-07 22:24 ` [RFC v2 04/12] device-api: Add Set property Luiz Augusto von Dentz
2023-03-07 22:24 ` [RFC v2 05/12] core: Add initial implementation of DeviceSet interface Luiz Augusto von Dentz
2023-03-07 22:24 ` Luiz Augusto von Dentz [this message]
2023-03-07 22:24 ` [RFC v2 07/12] main.conf: Add CSIP profile configurable options Luiz Augusto von Dentz
2023-03-07 22:24 ` [RFC v2 08/12] shared/csip: Add initial code for handling CSIP Luiz Augusto von Dentz
2023-03-07 22:24 ` [RFC v2 09/12] profiles: Add initial code for csip plugin Luiz Augusto von Dentz
2023-03-07 22:24 ` [RFC v2 10/12] tools: Add support to generate RSI using SIRK Luiz Augusto von Dentz
2023-03-07 22:24 ` [RFC v2 11/12] client: Add support for DeviceSet proxy Luiz Augusto von Dentz
2023-03-07 22:24 ` [RFC v2 12/12] client: Use AdvertisingFlags when available Luiz Augusto von Dentz
2023-03-08  2:12 ` [RFC,v2,01/12] shared/crypto: Add bt_crypto_sirk bluez.test.bot
2023-03-11  0:40 ` [RFC v2 01/12] " patchwork-bot+bluetooth
2023-03-13  5:36   ` Luiz Augusto von Dentz
2023-03-13 23:29     ` Pauli Virtanen
2023-03-14  0:18       ` Luiz Augusto von Dentz
2023-03-14  0:57         ` Pauli Virtanen
2023-04-06  0:16           ` Luiz Augusto von Dentz
2023-04-06 18:08             ` Pauli Virtanen
2023-04-06 20:14               ` Luiz Augusto von Dentz
2023-04-13 18:48                 ` Luiz Augusto von Dentz
2023-04-13 21:14                   ` Pauli Virtanen
2023-04-14 21:56                     ` Luiz Augusto von Dentz
2023-04-15 14:57                       ` Pauli Virtanen
2023-04-13 20:11                 ` Pauli Virtanen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230307222422.2608483-6-luiz.dentz@gmail.com \
    --to=luiz.dentz@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox