public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] Add pattern matching for service UUIDs
@ 2024-08-25 20:58 Markus Uhr
  2024-08-25 22:42 ` [v2] " bluez.test.bot
  2024-11-09  9:35 ` [PATCH v2] " Markus Uhr
  0 siblings, 2 replies; 3+ messages in thread
From: Markus Uhr @ 2024-08-25 20:58 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Markus Uhr

This commit extends the pattern matching capabilities of advertisement
monitors with matching for service UUIDs. This functionality was lost
with bc2ab4b (see #652) and not added with b0656c2.
---
 src/shared/ad.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)

diff --git a/src/shared/ad.c b/src/shared/ad.c
index d08ce7af9..53c4628b6 100644
--- a/src/shared/ad.c
+++ b/src/shared/ad.c
@@ -1362,6 +1362,46 @@ static bool match_manufacturer(const void *data, const void *user_data)
 	return false;
 }
 
+static bool match_uuid(const void *data, const void *user_data)
+{
+	const bt_uuid_t *uuid = data;
+	const struct pattern_match_info *info = user_data;
+	const struct bt_ad_pattern *pattern;
+
+	if (!uuid || !info)
+		return false;
+
+	if (info->matched_pattern)
+		return false;
+
+	pattern = info->current_pattern;
+
+	if (!pattern)
+		return false;
+
+	switch (pattern->type) {
+	case BT_AD_UUID16_ALL:
+	case BT_AD_UUID16_SOME:
+		if (pattern->offset != 0 || pattern->len != sizeof(uint16_t))
+			return false;
+		break;
+	case BT_AD_UUID32_ALL:
+	case BT_AD_UUID32_SOME:
+		if (pattern->offset != 0 || pattern->len != sizeof(uint32_t))
+			return false;
+		break;
+	case BT_AD_UUID128_ALL:
+	case BT_AD_UUID128_SOME:
+		if (pattern->offset != 0 || pattern->len != sizeof(uint128_t))
+			return false;
+		break;
+	default:
+		return false;
+	}
+
+	return !memcmp(&uuid->value, pattern->data, pattern->len);
+}
+
 static bool match_service(const void *data, const void *user_data)
 {
 	const struct bt_ad_service_data *service_data = data;
@@ -1451,6 +1491,14 @@ static void pattern_match(void *data, void *user_data)
 		matched = queue_find(ad->manufacturer_data, match_manufacturer,
 				user_data);
 		break;
+	case BT_AD_UUID16_ALL:
+	case BT_AD_UUID16_SOME:
+	case BT_AD_UUID32_ALL:
+	case BT_AD_UUID32_SOME:
+	case BT_AD_UUID128_ALL:
+	case BT_AD_UUID128_SOME:
+		matched = queue_find(ad->service_uuids, match_uuid, user_data);
+		break;
 	case BT_AD_SERVICE_DATA16:
 	case BT_AD_SERVICE_DATA32:
 	case BT_AD_SERVICE_DATA128:
-- 
2.46.0


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

* RE: [v2] Add pattern matching for service UUIDs
  2024-08-25 20:58 [PATCH v2] Add pattern matching for service UUIDs Markus Uhr
@ 2024-08-25 22:42 ` bluez.test.bot
  2024-11-09  9:35 ` [PATCH v2] " Markus Uhr
  1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2024-08-25 22:42 UTC (permalink / raw)
  To: linux-bluetooth, uhrmar

[-- Attachment #1: Type: text/plain, Size: 949 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=883075

---Test result---

Test Summary:
CheckPatch                    PASS      0.49 seconds
GitLint                       PASS      0.33 seconds
BuildEll                      PASS      24.72 seconds
BluezMake                     PASS      1703.42 seconds
MakeCheck                     PASS      12.88 seconds
MakeDistcheck                 PASS      181.22 seconds
CheckValgrind                 PASS      254.17 seconds
CheckSmatch                   PASS      358.38 seconds
bluezmakeextell               PASS      121.75 seconds
IncrementalBuild              PASS      1588.75 seconds
ScanBuild                     PASS      1048.78 seconds



---
Regards,
Linux Bluetooth


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

* Re: [PATCH v2] Add pattern matching for service UUIDs
  2024-08-25 20:58 [PATCH v2] Add pattern matching for service UUIDs Markus Uhr
  2024-08-25 22:42 ` [v2] " bluez.test.bot
@ 2024-11-09  9:35 ` Markus Uhr
  1 sibling, 0 replies; 3+ messages in thread
From: Markus Uhr @ 2024-11-09  9:35 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Markus Uhr

Hi,

I submitted below patch in August. I'm interested in getting it merged,
but I have not received any feedback on it.

If there are any issues with this patch, please let me know. I'm happy
to work on it if more iteration is required.

Best,
Markus

On Sun, 25 Aug 2024 22:58:17 +0200
Markus Uhr <uhrmar@gmail.com> wrote:

> This commit extends the pattern matching capabilities of advertisement
> monitors with matching for service UUIDs. This functionality was lost
> with bc2ab4b (see #652) and not added with b0656c2.
> ---
>  src/shared/ad.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 48 insertions(+)
> 

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

end of thread, other threads:[~2024-11-09  9:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-25 20:58 [PATCH v2] Add pattern matching for service UUIDs Markus Uhr
2024-08-25 22:42 ` [v2] " bluez.test.bot
2024-11-09  9:35 ` [PATCH v2] " Markus Uhr

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox