Aleksei Sviridkin 9b9df9e585 fix(ble): resolve BLE hangs on macOS without --debug flag
This fixes two issues that caused BLE connections to hang on macOS
when not using the --debug flag:

1. Race condition in BLEClient event loop initialization
   - The event loop thread was started but asyncio operations were
     submitted before the loop was actually running
   - Added threading.Event synchronization to ensure the event loop
     is running before any operations are submitted
   - The ready signal is sent from within the loop via call_soon()
     to guarantee the loop is truly active

2. CoreBluetooth callback delivery on macOS
   - On macOS, CoreBluetooth requires occasional I/O operations for
     callbacks to be properly delivered to the main thread
   - Without --debug, no I/O was happening, causing callbacks to
     never be processed and operations to hang indefinitely
   - Added sys.stdout.flush() call before waiting for async results
     to trigger the necessary I/O

The --debug flag masked these issues because:
- Debug logging introduces timing delays that let the event loop start
- Logger I/O triggers the necessary callback delivery mechanism

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-01-25 03:06:58 +03:00
2025-09-09 18:17:29 +02:00
2023-09-06 13:16:27 -07:00
2025-07-26 22:35:18 -07:00
2025-10-29 08:58:25 -07:00
2020-12-21 14:48:01 +08:00
2022-04-27 11:29:05 -07:00
2026-01-24 09:31:04 -07:00
2024-06-26 13:52:54 -07:00
2022-10-31 19:47:42 +10:00
2024-07-03 09:57:24 -07:00
2025-06-24 10:12:12 -07:00
2023-03-31 20:09:59 +02:00
2025-06-25 12:23:00 -07:00
2022-10-31 19:47:42 +10:00
2021-04-26 18:17:24 +02:00
2025-11-10 13:09:44 -07:00
2026-01-24 16:34:15 +00:00
2022-01-11 16:36:39 -08:00
2025-03-03 11:42:15 -07:00
2024-01-15 21:33:53 +01:00
2023-03-31 20:09:59 +02:00

Meshtastic Logo

Meshtastic Python

A Python library and client for use with Meshtastic devices.

codecov PyPI - Downloads CI CLA assistant Fiscal Contributors GPL-3.0

Overview

This small library (and example application) provides an easy API for sending and receiving messages over mesh radios. It also provides access to any of the operations/data available in the device user interface or the Android application. Events are delivered using a publish-subscribe model, and you can subscribe to only the message types you are interested in.

Call for Contributors

This library and CLI has gone without a consistent maintainer for a while, and there's many improvements that could be made. We're all volunteers here and help is extremely appreciated, whether in implementing your own needs or helping maintain the library and CLI in general.

If you're interested in contributing but don't have specific things you'd like to work on, look at the roadmap below!

Roadmap

This should always be considered a list in progress and flux -- inclusion doesn't guarantee implementation, and exclusion doesn't mean something's not wanted. GitHub issues are a great place to discuss ideas.

  • Types
    • type annotations throughout the codebase, and upgrading mypy running in CI to --strict
  • async-friendliness
  • CLI completeness & consistency
    • the CLI should support all features of the firmware
    • there should be a consistent output format available for shell scripting
  • CLI input validation & documentation
    • what arguments and options are compatible & incompatible with one another?
    • can the options be restructured in a way that is more self-documenting?
    • pubsub events should be documented clearly
  • helpers for third-party code
    • it should be easy to write a script that supports similar options to the CLI so many tools support the same ways of connecting to nodes
  • data storage & processing
    • there should be a standardized way of recording packets for later use, debugging, etc.
    • a persistence layer could also keep track of nodes beyond nodedb, as the apps do
    • a sqlite database schema and tools for writing to it may be a good starting point
    • enable maps, charts, visualizations

Stats

Alt

Description
No description provided
Readme 7.8 MiB
Languages
Python 99.1%
Shell 0.7%
Makefile 0.2%