From: Aurelien Jarno <aurelien@aurel32.net>
To: linux-bluetooth@vger.kernel.org
Subject: BlueZ/mesh: RX not working after daemon restart (with workaround)
Date: Sun, 10 Nov 2019 21:08:48 +0100 [thread overview]
Message-ID: <20191110200848.GA28864@aurel32.net> (raw)
Hi all,
On my system (Raspberry PI 3), the RX path doesn't work anymore
following a restart of the bluetooth-meshd daemon. I have tracked down
that to the fact that the receive callbacks are setup before the HCI is
fully initialized. Said otherwise, BT_HCI_CMD_LE_SET_SCAN_PARAMETERS is
called before BT_HCI_CMD_RESET and the callback calling
BT_HCI_CMD_LE_SET_SCAN_ENABLE is not called. This timing dependent and
probably not reproducible on all hardware.
I have workarounded the issue by adding a small delay between the HCI
initialization and the call to node_attach_io_all():
diff --git a/mesh/mesh.c b/mesh/mesh.c
index 9b2b2073b..1c06060f9 100644
--- a/mesh/mesh.c
+++ b/mesh/mesh.c
@@ -167,6 +167,10 @@ bool mesh_init(const char *config_dir, enum mesh_io_type type, void *opts)
mesh_io_get_caps(mesh.io, &caps);
mesh.max_filters = caps.max_num_filters;
+ for (int i = 0 ; i < 100 ; i++) {
+ l_main_iterate(10);
+ }
+
node_attach_io_all(mesh.io);
return true;
I guess there is a better way to do that by waiting for the HCI to be
fully initialized before calling node_attach_io_all() or by using a
callback instead. However I do not know the codebase good enough to fix
that properly.
Aurelien
--
Aurelien Jarno GPG: 4096R/1DDD8C9B
aurelien@aurel32.net http://www.aurel32.net
next reply other threads:[~2019-11-10 20:08 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-10 20:08 Aurelien Jarno [this message]
2019-11-10 20:59 ` BlueZ/mesh: RX not working after daemon restart (with workaround) Steve Brown
2019-11-10 21:39 ` Aurelien Jarno
2019-11-12 6:44 ` Stotland, Inga
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191110200848.GA28864@aurel32.net \
--to=aurelien@aurel32.net \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.