summaryrefslogtreecommitdiffstats
path: root/meta/recipes-connectivity/bluez5
diff options
context:
space:
mode:
authorAlexander Kanavin <alex.kanavin@gmail.com>2019-12-05 16:43:45 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-12-09 12:00:42 +0000
commit03a44db3815cc3abdeea7e6cc39fcd1e652ffb6f (patch)
tree9b7b11adfaa93c7b4c561f2618ef40d86b385766 /meta/recipes-connectivity/bluez5
parent79223afc724c52abf8d7722e1a6a55d7d42bff19 (diff)
downloadpoky-03a44db3815cc3abdeea7e6cc39fcd1e652ffb6f.tar.gz
bluez: update 5.50 -> 5.52
Drop a big pile of backports. Disable zsh completions, as they're unlikely to be useful. (From OE-Core rev: dad8cd50bcc4203a65d153dc2445502c1e728975) Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-connectivity/bluez5')
-rw-r--r--meta/recipes-connectivity/bluez5/bluez5.inc22
-rw-r--r--meta/recipes-connectivity/bluez5/bluez5/0001-Allow-using-obexd-without-systemd-in-the-user-sessio.patch12
-rw-r--r--meta/recipes-connectivity/bluez5/bluez5/0001-Makefile.am-Fix-a-race-issue-for-tools.patch30
-rw-r--r--meta/recipes-connectivity/bluez5/bluez5/0001-tools-Fix-build-after-y2038-changes-in-glibc.patch68
-rw-r--r--meta/recipes-connectivity/bluez5/bluez5/0001-tools-btpclient.c-include-signal.h.patch30
-rw-r--r--meta/recipes-connectivity/bluez5/bluez5/CVE-2018-10910.patch505
-rw-r--r--meta/recipes-connectivity/bluez5/bluez5/gcc9-fixes.patch301
-rw-r--r--meta/recipes-connectivity/bluez5/bluez5/out-of-tree.patch26
-rw-r--r--meta/recipes-connectivity/bluez5/bluez5_5.52.bb (renamed from meta/recipes-connectivity/bluez5/bluez5_5.50.bb)4
9 files changed, 16 insertions, 982 deletions
diff --git a/meta/recipes-connectivity/bluez5/bluez5.inc b/meta/recipes-connectivity/bluez5/bluez5.inc
index 484509350b..150d909d73 100644
--- a/meta/recipes-connectivity/bluez5/bluez5.inc
+++ b/meta/recipes-connectivity/bluez5/bluez5.inc
@@ -46,20 +46,13 @@ PACKAGECONFIG[mesh] = "--enable-mesh,--disable-mesh, json-c ell"
46PACKAGECONFIG[btpclient] = "--enable-btpclient,--disable-btpclient, ell" 46PACKAGECONFIG[btpclient] = "--enable-btpclient,--disable-btpclient, ell"
47PACKAGECONFIG[udev] = "--enable-udev,--disable-udev,udev" 47PACKAGECONFIG[udev] = "--enable-udev,--disable-udev,udev"
48 48
49SRC_URI = "\ 49SRC_URI = "${KERNELORG_MIRROR}/linux/bluetooth/bluez-${PV}.tar.xz \
50 ${KERNELORG_MIRROR}/linux/bluetooth/bluez-${PV}.tar.xz \ 50 file://init \
51 file://out-of-tree.patch \ 51 file://run-ptest \
52 file://init \ 52 ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '', 'file://0001-Allow-using-obexd-without-systemd-in-the-user-sessio.patch', d)} \
53 file://run-ptest \ 53 file://0001-tests-add-a-target-for-building-tests-without-runnin.patch \
54 ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '', 'file://0001-Allow-using-obexd-without-systemd-in-the-user-sessio.patch', d)} \ 54 file://0001-test-gatt-Fix-hung-issue.patch \
55 file://0001-tests-add-a-target-for-building-tests-without-runnin.patch \ 55 "
56 file://0001-test-gatt-Fix-hung-issue.patch \
57 file://0001-Makefile.am-Fix-a-race-issue-for-tools.patch \
58 file://CVE-2018-10910.patch \
59 file://gcc9-fixes.patch \
60 file://0001-tools-Fix-build-after-y2038-changes-in-glibc.patch \
61 file://0001-tools-btpclient.c-include-signal.h.patch \
62"
63S = "${WORKDIR}/bluez-${PV}" 56S = "${WORKDIR}/bluez-${PV}"
64 57
65CVE_PRODUCT = "bluez" 58CVE_PRODUCT = "bluez"
@@ -70,6 +63,7 @@ EXTRA_OECONF = "\
70 --enable-test \ 63 --enable-test \
71 --enable-datafiles \ 64 --enable-datafiles \
72 --enable-library \ 65 --enable-library \
66 --without-zsh-completion-dir \
73" 67"
74 68
75# bluez5 builds a large number of useful utilities but does not 69# bluez5 builds a large number of useful utilities but does not
diff --git a/meta/recipes-connectivity/bluez5/bluez5/0001-Allow-using-obexd-without-systemd-in-the-user-sessio.patch b/meta/recipes-connectivity/bluez5/bluez5/0001-Allow-using-obexd-without-systemd-in-the-user-sessio.patch
index da7140922d..618ed734a9 100644
--- a/meta/recipes-connectivity/bluez5/bluez5/0001-Allow-using-obexd-without-systemd-in-the-user-sessio.patch
+++ b/meta/recipes-connectivity/bluez5/bluez5/0001-Allow-using-obexd-without-systemd-in-the-user-sessio.patch
@@ -1,4 +1,4 @@
1From 99ccdbe155028c4c789803a429072675b87d0c3a Mon Sep 17 00:00:00 2001 1From f74eb97c9fb3c0ee2895742e773ac6a3c41c999c Mon Sep 17 00:00:00 2001
2From: Giovanni Campagna <gcampagna-cNUdlRotFMnNLxjTenLetw@public.gmane.org> 2From: Giovanni Campagna <gcampagna-cNUdlRotFMnNLxjTenLetw@public.gmane.org>
3Date: Sat, 12 Oct 2013 17:45:25 +0200 3Date: Sat, 12 Oct 2013 17:45:25 +0200
4Subject: [PATCH] Allow using obexd without systemd in the user session 4Subject: [PATCH] Allow using obexd without systemd in the user session
@@ -17,22 +17,22 @@ http://thread.gmane.org/gmane.linux.bluez.kernel/38725/focus=38843
17Signed-off-by: Javier Viguera <javier.viguera@digi.com> 17Signed-off-by: Javier Viguera <javier.viguera@digi.com>
18 18
19--- 19---
20 Makefile.obexd | 4 ++-- 20 Makefile.obexd | 4 ++--
21 obexd/src/{org.bluez.obex.service => org.bluez.obex.service.in} | 2 +- 21 .../src/{org.bluez.obex.service => org.bluez.obex.service.in} | 2 +-
22 2 files changed, 3 insertions(+), 3 deletions(-) 22 2 files changed, 3 insertions(+), 3 deletions(-)
23 rename obexd/src/{org.bluez.obex.service => org.bluez.obex.service.in} (76%) 23 rename obexd/src/{org.bluez.obex.service => org.bluez.obex.service.in} (76%)
24 24
25diff --git a/Makefile.obexd b/Makefile.obexd 25diff --git a/Makefile.obexd b/Makefile.obexd
26index c462692..0325f66 100644 26index de59d29..73004a3 100644
27--- a/Makefile.obexd 27--- a/Makefile.obexd
28+++ b/Makefile.obexd 28+++ b/Makefile.obexd
29@@ -1,12 +1,12 @@ 29@@ -1,12 +1,12 @@
30 if SYSTEMD 30 if SYSTEMD
31 systemduserunitdir = @SYSTEMD_USERUNITDIR@ 31 systemduserunitdir = $(SYSTEMD_USERUNITDIR)
32 systemduserunit_DATA = obexd/src/obex.service 32 systemduserunit_DATA = obexd/src/obex.service
33+endif 33+endif
34 34
35 dbussessionbusdir = @DBUS_SESSIONBUSDIR@ 35 dbussessionbusdir = $(DBUS_SESSIONBUSDIR)
36 dbussessionbus_DATA = obexd/src/org.bluez.obex.service 36 dbussessionbus_DATA = obexd/src/org.bluez.obex.service
37-endif 37-endif
38 38
diff --git a/meta/recipes-connectivity/bluez5/bluez5/0001-Makefile.am-Fix-a-race-issue-for-tools.patch b/meta/recipes-connectivity/bluez5/bluez5/0001-Makefile.am-Fix-a-race-issue-for-tools.patch
deleted file mode 100644
index b6cb978393..0000000000
--- a/meta/recipes-connectivity/bluez5/bluez5/0001-Makefile.am-Fix-a-race-issue-for-tools.patch
+++ /dev/null
@@ -1,30 +0,0 @@
1Upstream-Status: Backport
2Signed-off-by: Ross Burton <ross.burton@intel.com>
3
4From 117c41242c01e057295aed80ed973c6dc7e35fe2 Mon Sep 17 00:00:00 2001
5From: Ross Burton <ross.burton@intel.com>
6Date: Tue, 8 Oct 2019 11:01:56 +0100
7Subject: [PATCH BlueZ] Makefile.am: add missing mkdir in rules generation
8
9In parallel out-of-tree builds it's possible that tools/*.rules are
10generated before the target directory has been implicitly created. Solve this by
11creating the directory before writing into it.
12---
13 Makefile.am | 1 +
14 1 file changed, 1 insertion(+)
15
16diff --git a/Makefile.am b/Makefile.am
17index 2ac28b23d..e7bcd2366 100644
18--- a/Makefile.am
19+++ b/Makefile.am
20@@ -589,6 +589,7 @@ src/builtin.h: src/genbuiltin $(builtin_sources)
21 $(AM_V_GEN)$(srcdir)/src/genbuiltin $(builtin_modules) > $@
22
23 tools/%.rules:
24+ $(AM_V_at)$(MKDIR_P) tools
25 $(AM_V_GEN)cp $(srcdir)/$(subst 97-,,$@) $@
26
27 $(lib_libbluetooth_la_OBJECTS): $(local_headers)
28--
292.20.1
30
diff --git a/meta/recipes-connectivity/bluez5/bluez5/0001-tools-Fix-build-after-y2038-changes-in-glibc.patch b/meta/recipes-connectivity/bluez5/bluez5/0001-tools-Fix-build-after-y2038-changes-in-glibc.patch
deleted file mode 100644
index 9ca20ae53b..0000000000
--- a/meta/recipes-connectivity/bluez5/bluez5/0001-tools-Fix-build-after-y2038-changes-in-glibc.patch
+++ /dev/null
@@ -1,68 +0,0 @@
1From f36f71f60b1e68c0f12e615b9b128d089ec3dd19 Mon Sep 17 00:00:00 2001
2From: Bastien Nocera <hadess@hadess.net>
3Date: Fri, 7 Jun 2019 09:51:33 +0200
4Subject: [PATCH] tools: Fix build after y2038 changes in glibc
5
6The 32-bit SIOCGSTAMP has been deprecated. Use the deprecated name
7to fix the build.
8
9Upstream-Status: backport commit f36f71f60b1e68c0f12e615b9b128d089ec3dd19
10
11Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
12
13---
14 tools/l2test.c | 6 +++++-
15 tools/rctest.c | 6 +++++-
16 2 files changed, 10 insertions(+), 2 deletions(-)
17
18diff --git a/tools/l2test.c b/tools/l2test.c
19index e755ac881..e787c2ce2 100644
20--- a/tools/l2test.c
21+++ b/tools/l2test.c
22@@ -55,6 +55,10 @@
23 #define BREDR_DEFAULT_PSM 0x1011
24 #define LE_DEFAULT_PSM 0x0080
25
26+#ifndef SIOCGSTAMP_OLD
27+#define SIOCGSTAMP_OLD SIOCGSTAMP
28+#endif
29+
30 /* Test modes */
31 enum {
32 SEND,
33@@ -907,7 +911,7 @@ static void recv_mode(int sk)
34 if (timestamp) {
35 struct timeval tv;
36
37- if (ioctl(sk, SIOCGSTAMP, &tv) < 0) {
38+ if (ioctl(sk, SIOCGSTAMP_OLD, &tv) < 0) {
39 timestamp = 0;
40 memset(ts, 0, sizeof(ts));
41 } else {
42diff --git a/tools/rctest.c b/tools/rctest.c
43index 94490f462..bc8ed875d 100644
44--- a/tools/rctest.c
45+++ b/tools/rctest.c
46@@ -50,6 +50,10 @@
47
48 #include "src/shared/util.h"
49
50+#ifndef SIOCGSTAMP_OLD
51+#define SIOCGSTAMP_OLD SIOCGSTAMP
52+#endif
53+
54 /* Test modes */
55 enum {
56 SEND,
57@@ -505,7 +509,7 @@ static void recv_mode(int sk)
58 if (timestamp) {
59 struct timeval tv;
60
61- if (ioctl(sk, SIOCGSTAMP, &tv) < 0) {
62+ if (ioctl(sk, SIOCGSTAMP_OLD, &tv) < 0) {
63 timestamp = 0;
64 memset(ts, 0, sizeof(ts));
65 } else {
66--
672.19.1
68
diff --git a/meta/recipes-connectivity/bluez5/bluez5/0001-tools-btpclient.c-include-signal.h.patch b/meta/recipes-connectivity/bluez5/bluez5/0001-tools-btpclient.c-include-signal.h.patch
deleted file mode 100644
index 620aaabc68..0000000000
--- a/meta/recipes-connectivity/bluez5/bluez5/0001-tools-btpclient.c-include-signal.h.patch
+++ /dev/null
@@ -1,30 +0,0 @@
1From 0b1766514f6847c7367fce07f19a750ec74c11a6 Mon Sep 17 00:00:00 2001
2From: Robert Yang <liezhi.yang@windriver.com>
3Date: Thu, 26 Sep 2019 16:19:34 +0800
4Subject: [PATCH] tools/btpclient.c: include signal.h
5
6Fix compile failure when configure --enable-btpclient:
7btpclient.c:2834:7: error: 'SIGINT' undeclared (first use in this function)
8
9Upstream-Status: Backport [A subset of the full fix that went upstream]
10
11Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
12---
13 tools/btpclient.c | 1 +
14 1 file changed, 1 insertion(+)
15
16diff --git a/tools/btpclient.c b/tools/btpclient.c
17index b217df5..aece7fe 100644
18--- a/tools/btpclient.c
19+++ b/tools/btpclient.c
20@@ -29,6 +29,7 @@
21 #include <stdlib.h>
22 #include <assert.h>
23 #include <getopt.h>
24+#include <signal.h>
25
26 #include <ell/ell.h>
27
28--
292.7.4
30
diff --git a/meta/recipes-connectivity/bluez5/bluez5/CVE-2018-10910.patch b/meta/recipes-connectivity/bluez5/bluez5/CVE-2018-10910.patch
deleted file mode 100644
index 2a78077443..0000000000
--- a/meta/recipes-connectivity/bluez5/bluez5/CVE-2018-10910.patch
+++ /dev/null
@@ -1,505 +0,0 @@
1From 977321f2c7f974ea68a3d90df296c66189a3f254 Mon Sep 17 00:00:00 2001
2From: Lei Maohui <leimaohui@cn.fujitsu.com>
3Date: Fri, 21 Jun 2019 17:57:35 +0900
4Subject: [PATCH] CVE-2018-10910
5
6A bug in Bluez may allow for the Bluetooth Discoverable state being set to on
7when no Bluetooth agent is registered with the system. This situation could
8lead to the unauthorized pairing of certain Bluetooth devices without any
9form of authentication.
10
11CVE: CVE-2018-10910
12Upstream-Status: Backport
13Signed-off-by: Ross Burton <ross.burton@intel.com>
14
15Subject: [PATCH BlueZ 1/4] client: Add discoverable-timeout command
16From: Luiz Augusto von Dentz <luiz.dentz () gmail ! com>
17Date: 2018-07-25 10:20:32
18Message-ID: 20180725102035.19439-1-luiz.dentz () gmail ! com
19[Download RAW message or body]
20
21From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
22
23This adds discoverable-timeout command which can be used to get/set
24DiscoverableTimeout property:
25
26[bluetooth]# discoverable-timeout 180
27Changing discoverable-timeout 180 succeeded
28---
29 client/main.c | 82 +++++++++++++++++++++++++++++++++-
30 doc/adapter-api.txt | 6 +++
31 src/adapter.c | 125 ++++++++++++++++++++++++++++++++++++++++++++++------
32 3 files changed, 198 insertions(+), 15 deletions(-)
33
34diff --git a/client/main.c b/client/main.c
35index 87323d8..1a66a3a 100644
36--- a/client/main.c
37+++ b/client/main.c
38@@ -877,6 +877,7 @@ static void cmd_show(int argc, char *argv[])
39 print_property(proxy, "Class");
40 print_property(proxy, "Powered");
41 print_property(proxy, "Discoverable");
42+ print_property(proxy, "DiscoverableTimeout");
43 print_property(proxy, "Pairable");
44 print_uuids(proxy);
45 print_property(proxy, "Modalias");
46@@ -1061,6 +1062,47 @@ static void cmd_discoverable(int argc, char *argv[])
47 return bt_shell_noninteractive_quit(EXIT_FAILURE);
48 }
49
50+static void cmd_discoverable_timeout(int argc, char *argv[])
51+{
52+ uint32_t value;
53+ char *endptr = NULL;
54+ char *str;
55+
56+ if (argc < 2) {
57+ DBusMessageIter iter;
58+
59+ if (!g_dbus_proxy_get_property(default_ctrl->proxy,
60+ "DiscoverableTimeout", &iter)) {
61+ bt_shell_printf("Unable to get DiscoverableTimeout\n");
62+ return bt_shell_noninteractive_quit(EXIT_FAILURE);
63+ }
64+
65+ dbus_message_iter_get_basic(&iter, &value);
66+
67+ bt_shell_printf("DiscoverableTimeout: %d seconds\n", value);
68+
69+ return;
70+ }
71+
72+ value = strtol(argv[1], &endptr, 0);
73+ if (!endptr || *endptr != '\0' || value > UINT32_MAX) {
74+ bt_shell_printf("Invalid argument\n");
75+ return bt_shell_noninteractive_quit(EXIT_FAILURE);
76+ }
77+
78+ str = g_strdup_printf("discoverable-timeout %d", value);
79+
80+ if (g_dbus_proxy_set_property_basic(default_ctrl->proxy,
81+ "DiscoverableTimeout",
82+ DBUS_TYPE_UINT32, &value,
83+ generic_callback, str, g_free))
84+ return;
85+
86+ g_free(str);
87+
88+ return bt_shell_noninteractive_quit(EXIT_FAILURE);
89+}
90+
91 static void cmd_agent(int argc, char *argv[])
92 {
93 dbus_bool_t enable;
94@@ -1124,6 +1166,7 @@ static struct set_discovery_filter_args {
95 char **uuids;
96 size_t uuids_len;
97 dbus_bool_t duplicate;
98+ dbus_bool_t discoverable;
99 bool set;
100 } filter = {
101 .rssi = DISTANCE_VAL_INVALID,
102@@ -1163,6 +1206,11 @@ static void set_discovery_filter_setup(DBusMessageIter *iter, void *user_data)
103 DBUS_TYPE_BOOLEAN,
104 &args->duplicate);
105
106+ if (args->discoverable)
107+ g_dbus_dict_append_entry(&dict, "Discoverable",
108+ DBUS_TYPE_BOOLEAN,
109+ &args->discoverable);
110+
111 dbus_message_iter_close_container(iter, &dict);
112 }
113
114@@ -1320,6 +1368,26 @@ static void cmd_scan_filter_duplicate_data(int argc, char *argv[])
115 filter.set = false;
116 }
117
118+static void cmd_scan_filter_discoverable(int argc, char *argv[])
119+{
120+ if (argc < 2 || !strlen(argv[1])) {
121+ bt_shell_printf("Discoverable: %s\n",
122+ filter.discoverable ? "on" : "off");
123+ return bt_shell_noninteractive_quit(EXIT_SUCCESS);
124+ }
125+
126+ if (!strcmp(argv[1], "on"))
127+ filter.discoverable = true;
128+ else if (!strcmp(argv[1], "off"))
129+ filter.discoverable = false;
130+ else {
131+ bt_shell_printf("Invalid option: %s\n", argv[1]);
132+ return bt_shell_noninteractive_quit(EXIT_FAILURE);
133+ }
134+
135+ filter.set = false;
136+}
137+
138 static void filter_clear_uuids(void)
139 {
140 g_strfreev(filter.uuids);
141@@ -1348,6 +1416,11 @@ static void filter_clear_duplicate(void)
142 filter.duplicate = false;
143 }
144
145+static void filter_clear_discoverable(void)
146+{
147+ filter.discoverable = false;
148+}
149+
150 struct clear_entry {
151 const char *name;
152 void (*clear) (void);
153@@ -1359,6 +1432,7 @@ static const struct clear_entry filter_clear[] = {
154 { "pathloss", filter_clear_pathloss },
155 { "transport", filter_clear_transport },
156 { "duplicate-data", filter_clear_duplicate },
157+ { "discoverable", filter_clear_discoverable },
158 {}
159 };
160
161@@ -2468,7 +2542,11 @@ static const struct bt_shell_menu scan_menu = {
162 { "duplicate-data", "[on/off]", cmd_scan_filter_duplicate_data,
163 "Set/Get duplicate data filter",
164 NULL },
165- { "clear", "[uuids/rssi/pathloss/transport/duplicate-data]",
166+ { "discoverable", "[on/off]", cmd_scan_filter_discoverable,
167+ "Set/Get discoverable filter",
168+ NULL },
169+ { "clear",
170+ "[uuids/rssi/pathloss/transport/duplicate-data/discoverable]",
171 cmd_scan_filter_clear,
172 "Clears discovery filter.",
173 filter_clear_generator },
174@@ -2549,6 +2627,8 @@ static const struct bt_shell_menu main_menu = {
175 { "discoverable", "<on/off>", cmd_discoverable,
176 "Set controller discoverable mode",
177 NULL },
178+ { "discoverable-timeout", "[value]", cmd_discoverable_timeout,
179+ "Set discoverable timeout", NULL },
180 { "agent", "<on/off/capability>", cmd_agent,
181 "Enable/disable agent with given capability",
182 capability_generator},
183diff --git a/doc/adapter-api.txt b/doc/adapter-api.txt
184index d14d0ca..4791af2 100644
185--- a/doc/adapter-api.txt
186+++ b/doc/adapter-api.txt
187@@ -113,6 +113,12 @@ Methods void StartDiscovery()
188 generated for either ManufacturerData and
189 ServiceData everytime they are discovered.
190
191+ bool Discoverable (Default: false)
192+
193+ Make adapter discoverable while discovering,
194+ if the adapter is already discoverable this
195+ setting this filter won't do anything.
196+
197 When discovery filter is set, Device objects will be
198 created as new devices with matching criteria are
199 discovered regardless of they are connectable or
200diff --git a/src/adapter.c b/src/adapter.c
201index af340fd..822bd34 100644
202--- a/src/adapter.c
203+++ b/src/adapter.c
204@@ -157,6 +157,7 @@ struct discovery_filter {
205 int16_t rssi;
206 GSList *uuids;
207 bool duplicate;
208+ bool discoverable;
209 };
210
211 struct watch_client {
212@@ -196,6 +197,7 @@ struct btd_adapter {
213 char *name; /* controller device name */
214 char *short_name; /* controller short name */
215 uint32_t supported_settings; /* controller supported settings */
216+ uint32_t pending_settings; /* pending controller settings */
217 uint32_t current_settings; /* current controller settings */
218
219 char *path; /* adapter object path */
220@@ -213,6 +215,7 @@ struct btd_adapter {
221
222 bool discovering; /* discovering property state */
223 bool filtered_discovery; /* we are doing filtered discovery */
224+ bool filtered_discoverable; /* we are doing filtered discovery */
225 bool no_scan_restart_delay; /* when this flag is set, restart scan
226 * without delay */
227 uint8_t discovery_type; /* current active discovery type */
228@@ -509,8 +512,10 @@ static void settings_changed(struct btd_adapter *adapter, uint32_t settings)
229 changed_mask = adapter->current_settings ^ settings;
230
231 adapter->current_settings = settings;
232+ adapter->pending_settings &= ~changed_mask;
233
234 DBG("Changed settings: 0x%08x", changed_mask);
235+ DBG("Pending settings: 0x%08x", adapter->pending_settings);
236
237 if (changed_mask & MGMT_SETTING_POWERED) {
238 g_dbus_emit_property_changed(dbus_conn, adapter->path,
239@@ -596,10 +601,31 @@ static bool set_mode(struct btd_adapter *adapter, uint16_t opcode,
240 uint8_t mode)
241 {
242 struct mgmt_mode cp;
243+ uint32_t setting = 0;
244
245 memset(&cp, 0, sizeof(cp));
246 cp.val = mode;
247
248+ switch (mode) {
249+ case MGMT_OP_SET_POWERED:
250+ setting = MGMT_SETTING_POWERED;
251+ break;
252+ case MGMT_OP_SET_CONNECTABLE:
253+ setting = MGMT_SETTING_CONNECTABLE;
254+ break;
255+ case MGMT_OP_SET_FAST_CONNECTABLE:
256+ setting = MGMT_SETTING_FAST_CONNECTABLE;
257+ break;
258+ case MGMT_OP_SET_DISCOVERABLE:
259+ setting = MGMT_SETTING_DISCOVERABLE;
260+ break;
261+ case MGMT_OP_SET_BONDABLE:
262+ setting = MGMT_SETTING_DISCOVERABLE;
263+ break;
264+ }
265+
266+ adapter->pending_settings |= setting;
267+
268 DBG("sending set mode command for index %u", adapter->dev_id);
269
270 if (mgmt_send(adapter->mgmt, opcode,
271@@ -1818,7 +1844,17 @@ static void discovery_free(void *user_data)
272 g_free(client);
273 }
274
275-static void discovery_remove(struct watch_client *client)
276+static bool set_filtered_discoverable(struct btd_adapter *adapter, bool enable)
277+{
278+ if (adapter->filtered_discoverable == enable)
279+ return true;
280+
281+ adapter->filtered_discoverable = enable;
282+
283+ return set_discoverable(adapter, enable, 0);
284+}
285+
286+static void discovery_remove(struct watch_client *client, bool exit)
287 {
288 struct btd_adapter *adapter = client->adapter;
289
290@@ -1830,7 +1866,27 @@ static void discovery_remove(struct watch_client *client)
291 adapter->discovery_list = g_slist_remove(adapter->discovery_list,
292 client);
293
294- discovery_free(client);
295+ if (adapter->filtered_discoverable &&
296+ client->discovery_filter->discoverable) {
297+ GSList *l;
298+
299+ for (l = adapter->discovery_list; l; l = g_slist_next(l)) {
300+ struct watch_client *client = l->data;
301+
302+ if (client->discovery_filter->discoverable)
303+ break;
304+ }
305+
306+ /* Disable filtered discoverable if there are no clients */
307+ if (!l)
308+ set_filtered_discoverable(adapter, false);
309+ }
310+
311+ if (!exit && client->discovery_filter)
312+ adapter->set_filter_list = g_slist_prepend(
313+ adapter->set_filter_list, client);
314+ else
315+ discovery_free(client);
316
317 /*
318 * If there are other client discoveries in progress, then leave
319@@ -1859,8 +1915,11 @@ static void stop_discovery_complete(uint8_t status, uint16_t length,
320 goto done;
321 }
322
323- if (client->msg)
324+ if (client->msg) {
325 g_dbus_send_reply(dbus_conn, client->msg, DBUS_TYPE_INVALID);
326+ dbus_message_unref(client->msg);
327+ client->msg = NULL;
328+ }
329
330 adapter->discovery_type = 0x00;
331 adapter->discovery_enable = 0x00;
332@@ -1873,7 +1932,7 @@ static void stop_discovery_complete(uint8_t status, uint16_t length,
333 trigger_passive_scanning(adapter);
334
335 done:
336- discovery_remove(client);
337+ discovery_remove(client, false);
338 }
339
340 static int compare_sender(gconstpointer a, gconstpointer b)
341@@ -2094,14 +2153,14 @@ static int update_discovery_filter(struct btd_adapter *adapter)
342 return -EINPROGRESS;
343 }
344
345-static int discovery_stop(struct watch_client *client)
346+static int discovery_stop(struct watch_client *client, bool exit)
347 {
348 struct btd_adapter *adapter = client->adapter;
349 struct mgmt_cp_stop_discovery cp;
350
351 /* Check if there are more client discovering */
352 if (g_slist_next(adapter->discovery_list)) {
353- discovery_remove(client);
354+ discovery_remove(client, exit);
355 update_discovery_filter(adapter);
356 return 0;
357 }
358@@ -2111,7 +2170,7 @@ static int discovery_stop(struct watch_client *client)
359 * and so it is enough to send out the signal and just return.
360 */
361 if (adapter->discovery_enable == 0x00) {
362- discovery_remove(client);
363+ discovery_remove(client, exit);
364 adapter->discovering = false;
365 g_dbus_emit_property_changed(dbus_conn, adapter->path,
366 ADAPTER_INTERFACE, "Discovering");
367@@ -2136,7 +2195,7 @@ static void discovery_disconnect(DBusConnection *conn, void *user_data)
368
369 DBG("owner %s", client->owner);
370
371- discovery_stop(client);
372+ discovery_stop(client, true);
373 }
374
375 /*
376@@ -2200,6 +2259,15 @@ static DBusMessage *start_discovery(DBusConnection *conn,
377 adapter->set_filter_list, client);
378 adapter->discovery_list = g_slist_prepend(
379 adapter->discovery_list, client);
380+
381+ /* Reset discoverable filter if already set */
382+ if (adapter->current_settings & MGMT_OP_SET_DISCOVERABLE)
383+ goto done;
384+
385+ /* Set discoverable if filter requires and it*/
386+ if (client->discovery_filter->discoverable)
387+ set_filtered_discoverable(adapter, true);
388+
389 goto done;
390 }
391
392@@ -2324,6 +2392,17 @@ static bool parse_duplicate_data(DBusMessageIter *value,
393 return true;
394 }
395
396+static bool parse_discoverable(DBusMessageIter *value,
397+ struct discovery_filter *filter)
398+{
399+ if (dbus_message_iter_get_arg_type(value) != DBUS_TYPE_BOOLEAN)
400+ return false;
401+
402+ dbus_message_iter_get_basic(value, &filter->discoverable);
403+
404+ return true;
405+}
406+
407 struct filter_parser {
408 const char *name;
409 bool (*func)(DBusMessageIter *iter, struct discovery_filter *filter);
410@@ -2333,6 +2412,7 @@ struct filter_parser {
411 { "Pathloss", parse_pathloss },
412 { "Transport", parse_transport },
413 { "DuplicateData", parse_duplicate_data },
414+ { "Discoverable", parse_discoverable },
415 { }
416 };
417
418@@ -2372,6 +2452,7 @@ static bool parse_discovery_filter_dict(struct btd_adapter *adapter,
419 (*filter)->rssi = DISTANCE_VAL_INVALID;
420 (*filter)->type = get_scan_type(adapter);
421 (*filter)->duplicate = false;
422+ (*filter)->discoverable = false;
423
424 dbus_message_iter_init(msg, &iter);
425 if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_ARRAY ||
426@@ -2417,8 +2498,10 @@ static bool parse_discovery_filter_dict(struct btd_adapter *adapter,
427 goto invalid_args;
428
429 DBG("filtered discovery params: transport: %d rssi: %d pathloss: %d "
430- " duplicate data: %s ", (*filter)->type, (*filter)->rssi,
431- (*filter)->pathloss, (*filter)->duplicate ? "true" : "false");
432+ " duplicate data: %s discoverable %s", (*filter)->type,
433+ (*filter)->rssi, (*filter)->pathloss,
434+ (*filter)->duplicate ? "true" : "false",
435+ (*filter)->discoverable ? "true" : "false");
436
437 return true;
438
439@@ -2510,7 +2593,7 @@ static DBusMessage *stop_discovery(DBusConnection *conn,
440 if (client->msg)
441 return btd_error_busy(msg);
442
443- err = discovery_stop(client);
444+ err = discovery_stop(client, false);
445 switch (err) {
446 case 0:
447 return dbus_message_new_method_return(msg);
448@@ -2739,13 +2822,15 @@ static void property_set_mode(struct btd_adapter *adapter, uint32_t setting,
449 else
450 current_enable = FALSE;
451
452- if (enable == current_enable) {
453+ if (enable == current_enable || adapter->pending_settings & setting) {
454 g_dbus_pending_property_success(id);
455 return;
456 }
457
458 mode = (enable == TRUE) ? 0x01 : 0x00;
459
460+ adapter->pending_settings |= setting;
461+
462 switch (setting) {
463 case MGMT_SETTING_POWERED:
464 opcode = MGMT_OP_SET_POWERED;
465@@ -2798,7 +2883,7 @@ static void property_set_mode(struct btd_adapter *adapter, uint32_t setting,
466 data->id = id;
467
468 if (mgmt_send(adapter->mgmt, opcode, adapter->dev_id, len, param,
469- property_set_mode_complete, data, g_free) > 0)
470+ property_set_mode_complete, data, g_free) > 0)
471 return;
472
473 g_free(data);
474@@ -2875,6 +2960,7 @@ static void property_set_discoverable_timeout(
475 GDBusPendingPropertySet id, void *user_data)
476 {
477 struct btd_adapter *adapter = user_data;
478+ bool enabled;
479 dbus_uint32_t value;
480
481 dbus_message_iter_get_basic(iter, &value);
482@@ -2888,8 +2974,19 @@ static void property_set_discoverable_timeout(
483 g_dbus_emit_property_changed(dbus_conn, adapter->path,
484 ADAPTER_INTERFACE, "DiscoverableTimeout");
485
486+ if (adapter->pending_settings & MGMT_SETTING_DISCOVERABLE) {
487+ if (adapter->current_settings & MGMT_SETTING_DISCOVERABLE)
488+ enabled = false;
489+ else
490+ enabled = true;
491+ } else {
492+ if (adapter->current_settings & MGMT_SETTING_DISCOVERABLE)
493+ enabled = true;
494+ else
495+ enabled = false;
496+ }
497
498- if (adapter->current_settings & MGMT_SETTING_DISCOVERABLE)
499+ if (enabled)
500 set_discoverable(adapter, 0x01, adapter->discoverable_timeout);
501 }
502
503--
5042.7.4
505
diff --git a/meta/recipes-connectivity/bluez5/bluez5/gcc9-fixes.patch b/meta/recipes-connectivity/bluez5/bluez5/gcc9-fixes.patch
deleted file mode 100644
index ca678e601e..0000000000
--- a/meta/recipes-connectivity/bluez5/bluez5/gcc9-fixes.patch
+++ /dev/null
@@ -1,301 +0,0 @@
1Backported commit from upstream master branch (post 5.50 release), which
2resolves assertion failures in several unit tests.
3
4https://git.kernel.org/pub/scm/bluetooth/bluez.git/patch/?id=0be5246170
5
6Upstream-Status: Backport
7Signed-off-by: Ross Burton <ross.burton@intel.com>
8
9diff --git a/unit/test-avctp.c b/unit/test-avctp.c
10index 3bc3569..24de663 100644
11--- a/unit/test-avctp.c
12+++ b/unit/test-avctp.c
13@@ -43,7 +43,7 @@
14
15 struct test_pdu {
16 bool valid;
17- const uint8_t *data;
18+ uint8_t *data;
19 size_t size;
20 };
21
22@@ -66,7 +66,7 @@ struct context {
23 #define raw_pdu(args...) \
24 { \
25 .valid = true, \
26- .data = data(args), \
27+ .data = g_memdup(data(args), sizeof(data(args))), \
28 .size = sizeof(data(args)), \
29 }
30
31@@ -91,6 +91,11 @@ static void test_debug(const char *str, void *user_data)
32 static void test_free(gconstpointer user_data)
33 {
34 const struct test_data *data = user_data;
35+ struct test_pdu *pdu;
36+ int i;
37+
38+ for (i = 0; (pdu = &data->pdu_list[i]) && pdu->valid; i++)
39+ g_free(pdu->data);
40
41 g_free(data->test_name);
42 g_free(data->pdu_list);
43diff --git a/unit/test-avdtp.c b/unit/test-avdtp.c
44index dd8aed7..e2c951a 100644
45--- a/unit/test-avdtp.c
46+++ b/unit/test-avdtp.c
47@@ -47,7 +47,7 @@
48 struct test_pdu {
49 bool valid;
50 bool fragmented;
51- const uint8_t *data;
52+ uint8_t *data;
53 size_t size;
54 };
55
56@@ -61,7 +61,7 @@ struct test_data {
57 #define raw_pdu(args...) \
58 { \
59 .valid = true, \
60- .data = data(args), \
61+ .data = g_memdup(data(args), sizeof(data(args))), \
62 .size = sizeof(data(args)), \
63 }
64
65@@ -69,7 +69,7 @@ struct test_data {
66 { \
67 .valid = true, \
68 .fragmented = true, \
69- .data = data(args), \
70+ .data = g_memdup(data(args), sizeof(data(args))), \
71 .size = sizeof(data(args)), \
72 }
73
74@@ -81,7 +81,7 @@ struct test_data {
75 static struct test_data data; \
76 data.test_name = g_strdup(name); \
77 data.pdu_list = g_memdup(pdus, sizeof(pdus)); \
78- tester_add(name, &data, NULL, function, NULL); \
79+ tester_add(name, &data, NULL, function, NULL); \
80 } while (0)
81
82 struct context {
83@@ -109,6 +109,11 @@ static void test_debug(const char *str, void *user_data)
84 static void test_free(gconstpointer user_data)
85 {
86 const struct test_data *data = user_data;
87+ struct test_pdu *pdu;
88+ int i;
89+
90+ for (i = 0; (pdu = &data->pdu_list[i]) && pdu->valid; i++)
91+ g_free(pdu->data);
92
93 g_free(data->test_name);
94 g_free(data->pdu_list);
95diff --git a/unit/test-avrcp.c b/unit/test-avrcp.c
96index 01307e6..f1aa353 100644
97--- a/unit/test-avrcp.c
98+++ b/unit/test-avrcp.c
99@@ -49,7 +49,7 @@ struct test_pdu {
100 bool fragmented;
101 bool continuing;
102 bool browse;
103- const uint8_t *data;
104+ uint8_t *data;
105 size_t size;
106 };
107
108@@ -74,7 +74,7 @@ struct context {
109 #define raw_pdu(args...) \
110 { \
111 .valid = true, \
112- .data = data(args), \
113+ .data = g_memdup(data(args), sizeof(data(args))), \
114 .size = sizeof(data(args)), \
115 }
116
117@@ -82,7 +82,7 @@ struct context {
118 { \
119 .valid = true, \
120 .browse = true, \
121- .data = data(args), \
122+ .data = g_memdup(data(args), sizeof(data(args))), \
123 .size = sizeof(data(args)), \
124 }
125
126@@ -90,7 +90,7 @@ struct context {
127 { \
128 .valid = true, \
129 .fragmented = true, \
130- .data = data(args), \
131+ .data = g_memdup(data(args), sizeof(data(args))), \
132 .size = sizeof(data(args)), \
133 }
134
135@@ -98,7 +98,7 @@ struct context {
136 { \
137 .valid = true, \
138 .continuing = true, \
139- .data = data(args), \
140+ .data = g_memdup(data(args), sizeof(data(args))), \
141 .size = sizeof(data(args)), \
142 }
143
144@@ -123,6 +123,11 @@ static void test_debug(const char *str, void *user_data)
145 static void test_free(gconstpointer user_data)
146 {
147 const struct test_data *data = user_data;
148+ struct test_pdu *pdu;
149+ int i;
150+
151+ for (i = 0; (pdu = &data->pdu_list[i]) && pdu->valid; i++)
152+ g_free(pdu->data);
153
154 g_free(data->test_name);
155 g_free(data->pdu_list);
156diff --git a/unit/test-gatt.c b/unit/test-gatt.c
157index c7e28f8..d49f7a0 100644
158--- a/unit/test-gatt.c
159+++ b/unit/test-gatt.c
160@@ -48,7 +48,7 @@
161
162 struct test_pdu {
163 bool valid;
164- const uint8_t *data;
165+ uint8_t *data;
166 size_t size;
167 };
168
169@@ -86,7 +86,7 @@ struct context {
170 #define raw_pdu(args...) \
171 { \
172 .valid = true, \
173- .data = data(args), \
174+ .data = g_memdup(data(args), sizeof(data(args))), \
175 .size = sizeof(data(args)), \
176 }
177
178@@ -306,6 +306,11 @@ static bt_uuid_t uuid_char_128 = {
179 static void test_free(gconstpointer user_data)
180 {
181 const struct test_data *data = user_data;
182+ struct test_pdu *pdu;
183+ int i;
184+
185+ for (i = 0; (pdu = &data->pdu_list[i]) && pdu->valid; i++)
186+ g_free(pdu->data);
187
188 g_free(data->test_name);
189 g_free(data->pdu_list);
190@@ -1911,6 +1916,8 @@ static void test_server(gconstpointer data)
191 g_assert_cmpint(len, ==, pdu.size);
192
193 util_hexdump('<', pdu.data, len, test_debug, "GATT: ");
194+
195+ g_free(pdu.data);
196 }
197
198 static void test_search_primary(gconstpointer data)
199diff --git a/unit/test-hfp.c b/unit/test-hfp.c
200index f2b9622..890eee6 100644
201--- a/unit/test-hfp.c
202+++ b/unit/test-hfp.c
203@@ -43,7 +43,7 @@ struct context {
204
205 struct test_pdu {
206 bool valid;
207- const uint8_t *data;
208+ uint8_t *data;
209 size_t size;
210 enum hfp_gw_cmd_type type;
211 bool fragmented;
212@@ -63,7 +63,7 @@ struct test_data {
213 #define raw_pdu(args...) \
214 { \
215 .valid = true, \
216- .data = data(args), \
217+ .data = g_memdup(data(args), sizeof(data(args))), \
218 .size = sizeof(data(args)), \
219 }
220
221@@ -75,7 +75,7 @@ struct test_data {
222 #define type_pdu(cmd_type, args...) \
223 { \
224 .valid = true, \
225- .data = data(args), \
226+ .data = g_memdup(data(args), sizeof(data(args))), \
227 .size = sizeof(data(args)), \
228 .type = cmd_type, \
229 }
230@@ -83,7 +83,7 @@ struct test_data {
231 #define frg_pdu(args...) \
232 { \
233 .valid = true, \
234- .data = data(args), \
235+ .data = g_memdup(data(args), sizeof(data(args))), \
236 .size = sizeof(data(args)), \
237 .fragmented = true, \
238 }
239@@ -119,6 +119,11 @@ struct test_data {
240 static void test_free(gconstpointer user_data)
241 {
242 const struct test_data *data = user_data;
243+ struct test_pdu *pdu;
244+ int i;
245+
246+ for (i = 0; (pdu = &data->pdu_list[i]) && pdu->valid; i++)
247+ g_free(pdu->data);
248
249 g_free(data->test_name);
250 g_free(data->pdu_list);
251diff --git a/unit/test-hog.c b/unit/test-hog.c
252index d117968..25bdb42 100644
253--- a/unit/test-hog.c
254+++ b/unit/test-hog.c
255@@ -68,11 +68,11 @@ struct context {
256
257 #define data(args...) ((const unsigned char[]) { args })
258
259-#define raw_pdu(args...) \
260-{ \
261- .valid = true, \
262- .data = data(args), \
263- .size = sizeof(data(args)),\
264+#define raw_pdu(args...) \
265+{ \
266+ .valid = true, \
267+ .data = g_memdup(data(args), sizeof(data(args))), \
268+ .size = sizeof(data(args)), \
269 }
270
271 #define false_pdu() \
272diff --git a/unit/test-sdp.c b/unit/test-sdp.c
273index ac921a9..c71ee1f 100644
274--- a/unit/test-sdp.c
275+++ b/unit/test-sdp.c
276@@ -59,14 +59,14 @@ struct test_data {
277 #define raw_pdu(args...) \
278 { \
279 .valid = true, \
280- .raw_data = raw_data(args), \
281+ .raw_data = g_memdup(raw_data(args), sizeof(raw_data(args))), \
282 .raw_size = sizeof(raw_data(args)), \
283 }
284
285 #define raw_pdu_cont(cont, args...) \
286 { \
287 .valid = true, \
288- .raw_data = raw_data(args), \
289+ .raw_data = g_memdup(raw_data(args), sizeof(raw_data(args))), \
290 .raw_size = sizeof(raw_data(args)), \
291 .cont_len = cont, \
292 }
293@@ -103,7 +103,7 @@ struct test_data_de {
294 #define define_test_de_attr(name, input, exp) \
295 do { \
296 static struct test_data_de data; \
297- data.input_data = input; \
298+ data.input_data = g_memdup(input, sizeof(input)); \
299 data.input_size = sizeof(input); \
300 data.expected = exp; \
301 tester_add("/sdp/DE/ATTR/" name, &data, NULL, \
diff --git a/meta/recipes-connectivity/bluez5/bluez5/out-of-tree.patch b/meta/recipes-connectivity/bluez5/bluez5/out-of-tree.patch
deleted file mode 100644
index 76ed779258..0000000000
--- a/meta/recipes-connectivity/bluez5/bluez5/out-of-tree.patch
+++ /dev/null
@@ -1,26 +0,0 @@
1From ed55b49a226ca3909f52416be2ae5ce1c5ca2cb2 Mon Sep 17 00:00:00 2001
2From: Ross Burton <ross.burton@intel.com>
3Date: Fri, 22 Apr 2016 15:40:37 +0100
4Subject: [PATCH] Makefile.obexd: add missing mkdir in builtin.h generation
5
6In parallel out-of-tree builds it's possible that obexd/src/builtin.h is
7generated before the target directory has been implicitly created. Solve this by
8creating the directory before writing into it.
9
10Upstream-Status: Backport
11Signed-off-by: Ross Burton <ross.burton@intel.com>
12---
13 Makefile.obexd | 1 +
14 1 file changed, 1 insertion(+)
15
16diff --git a/Makefile.obexd b/Makefile.obexd
17index 2e33cbc..c8286f0 100644
18--- a/Makefile.obexd
19+++ b/Makefile.obexd
20@@ -105,2 +105,3 @@ obexd/src/plugin.$(OBJEXT): obexd/src/builtin.h
21 obexd/src/builtin.h: obexd/src/genbuiltin $(obexd_builtin_sources)
22+ $(AM_V_at)$(MKDIR_P) $(dir $@)
23 $(AM_V_GEN)$(srcdir)/obexd/src/genbuiltin $(obexd_builtin_modules) > $@
24--
252.8.0.rc3
26
diff --git a/meta/recipes-connectivity/bluez5/bluez5_5.50.bb b/meta/recipes-connectivity/bluez5/bluez5_5.52.bb
index 4e443e5fb0..b86103014b 100644
--- a/meta/recipes-connectivity/bluez5/bluez5_5.50.bb
+++ b/meta/recipes-connectivity/bluez5/bluez5_5.52.bb
@@ -1,7 +1,7 @@
1require bluez5.inc 1require bluez5.inc
2 2
3SRC_URI[md5sum] = "8e35c67c81a55d3ad4c9f22280dae178" 3SRC_URI[md5sum] = "a33eb9aadf1dd4153420958709d3ce60"
4SRC_URI[sha256sum] = "5ffcaae18bbb6155f1591be8c24898dc12f062075a40b538b745bfd477481911" 4SRC_URI[sha256sum] = "f7144ce2039202cfac18ccb52426efea11c98e4f6e1bb8041bcb994b8378560a"
5 5
6# noinst programs in Makefile.tools that are conditional on READLINE 6# noinst programs in Makefile.tools that are conditional on READLINE
7# support 7# support