diff --git a/meshtastic/__init__.py b/meshtastic/__init__.py index 5e90061..7049e19 100644 --- a/meshtastic/__init__.py +++ b/meshtastic/__init__.py @@ -740,7 +740,7 @@ class StreamInterface(MeshInterface): self._wantExit = False # FIXME, figure out why daemon=True causes reader thread to exit too early - self._rxThread = threading.Thread(target=self.__reader, args=()) + self._rxThread = threading.Thread(target=self.__reader, args=(), daemon=True) MeshInterface.__init__(self, debugOut=debugOut, noProto=noProto) diff --git a/meshtastic/__main__.py b/meshtastic/__main__.py index b2a773f..83b7d23 100644 --- a/meshtastic/__main__.py +++ b/meshtastic/__main__.py @@ -405,7 +405,10 @@ def subscribe(): """Subscribe to the topics the user probably wants to see, prints output to stdout""" pub.subscribe(onReceive, "meshtastic.receive") # pub.subscribe(onConnection, "meshtastic.connection") - pub.subscribe(onConnected, "meshtastic.connection.established") + + # We now call onConnected from main + # pub.subscribe(onConnected, "meshtastic.connection.established") + # pub.subscribe(onNode, "meshtastic.node") @@ -464,6 +467,9 @@ def common(): else: client = SerialInterface( args.port, debugOut=logfile, noProto=args.noproto) + + # We assume client is fully connected now + onConnected(client) # don't call exit, background threads might be running still # sys.exit(0)