Linux-Bluetooth Archive on
 help / color / Atom feed
* BlueZ/mesh: RX not working after daemon restart (with workaround)
@ 2019-11-10 20:08 Aurelien Jarno
  2019-11-10 20:59 ` Steve Brown
  0 siblings, 1 reply; 4+ messages in thread
From: Aurelien Jarno @ 2019-11-10 20:08 UTC (permalink / raw)
  To: linux-bluetooth

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(, &caps);
 	mesh.max_filters = caps.max_num_filters;
+	for (int i = 0 ; i < 100 ; i++) {
+		l_main_iterate(10);
+	}
 	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 Jarno                          GPG: 4096R/1DDD8C9B       

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-10 20:08 BlueZ/mesh: RX not working after daemon restart (with workaround) Aurelien Jarno
2019-11-10 20:59 ` Steve Brown
2019-11-10 21:39   ` Aurelien Jarno
2019-11-12  6:44     ` Stotland, Inga

Linux-Bluetooth Archive on

Archives are clonable:
	git clone --mirror linux-bluetooth/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-bluetooth linux-bluetooth/ \
	public-inbox-index linux-bluetooth

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone