Merge branch 'main' into f40

This commit is contained in:
Kyle Gospodnetich 2024-04-06 11:10:10 -07:00
commit 9729ed5d18
12 changed files with 152 additions and 694 deletions

View File

@ -216,7 +216,7 @@ RUN rpm-ostree override replace \
glibc32 \
|| true
# Install Valve's patched Mesa & Pipewire
# Install Valve's patched Mesa, Pipewire & Bluez
# Install patched switcheroo control with proper discrete GPU support
RUN rpm-ostree override remove \
mesa-va-drivers-freeworld && \
@ -231,6 +231,10 @@ RUN rpm-ostree override remove \
mesa-libEGL \
mesa-vulkan-drivers \
mesa-libGL \
bluez \
bluez-cups \
bluez-libs \
bluez-obexd \
pipewire \
pipewire-alsa \
pipewire-gstreamer \
@ -704,15 +708,8 @@ RUN rpm-ostree install \
mv -v /tmp/jupiter-dock-updater-bin/packaged/usr/lib/jupiter-dock-updater /usr/lib/jupiter-dock-updater && \
rm -rf /tmp/jupiter-dock-updater-bin
# Install Steam Deck patched Wireplumber, Bluez & UPower
# Install Steam Deck patched Wireplumber & UPower
RUN rpm-ostree override replace \
--experimental \
--from repo=copr:copr.fedorainfracloud.org:kylegospo:bazzite-multilib \
bluez \
bluez-cups \
bluez-libs \
bluez-obexd && \
rpm-ostree override replace \
--experimental \
--from repo=copr:copr.fedorainfracloud.org:kylegospo:bazzite \
wireplumber \

View File

@ -0,0 +1,67 @@
From 036583f9bbec8540fbd85b980674aad4916d3093 Mon Sep 17 00:00:00 2001
From: Dimitris <dimitris.on.linux@gmail.com>
Date: Thu, 4 Apr 2024 11:30:50 -0700
Subject: [PATCH] device: Add btd_device_bearer_is_connected
This adds btd_device_bearer_is_connected and use it when testing if
device needs to be disconnected.
Fixes: https://github.com/bluez/bluez/issues/785
---
src/adapter.c | 2 +-
src/device.c | 7 ++++++-
src/device.h | 1 +
3 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/adapter.c b/src/adapter.c
index 4bcc464de..017e60233 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -7486,7 +7486,7 @@ static void adapter_remove_connection(struct btd_adapter *adapter,
device_cancel_authentication(device, TRUE);
/* If another bearer is still connected */
- if (btd_device_is_connected(device))
+ if (btd_device_bearer_is_connected(device))
return;
adapter->connections = g_slist_remove(adapter->connections, device);
diff --git a/src/device.c b/src/device.c
index 5e74633c6..74dd67a09 100644
--- a/src/device.c
+++ b/src/device.c
@@ -3273,13 +3273,18 @@ uint8_t btd_device_get_bdaddr_type(struct btd_device *dev)
bool btd_device_is_connected(struct btd_device *dev)
{
- if (dev->bredr_state.connected || dev->le_state.connected)
+ if (btd_device_bearer_is_connected(dev))
return true;
return find_service_with_state(dev->services,
BTD_SERVICE_STATE_CONNECTED);
}
+bool btd_device_bearer_is_connected(struct btd_device *dev)
+{
+ return dev->bredr_state.connected || dev->le_state.connected;
+}
+
static void clear_temporary_timer(struct btd_device *dev)
{
if (dev->temporary_timer) {
diff --git a/src/device.h b/src/device.h
index d4e70b7ef..5722ca9ca 100644
--- a/src/device.h
+++ b/src/device.h
@@ -104,6 +104,7 @@ void device_set_rssi(struct btd_device *device, int8_t rssi);
void device_set_tx_power(struct btd_device *device, int8_t tx_power);
void device_set_flags(struct btd_device *device, uint8_t flags);
bool btd_device_is_connected(struct btd_device *dev);
+bool btd_device_bearer_is_connected(struct btd_device *dev);
uint8_t btd_device_get_bdaddr_type(struct btd_device *dev);
bool device_is_retrying(struct btd_device *device);
void device_bonding_complete(struct btd_device *device, uint8_t bdaddr_type,
--
2.44.0

View File

@ -1,104 +0,0 @@
From 805b1f5bf596d747f28f53191b7a28507efb7797 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:01 +0100
Subject: [PATCH BlueZ 1/5] shared/gatt: Prevent security level change for PTS
GATT tests
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Some PTS GATT tests like GATT/CL/GAR/BI-04-C request to be able to get the
security error and do not try to change the security level.
This commit adds the ability to prevent to change the security level for
an operation.
---
src/shared/att.c | 26 ++++++++++++++++++++++++++
src/shared/att.h | 1 +
src/shared/gatt-client.c | 19 +++++++++++++++++++
src/shared/gatt-client.h | 3 +++
4 files changed, 49 insertions(+)
diff --git a/src/shared/att.c b/src/shared/att.c
index 85feead77..64544f89b 100644
--- a/src/shared/att.c
+++ b/src/shared/att.c
@@ -2034,3 +2034,29 @@ bool bt_att_has_crypto(struct bt_att *att)
return att->crypto ? true : false;
}
+
+bool bt_att_set_retry(struct bt_att *att, unsigned int id, bool retry)
+{
+ struct att_send_op *op;
+
+ if (!id)
+ return false;
+
+ op = queue_find(att->req_queue, match_op_id, UINT_TO_PTR(id));
+ if (op)
+ goto done;
+
+ op = queue_find(att->ind_queue, match_op_id, UINT_TO_PTR(id));
+ if (op)
+ goto done;
+
+ op = queue_find(att->write_queue, match_op_id, UINT_TO_PTR(id));
+
+done:
+ if (!op)
+ return false;
+
+ op->retry = !retry;
+
+ return true;
+}
diff --git a/src/shared/att.h b/src/shared/att.h
index 4aa3de87b..6fd78636e 100644
--- a/src/shared/att.h
+++ b/src/shared/att.h
@@ -110,3 +110,4 @@ bool bt_att_set_local_key(struct bt_att *att, uint8_t sign_key[16],
bool bt_att_set_remote_key(struct bt_att *att, uint8_t sign_key[16],
bt_att_counter_func_t func, void *user_data);
bool bt_att_has_crypto(struct bt_att *att);
+bool bt_att_set_retry(struct bt_att *att, unsigned int id, bool retry);
diff --git a/src/shared/gatt-client.c b/src/shared/gatt-client.c
index efc013a20..2c16e78be 100644
--- a/src/shared/gatt-client.c
+++ b/src/shared/gatt-client.c
@@ -3817,3 +3817,22 @@ bool bt_gatt_client_idle_unregister(struct bt_gatt_client *client,
return false;
}
+
+bool bt_gatt_client_set_retry(struct bt_gatt_client *client,
+ unsigned int id,
+ bool retry)
+{
+ struct request *req;
+
+ if (!client || !id)
+ return false;
+
+ req = queue_find(client->pending_requests, match_req_id,
+ UINT_TO_PTR(id));
+ if (!req)
+ return false;
+
+ bt_att_set_retry(client->att, req->att_id, retry);
+
+ return true;
+}
diff --git a/src/shared/gatt-client.h b/src/shared/gatt-client.h
index bccd04a62..63cf99500 100644
--- a/src/shared/gatt-client.h
+++ b/src/shared/gatt-client.h
@@ -134,3 +134,6 @@ unsigned int bt_gatt_client_idle_register(struct bt_gatt_client *client,
bt_gatt_client_destroy_func_t destroy);
bool bt_gatt_client_idle_unregister(struct bt_gatt_client *client,
unsigned int id);
+bool bt_gatt_client_set_retry(struct bt_gatt_client *client,
+ unsigned int id,
+ bool retry);
--
2.34.1

View File

@ -1,224 +0,0 @@
From c92872e79bdf835060e7a6d2cab2103841f428ac 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:02 +0100
Subject: [PATCH BlueZ 2/5] btgatt-client: Add command to prevent security
level change
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Some PTS GATT tests like GATT/CL/GAR/BI-04-C request to be able to get the
security error and do not try to change the security level.
This commit adds the ability to prevent to change the security level.
---
tools/btgatt-client.c | 84 ++++++++++++++++++++++++++++++++++++-------
1 file changed, 72 insertions(+), 12 deletions(-)
diff --git a/tools/btgatt-client.c b/tools/btgatt-client.c
index 58a03bd48..3bcb7e1cf 100644
--- a/tools/btgatt-client.c
+++ b/tools/btgatt-client.c
@@ -57,6 +57,7 @@ struct client {
struct bt_gatt_client *gatt;
unsigned int reliable_session_id;
+ bool sec_retry;
};
static void print_prompt(void)
@@ -172,6 +173,7 @@ static struct client *client_create(int fd, uint16_t mtu)
fprintf(stderr, "Failed to allocate memory for client\n");
return NULL;
}
+ cli->sec_retry = true;
cli->att = bt_att_new(fd, false);
if (!cli->att) {
@@ -488,6 +490,7 @@ static void cmd_read_multiple(struct client *cli, char *cmd_str)
char *argv[512];
int i;
char *endptr = NULL;
+ unsigned int id;
if (!bt_gatt_client_is_ready(cli->gatt)) {
printf("GATT client not initialized\n");
@@ -514,9 +517,12 @@ static void cmd_read_multiple(struct client *cli, char *cmd_str)
}
}
- if (!bt_gatt_client_read_multiple(cli->gatt, value, argc,
- read_multiple_cb, NULL, NULL))
+ id = bt_gatt_client_read_multiple(cli->gatt, value, argc,
+ read_multiple_cb, NULL, NULL);
+ if (!id)
printf("Failed to initiate read multiple procedure\n");
+ else if (!cli->sec_retry)
+ bt_gatt_client_set_retry(cli->gatt, id, false);
free(value);
}
@@ -558,6 +564,7 @@ static void cmd_read_value(struct client *cli, char *cmd_str)
int argc = 0;
uint16_t handle;
char *endptr = NULL;
+ unsigned int id;
if (!bt_gatt_client_is_ready(cli->gatt)) {
printf("GATT client not initialized\n");
@@ -575,9 +582,12 @@ static void cmd_read_value(struct client *cli, char *cmd_str)
return;
}
- if (!bt_gatt_client_read_value(cli->gatt, handle, read_cb,
- NULL, NULL))
+ id = bt_gatt_client_read_value(cli->gatt, handle, read_cb,
+ NULL, NULL);
+ if (!id)
printf("Failed to initiate read value procedure\n");
+ else if (!cli->sec_retry)
+ bt_gatt_client_set_retry(cli->gatt, id, false);
}
static void read_long_value_usage(void)
@@ -592,6 +602,7 @@ static void cmd_read_long_value(struct client *cli, char *cmd_str)
uint16_t handle;
uint16_t offset;
char *endptr = NULL;
+ unsigned int id;
if (!bt_gatt_client_is_ready(cli->gatt)) {
printf("GATT client not initialized\n");
@@ -616,9 +627,12 @@ static void cmd_read_long_value(struct client *cli, char *cmd_str)
return;
}
- if (!bt_gatt_client_read_long_value(cli->gatt, handle, offset, read_cb,
- NULL, NULL))
+ id = bt_gatt_client_read_long_value(cli->gatt, handle, offset, read_cb,
+ NULL, NULL);
+ if (!id)
printf("Failed to initiate read long value procedure\n");
+ else if (!cli->sec_retry)
+ bt_gatt_client_set_retry(cli->gatt, id, false);
}
static void write_value_usage(void)
@@ -659,6 +673,7 @@ static void cmd_write_value(struct client *cli, char *cmd_str)
uint8_t *value = NULL;
bool without_response = false;
bool signed_write = false;
+ unsigned int id;
if (!bt_gatt_client_is_ready(cli->gatt)) {
printf("GATT client not initialized\n");
@@ -740,10 +755,13 @@ static void cmd_write_value(struct client *cli, char *cmd_str)
goto done;
}
- if (!bt_gatt_client_write_value(cli->gatt, handle, value, length,
+ id = bt_gatt_client_write_value(cli->gatt, handle, value, length,
write_cb,
- NULL, NULL))
+ NULL, NULL);
+ if (!id)
printf("Failed to initiate write procedure\n");
+ else if (!cli->sec_retry)
+ bt_gatt_client_set_retry(cli->gatt, id, false);
done:
free(value);
@@ -789,6 +807,7 @@ static void cmd_write_long_value(struct client *cli, char *cmd_str)
int length;
uint8_t *value = NULL;
bool reliable_writes = false;
+ unsigned int id;
if (!bt_gatt_client_is_ready(cli->gatt)) {
printf("GATT client not initialized\n");
@@ -863,11 +882,14 @@ static void cmd_write_long_value(struct client *cli, char *cmd_str)
}
}
- if (!bt_gatt_client_write_long_value(cli->gatt, reliable_writes, handle,
+ id = bt_gatt_client_write_long_value(cli->gatt, reliable_writes, handle,
offset, value, length,
write_long_cb,
- NULL, NULL))
+ NULL, NULL);
+ if (!id)
printf("Failed to initiate long write procedure\n");
+ else if (!cli->sec_retry)
+ bt_gatt_client_set_retry(cli->gatt, id, false);
free(value);
}
@@ -999,12 +1021,18 @@ done:
value, length,
write_long_cb, NULL,
NULL);
- if (!cli->reliable_session_id)
+ if (!cli->reliable_session_id) {
printf("Failed to proceed prepare write\n");
- else
+ } else {
+ if (!cli->sec_retry)
+ bt_gatt_client_set_retry(cli->gatt,
+ cli->reliable_session_id,
+ false);
+
printf("Prepare write success.\n"
"Session id: %d to be used on next write\n",
cli->reliable_session_id);
+ }
free(value);
}
@@ -1236,6 +1264,36 @@ static void cmd_get_security(struct client *cli, char *cmd_str)
printf("Security level: %u\n", level);
}
+static void set_security_retry_usage(void)
+{
+ printf("Usage: set-security-retry <y/n>\n"
+ "e.g.:\n"
+ "\tset-security-retry n\n");
+}
+
+static void cmd_set_security_retry(struct client *cli, char *cmd_str)
+{
+ char *argv[2];
+ int argc = 0;
+
+ if (!bt_gatt_client_is_ready(cli->gatt)) {
+ printf("GATT client not initialized\n");
+ return;
+ }
+
+ if (!parse_args(cmd_str, 1, argv, &argc) || argc != 1) {
+ set_security_retry_usage();
+ return;
+ }
+
+ if (argv[0][0] == 'y')
+ cli->sec_retry = true;
+ else if (argv[0][0] == 'n')
+ cli->sec_retry = false;
+ else
+ printf("Invalid argument: %s\n", argv[0]);
+}
+
static bool convert_sign_key(char *optarg, uint8_t key[16])
{
int i;
@@ -1327,6 +1385,8 @@ static struct {
"\tSet security level on le connection"},
{ "get-security", cmd_get_security,
"\tGet security level on le connection"},
+ { "set-security-retry", cmd_set_security_retry,
+ "\tSet retry on security error by elevating security"},
{ "set-sign-key", cmd_set_sign_key,
"\tSet signing key for signed write command"},
{ }
--
2.34.1

View File

@ -1,110 +0,0 @@
From fd39b61b38336cba2ef6fb3d0e2884f88e4ef0a8 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:03 +0100
Subject: [PATCH BlueZ 3/5] btgatt-client: Add function to search service based
on UUID
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
This is requested to pass PTS GATT/CL/GAD/BV-02-C test.
---
tools/btgatt-client.c | 69 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 69 insertions(+)
diff --git a/tools/btgatt-client.c b/tools/btgatt-client.c
index 3bcb7e1cf..99a123697 100644
--- a/tools/btgatt-client.c
+++ b/tools/btgatt-client.c
@@ -33,6 +33,7 @@
#include "src/shared/queue.h"
#include "src/shared/gatt-db.h"
#include "src/shared/gatt-client.h"
+#include "src/shared/gatt-helpers.h"
#define ATT_CID 4
@@ -1353,6 +1354,72 @@ 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)
+{
+ struct bt_gatt_iter iter;
+ uint16_t start_handle, end_handle;
+ uint128_t u128;
+ bt_uuid_t uuid;
+ char uuid_str[MAX_LEN_UUID_STR];
+
+ if (!success) {
+ PRLOG("\nService discovery failed: %s (0x%02x)\n",
+ ecode_to_string(att_ecode), att_ecode);
+ return;
+ }
+
+ if (!result || !bt_gatt_iter_init(&iter, result))
+ return;
+
+ printf("\n");
+ while (bt_gatt_iter_next_service(&iter, &start_handle, &end_handle,
+ u128.data)) {
+ bt_uuid128_create(&uuid, u128);
+ bt_uuid_to_string(&uuid, uuid_str, sizeof(uuid_str));
+ printf("Found start handle: 0x%04x, end handle: 0x%04x, "
+ "UUID: %s\n",
+ start_handle, end_handle, uuid_str);
+ }
+ PRLOG("\n");
+}
+
+static void cmd_search_service(struct client *cli, char *cmd_str)
+{
+ char *argv[2];
+ int argc = 0;
+ bt_uuid_t uuid;
+
+ if (!bt_gatt_client_is_ready(cli->gatt)) {
+ printf("GATT client not initialized\n");
+ return;
+ }
+
+ if (!parse_args(cmd_str, 1, argv, &argc) || argc != 1) {
+ search_service_usage();
+ return;
+ }
+
+ if (bt_string_to_uuid(&uuid, argv[0]) < 0) {
+ printf("Invalid UUID: %s\n", argv[0]);
+ return;
+ }
+
+ bt_gatt_discover_primary_services(bt_gatt_client_get_att(cli->gatt),
+ &uuid, 0x0001, 0xFFFF,
+ search_service_cb,
+ NULL,
+ NULL);
+}
+
static void cmd_help(struct client *cli, char *cmd_str);
typedef void (*command_func_t)(struct client *cli, char *cmd_str);
@@ -1389,6 +1456,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-service", cmd_search_service,
+ "\tSearch service"},
{ }
};
--
2.34.1

View File

@ -1,117 +0,0 @@
From b36be985e700374f815c21fa7a787c4740edc1f4 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:04 +0100
Subject: [PATCH BlueZ 4/5] btgatt-client: Add function to search
characteristics
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
This is requested to pass PTS GATT/CL/GAD/BV-05-C test.
This search characteristics based on UUID, start and end handles.
---
tools/btgatt-client.c | 82 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 82 insertions(+)
diff --git a/tools/btgatt-client.c b/tools/btgatt-client.c
index 99a123697..04fd3ce0f 100644
--- a/tools/btgatt-client.c
+++ b/tools/btgatt-client.c
@@ -1420,6 +1420,86 @@ static void cmd_search_service(struct client *cli, char *cmd_str)
NULL);
}
+static void search_characteristics_usage(void)
+{
+ printf("Usage: search-characteristics <start_hanlde> <end_handle> "
+ "<uuid>\n"
+ "e.g.:\n"
+ "\tsearch-characteristics 0x0001 0xFFFF 1800\n");
+}
+
+static void search_characteristics_cb(bool success, uint8_t att_ecode,
+ struct bt_gatt_result *result,
+ void *user_data)
+{
+ struct bt_gatt_iter iter;
+ uint16_t handle, length;
+ const uint8_t *value;
+ int i;
+
+ if (!success) {
+ PRLOG("\nCharacteristics discovery failed: %s (0x%02x)\n",
+ ecode_to_string(att_ecode), att_ecode);
+ return;
+ }
+
+ if (!result || !bt_gatt_iter_init(&iter, result))
+ return;
+
+ printf("\n");
+ while (bt_gatt_iter_next_read_by_type(&iter, &handle, &length,
+ &value)) {
+ printf("Found handle: 0x%04x value: ", handle);
+ for (i = 0; i < length; i++)
+ printf("%02x ", value[i]);
+ printf("\n");
+ }
+ PRLOG("\n");
+}
+
+static void cmd_search_characteristics(struct client *cli, char *cmd_str)
+{
+ char *argv[4];
+ int argc = 0;
+ uint16_t start_handle, end_handle;
+ char *endptr = NULL;
+ bt_uuid_t uuid;
+
+ if (!bt_gatt_client_is_ready(cli->gatt)) {
+ printf("GATT client not initialized\n");
+ return;
+ }
+
+ if (!parse_args(cmd_str, 3, argv, &argc) || argc != 3) {
+ search_characteristics_usage();
+ return;
+ }
+
+ start_handle = strtol(argv[0], &endptr, 0);
+ if (!endptr || *endptr != '\0') {
+ printf("Invalid start handle: %s\n", argv[0]);
+ return;
+ }
+
+ end_handle = strtol(argv[1], &endptr, 0);
+ if (!endptr || *endptr != '\0') {
+ printf("Invalid end handle: %s\n", argv[1]);
+ return;
+ }
+
+ if (bt_string_to_uuid(&uuid, argv[2]) < 0) {
+ printf("Invalid UUID: %s\n", argv[2]);
+ return;
+ }
+
+ bt_gatt_read_by_type(bt_gatt_client_get_att(cli->gatt), start_handle,
+ end_handle,
+ &uuid,
+ search_characteristics_cb,
+ NULL,
+ NULL);
+}
+
static void cmd_help(struct client *cli, char *cmd_str);
typedef void (*command_func_t)(struct client *cli, char *cmd_str);
@@ -1458,6 +1538,8 @@ static struct {
"\tSet signing key for signed write command"},
{ "search-service", cmd_search_service,
"\tSearch service"},
+ { "search-characteristics", cmd_search_characteristics,
+ "\tSearch characteristics"},
{ }
};
--
2.34.1

View File

@ -1,71 +0,0 @@
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

View File

@ -1,15 +0,0 @@
diff -ru bluez-5.66.orig/profiles/audio/avrcp.c bluez-5.66/profiles/audio/avrcp.c
--- bluez-5.66.orig/profiles/audio/avrcp.c 2022-03-16 08:06:20.000000000 -0700
+++ bluez-5.66/profiles/audio/avrcp.c 2023-07-30 08:03:17.414213611 -0700
@@ -1210,6 +1210,10 @@
GUINT_TO_POINTER(str_to_metadata(key)));
}
+ if (attrs == NULL)
+ return g_list_prepend(NULL,
+ GUINT_TO_POINTER(AVRCP_MEDIA_ATTRIBUTE_TITLE));
+
return attrs;
}
Only in bluez-5.66/profiles/audio: avrcp.c.orig

View File

@ -5,7 +5,7 @@
%endif
Name: bluez
Version: 5.72
Version: 5.73
Release: 3%{?dist}.bazzite.{{{ git_dir_version }}}
Summary: Bluetooth utilities
License: GPLv2+
@ -14,18 +14,16 @@ URL: https://www.bluez.org/
Source0: https://www.kernel.org/pub/linux/bluetooth/%{name}-%{version}.tar.xz
Source1: bluez.gitignore
# https://lore.kernel.org/linux-bluetooth/20220901110719.176944-1-hadess@hadess.net/T/#m9c08d004cd5422783ee1d93154f42303bba9169f
Patch2: power-state-adapter-property.patch
Patch0: device-fix-device_is_connected-checking-for-services.patch
# https://git.kernel.org/pub/scm/bluetooth/bluez.git/commit/?id=036583f9bbec8540fbd85b980674aad4916d3093
# https://github.com/bluez/bluez/issues/785
# https://bugzilla.redhat.com/show_bug.cgi?id=2269516
# Fix busy loop when disabling interface while device is connected
Patch1: 0001-device-Add-btd_device_bearer_is_connected.patch
# Valve
Patch3: AVRCP_TG_MDI_BV-04-C.patch
Patch4: 0001-valve-bluetooth-config.patch
Patch5: 0002-valve-bluetooth-phy.patch
Patch6: 0006-shared-gatt-Prevent-security-level-change-for-PTS-GA.patch
Patch7: 0007-btgatt-client-Add-command-to-prevent-security-level-.patch
Patch8: 0008-btgatt-client-Add-function-to-search-service-based-o.patch
Patch9: 0009-btgatt-client-Add-function-to-search-characteristics.patch
Patch10: 0010-btgatt-client-Add-function-to-search-all-primary-ser.patch
BuildRequires: dbus-devel >= 1.6
BuildRequires: glib2-devel
@ -61,10 +59,7 @@ Utilities for use in Bluetooth applications:
- btattach
- btmon
- hex2hcd
- l2ping
- l2test
- mpris-proxy
- rctest
The BLUETOOTH trademarks are owned by Bluetooth SIG, Inc., U.S.A.
@ -92,6 +87,7 @@ be dropped by upstream. Utilities include:
- hciconfig
- hcidump
- hcitool
- meshctl
- rfcomm
- sdptool
%endif
@ -259,14 +255,12 @@ install emulator/btvirt ${RPM_BUILD_ROOT}/%{_libexecdir}/bluetooth/
%{_bindir}/btmgmt
%{_bindir}/btmon
%{_bindir}/hex2hcd
%{_bindir}/l2ping
%{_bindir}/mpris-proxy
%{_mandir}/man1/bluetoothctl.1.*
%{_mandir}/man1/bluetoothctl-*.1.*
%{_mandir}/man1/btmgmt.1.*
%{_mandir}/man1/btattach.1.*
%{_mandir}/man1/btmon.1.*
%{_mandir}/man1/l2ping.1.*
%{_mandir}/man8/bluetoothd.8.*
%dir %{_libexecdir}/bluetooth
%{_libexecdir}/bluetooth/bluetoothd
@ -308,8 +302,10 @@ install emulator/btvirt ${RPM_BUILD_ROOT}/%{_libexecdir}/bluetooth/
%doc doc/*txt
%{_bindir}/isotest
%{_bindir}/l2test
%{_bindir}/l2ping
%{_bindir}/rctest
%{_mandir}/man1/isotest.1.*
%{_mandir}/man1/l2ping.1.*
%{_mandir}/man1/rctest.1.*
%{_mandir}/man5/org.bluez.*.5.*
%{_libdir}/libbluetooth.so
@ -340,9 +336,19 @@ install emulator/btvirt ${RPM_BUILD_ROOT}/%{_libexecdir}/bluetooth/
%files obexd
%{_libexecdir}/bluetooth/obexd
%{_datadir}/dbus-1/services/org.bluez.obex.service
/usr/lib/systemd/user/dbus-org.bluez.obex.service
%{_userunitdir}/obex.service
%changelog
* Thu Apr 04 2024 Adam Williamson <awilliam@redhat.com> - 5.73-3
- Backport further upstream fix for connected device checks (#2269516)
* Mon Mar 18 2024 Peter Robinson <pbrobinson@fedoraproject.org> - 5.73-2
- Upstream fix for connected device checks
* Fri Mar 08 2024 Peter Robinson <pbrobinson@fedoraproject.org> - 5.73-1
- Update to 5.73
* Tue Jan 23 2024 Fedora Release Engineering <releng@fedoraproject.org> - 5.72-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

View File

@ -0,0 +1,57 @@
From 9a0e675193666a36d76fe7da89fdd74ef50217a5 Mon Sep 17 00:00:00 2001
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Date: Mon, 18 Mar 2024 16:08:31 +0000
Subject: [PATCH] device: Fix device_is_connected checking for services being
connected
Change 44d3f67277f83983e1e9697eda7b9aeb40ca231d since to have introduced
quite a few bugs related to device_is_connected return true which
prevents proper cleanup of connection.
Fixes: https://github.com/bluez/bluez/issues/774
Fixes: https://github.com/bluez/bluez/issues/778
Fixes: https://github.com/bluez/bluez/issues/783
Fixes: https://github.com/bluez/bluez/issues/784
---
src/device.c | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
diff --git a/src/device.c b/src/device.c
index aecceb100..b5b574233 100644
--- a/src/device.c
+++ b/src/device.c
@@ -3324,22 +3324,24 @@ void device_add_connection(struct btd_device *dev, uint8_t bdaddr_type,
"Connected");
}
+static bool device_service_connected(struct btd_device *dev)
+{
+ if (find_service_with_state(dev->services,
+ BTD_SERVICE_STATE_CONNECTING))
+ return true;
+
+ return find_service_with_state(dev->services,
+ BTD_SERVICE_STATE_CONNECTED);
+}
+
static bool device_disappeared(gpointer user_data)
{
struct btd_device *dev = user_data;
- if (btd_device_is_connected(dev)) {
- char addr[18];
- ba2str(&dev->bdaddr, addr);
- DBG("Device %s is marked as connected", dev->path);
- return TRUE;
- }
-
- /* If there are services connecting restart the timer to give more time
+ /* If there are services connected restart the timer to give more time
* for the service to either complete the connection or disconnect.
*/
- if (find_service_with_state(dev->services,
- BTD_SERVICE_STATE_CONNECTING))
+ if (device_service_connected(dev))
return TRUE;
dev->temporary_timer = 0;

View File

@ -1,28 +0,0 @@
From 70309219acd4c81e3a9e2b3652d2d93eb08b0aee Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Wed, 31 Aug 2022 11:16:34 +0200
Subject: [PATCH 6/6] adapter: Remove experimental flag for PowerState
Now that the feature has been tested, that the API is deemed adequate
and the reliability sufficient.
---
src/adapter.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/adapter.c b/src/adapter.c
index 8fb2acdc8..841096d7f 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -3864,8 +3864,7 @@ static const GDBusPropertyTable adapter_properties[] = {
{ "Alias", "s", property_get_alias, property_set_alias },
{ "Class", "u", property_get_class },
{ "Powered", "b", property_get_powered, property_set_powered },
- { "PowerState", "s", property_get_power_state, NULL, NULL,
- G_DBUS_PROPERTY_FLAG_EXPERIMENTAL },
+ { "PowerState", "s", property_get_power_state },
{ "Discoverable", "b", property_get_discoverable,
property_set_discoverable },
{ "DiscoverableTimeout", "u", property_get_discoverable_timeout,
--
2.37.2

View File

@ -6,7 +6,7 @@ if [[ $IMAGE_FLAVOR = "nvidia" ]]; then
echo -e 'You are using a Nvidia image, but the Nvidia driver is not loaded:\n - If you are using secure boot, run "ujust enroll-secure-boot-key", then reboot and enter the password "ublue-os" when prompted.\n - If you are not using secure boot or have already enrolled the above key, ensure you have the needed kargs by running "ujust configure-nvidia kargs" and then rebooting.\n - This message will not appear if the issue is resolved.\n'
fi
else
if ! grep -q "v4l2loopback" <<< $(lsmod); then
echo -e 'Requires drivers could not be loaded:\n - If you are using secure boot, run "ujust enroll-secure-boot-key", then reboot and enter the password "ublue-os" when prompted.\n - This message will not appear if the issue is resolved.\n'
if ! grep -q "xone-dongle" <<< $(lsmod); then
echo -e 'Required drivers could not be loaded:\n - If you are using secure boot, run "ujust enroll-secure-boot-key", then reboot and enter the password "ublue-os" when prompted.\n - This message will not appear if the issue is resolved.\n'
fi
fi