summaryrefslogtreecommitdiffstats
path: root/patches/source/bluez/1528118a8f84b4b178729c1f9fc3f6d858c04f9f.patch
blob: c09a54daf19d42e5826ef9918e2adeefbcacde56 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
From 1528118a8f84b4b178729c1f9fc3f6d858c04f9f Mon Sep 17 00:00:00 2001
From: Xiao Yao <xiaoyao@rock-chips.com>
Date: Sun, 17 Dec 2023 21:50:12 +0800
Subject: [PATCH] adapter: Fix link key address type for old kernels

Fixes: https://github.com/bluez/bluez/issues/686

Signed-off-by: Xiao Yao <xiaoyao@rock-chips.com>
---
 src/adapter.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/adapter.c b/src/adapter.c
index ee70b00d2..b4628a411 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -4347,7 +4347,17 @@ static void load_link_keys(struct btd_adapter *adapter, GSList *keys,
 		struct link_key_info *info = l->data;
 
 		bacpy(&key->addr.bdaddr, &info->bdaddr);
-		key->addr.type = info->bdaddr_type;
+
+		/*
+		 * According to the Bluetooth specification, the address
+		 * type of the link key is not fixed. However, the
+		 * load_link_keys function in the old kernel code requires
+		 * that the address type must be BREDR. Since the address
+		 * type is not actually used by the link key, to maintain
+		 * compatibility with older kernel versions, the addr.type
+		 * of the link key is set to BDADDR_BREDR.
+		 */
+		key->addr.type = BDADDR_BREDR;
 		key->type = info->type;
 		memcpy(key->val, info->key, 16);
 		key->pin_len = info->pin_len;