mirror of
https://github.com/ublue-os/bazzite.git
synced 2025-01-06 00:58:16 +00:00
72 lines
2.1 KiB
Diff
72 lines
2.1 KiB
Diff
From 52aa25f70651df9e9357fdab47bddd25e096d150 Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Danis?= <frederic.danis@collabora.com>
|
|
Date: Thu, 25 Jan 2024 20:08:05 +0100
|
|
Subject: [PATCH BlueZ 5/5] btgatt-client: Add function to search all primary
|
|
services
|
|
Content-Type: text/plain; charset="utf-8"
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
This is requested to pass PTS GATT/CL/GAD/BV-01-C test.
|
|
---
|
|
tools/btgatt-client.c | 30 +++++++++++++++++++++++-------
|
|
1 file changed, 23 insertions(+), 7 deletions(-)
|
|
|
|
diff --git a/tools/btgatt-client.c b/tools/btgatt-client.c
|
|
index 04fd3ce0f..b47914da3 100644
|
|
--- a/tools/btgatt-client.c
|
|
+++ b/tools/btgatt-client.c
|
|
@@ -1354,13 +1354,6 @@ static void cmd_set_sign_key(struct client *cli, char *cmd_str)
|
|
set_sign_key_usage();
|
|
}
|
|
|
|
-static void search_service_usage(void)
|
|
-{
|
|
- printf("Usage: search-service <uuid>\n"
|
|
- "e.g.:\n"
|
|
- "\tsearch-service 1800\n");
|
|
-}
|
|
-
|
|
static void search_service_cb(bool success, uint8_t att_ecode,
|
|
struct bt_gatt_result *result,
|
|
void *user_data)
|
|
@@ -1392,6 +1385,27 @@ static void search_service_cb(bool success, uint8_t att_ecode,
|
|
PRLOG("\n");
|
|
}
|
|
|
|
+static void cmd_search_all_primary_services(struct client *cli, char *cmd_str)
|
|
+{
|
|
+ if (!bt_gatt_client_is_ready(cli->gatt)) {
|
|
+ printf("GATT client not initialized\n");
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ bt_gatt_discover_all_primary_services(bt_gatt_client_get_att(cli->gatt),
|
|
+ NULL,
|
|
+ search_service_cb,
|
|
+ NULL,
|
|
+ NULL);
|
|
+}
|
|
+
|
|
+static void search_service_usage(void)
|
|
+{
|
|
+ printf("Usage: search-service <uuid>\n"
|
|
+ "e.g.:\n"
|
|
+ "\tsearch-service 1800\n");
|
|
+}
|
|
+
|
|
static void cmd_search_service(struct client *cli, char *cmd_str)
|
|
{
|
|
char *argv[2];
|
|
@@ -1536,6 +1550,8 @@ static struct {
|
|
"\tSet retry on security error by elevating security"},
|
|
{ "set-sign-key", cmd_set_sign_key,
|
|
"\tSet signing key for signed write command"},
|
|
+ { "search-all-primary-services", cmd_search_all_primary_services,
|
|
+ "\tSearch all primary services"},
|
|
{ "search-service", cmd_search_service,
|
|
"\tSearch service"},
|
|
{ "search-characteristics", cmd_search_characteristics,
|
|
--
|
|
2.34.1
|
|
|