Commit graph

307 commits

Author SHA1 Message Date
Matthew Wolter
76e2e54157 G4: F17 — re-raise BLE pairing failure instead of swallowing
Why: When BLE pairing failed during connect(), the exception was caught
as a warning and connect() continued normally. This left the transport
in a half-usable state — the BLE link was up but the pairing handshake
never completed, so encrypted characteristics could silently fail.
Now the pairing exception disconnects the client and re-raises, giving
the caller a clean failure. Updated the pre-existing
test_ble_connection_with_pin_failed_pairing test to assert the re-raise
behavior instead of the old swallow-and-continue behavior.
Refs: Forensics report finding F17
2026-04-11 20:25:04 -07:00
Matthew Wolter
fe0dcac90f G4: F16 — re-register disconnect callback after BLE client reset
Why: handle_disconnect resets self.client to self._user_provided_client.
That client's disconnected_callback was not re-registered, so subsequent
BLE disconnects after a successful reconnect cycle were missed —
ConnectionManager never learned the link dropped again. Now re-registers
via set_disconnected_callback with a hasattr guard and try/except for
bleak version compatibility. The next connect() call would also re-create
the client with the callback, but this closes the gap between disconnect
and reconnect.
Refs: Forensics report finding F16
2026-04-11 20:24:24 -07:00
Matthew Wolter
9150a49c6f G4: M06 — add return after oversize-frame state reset
Why: When handle_rx detects an oversize frame header (>300 bytes), it
resets state (header, inframe, frame_expected_size) and re-calls itself
on any remaining data. But when data is empty after the header, the
method fell through to the frame-assembly code with inframe=b"",
eventually dispatching an empty frame to reader.handle_rx. Currently
absorbed by F06's umbrella try/except, but a guaranteed crash if that
guard moves. Adding a bare return after the reset block prevents the
fallthrough in both TCP and serial transports.
Refs: Forensics report finding M06
2026-04-11 20:24:06 -07:00
Matthew Wolter
d6197dc71e G4: F18 — add timeout to serial_cx.connect() event wait
Why: After create_serial_connection, connect() awaited
_connected_event.wait() with no timeout. If the serial device opened
but connection_made was never called (driver bug, USB adapter glitch),
connect() hung indefinitely. Now wrapped in asyncio.wait_for with a
configurable timeout (default 10s). asyncio.TimeoutError propagates
to the caller for clean failure handling.
Refs: Forensics report finding F18
2026-04-11 20:23:44 -07:00
Matthew Wolter
e475a567f0 G4: F04 + NEW-A — symmetric send() failure signaling across all transports
Why: TCP was the only transport that fired _disconnect_callback on a dead
transport or send failure. Serial and BLE returned silently, leaving
ConnectionManager unaware the link was down. Additionally, transport.write()
(TCP/serial) and write_gatt_char (BLE) had no try/except — any write-time
exception escaped the send() coroutine unhandled. This commit makes all three
transports symmetric: (a) fire _disconnect_callback when transport is None/dead,
(b) wrap the write call in try/except and fire _disconnect_callback on failure.
Refs: Forensics report findings F04, NEW-A
2026-04-11 20:23:27 -07:00
Florent
fbf84cbdac v2.3.6 2026-04-09 11:40:02 +02:00
fdlamotte
2d85fe465d
Merge pull request #70 from meshcore-dev/feature/mesh-request-lock
Add mesh request lock to serialize firmware-bound commands
2026-04-09 05:15:31 -04:00
Alex Wolden
5e9cb559e7 Use firmware suggested_timeout for login and path discovery sync methods
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-08 21:42:21 -07:00
Alex Wolden
ed96df197a Fix 16 failing unit tests to match current source behavior
- Update mock dispatcher to use subscribe-before-send pattern matching
  the rewritten CommandHandler.send() method
- Use 32-byte pubkeys in tests for commands that now require
  prefix_length=32 (login, logout, statusreq, reset_path, share/export/remove contact)
- Fix send_trace test path format to match flags=1 (2-byte path hashes)
- Update LPP current test to expect signed wrap for values > 32.767
- Fix BinaryReqType import (moved from meshcore.parsing to meshcore.packets)
- Fix register_binary_request call signature (added pubkey_prefix param)
- Update timeout test to expect 'no_event_received' instead of 'timeout'
2026-04-05 18:38:16 -07:00
Alex Wolden
20f3bccb58 Deprecate fire-and-forget mesh request methods
Add warnings to send_login, send_statusreq, send_telemetry_req, and
send_path_discovery pointing users to their _sync counterparts. The
fire-and-forget versions bypass the mesh request lock and can cause
silent response drops due to firmware clearPendingReqs() behavior.
2026-04-05 18:38:06 -07:00
Alex Wolden
ab3e507e1f Add mesh request lock to serialize firmware-bound mesh commands
The companion firmware can only track one outstanding mesh request at a
time — clearPendingReqs() zeros all pending response flags before each
outgoing mesh request. Overlapping mesh commands cause silent response
drops.

Adds _mesh_request_lock to CommandHandlerBase and wraps all _sync
methods with it. Also adds send_login_sync and send_path_discovery_sync
for complete round-trip serialization of those commands.

Local commands (get_bat, get_channel, set_time, send_msg, etc.) are
unaffected — they don't trigger clearPendingReqs() on the firmware.
2026-04-04 23:18:21 -07:00
Florent
40a70222c8 don't put chan_name in log_rx if we don't know it 2026-03-29 10:53:43 -04:00
Florent
be3aa103c5 adds more min_timeout when fetching lots of neighbours 2026-03-29 07:57:08 -04:00
Florent
fe5096eb9e add hashtag to scope if absent 2026-03-27 20:12:15 -04:00
Florent
4c744888f1 v2.3.2 2026-03-22 12:51:52 -04:00
Florent
eca375dc8a apply frame header fix to tcp as well 2026-03-22 12:51:01 -04:00
fdlamotte
52ad5c201c
Merge pull request #67 from jkingsman/respect-found-idx
Use the frame start once we've found it
2026-03-22 12:48:11 -04:00
Jack Kingsman
4df3655752
Use the frame start once we've found it 2026-03-21 21:08:04 -07:00
Florent
1e33dc5c66 ver bump 2026-03-19 06:40:49 -04:00
fdlamotte
cfafaccb5b
Merge pull request #66 from jkingsman/fix-three-byte-path-packets
Fix bad bitmask on three byte PATH packets
2026-03-19 06:39:34 -04:00
Jack Kingsman
3ad77d364d
Fix three byte path packets 2026-03-18 17:31:17 -07:00
Florent
5bfe63912c set decrypt_channel_logs to False by default 2026-03-11 10:21:29 -04:00
Florent
f507e396e3 v2.3.0 2026-03-10 16:43:45 -04:00
Florent
3c81f67608 uploading missing file 2026-03-09 20:58:43 -04:00
Florent
18528f2ed3 make a class and module for parsing meshcore packets 2026-03-09 18:22:02 -04:00
Florent
f3fce820fc fix error 2026-03-08 15:11:24 -04:00
Florent
5e4663d058 there is still a strange bug with path_len 2026-03-08 08:21:56 -04:00
Florent
01471c0d24 fix nasty bug when updating contact flags 2026-03-08 07:04:33 -04:00
Florent
cda44ae0a0 and if error message does not exist yet 2026-03-07 21:13:30 -04:00
Florent
0d043bc094 fix 2026-03-07 21:05:55 -04:00
Florent
fe2239a8c6 add code_string to error event 2026-03-07 21:05:00 -04:00
Florent
462c4311d3 implement advert_path 2026-03-07 17:42:41 -04:00
Florent
0769afa475 v2.2.25 2026-03-07 07:04:16 -04:00
fdlamotte
0c00118624
Merge pull request #64 from f3sty/64
f-string nested double quote fix
2026-03-07 06:45:49 -04:00
josh
3358916e4c f-string quote fix 2026-03-07 13:58:03 +11:00
Florent
0bfa8003d5 remove some debug printfs 2026-03-06 11:11:54 -04:00
Florent
8087fe643b v2.2.23 2026-03-06 10:40:37 -04:00
Florent
c378319252 some work on multibytes 2026-03-06 10:40:14 -04:00
Florent
f57cb66277 fix silly bug 2026-03-06 08:27:26 -04:00
Florent
1560f240e7 v2.2.21 2026-03-05 21:33:34 -04:00
Florent
563cbfbade complet channel log rx and use timestamp to calculate hashes 2026-03-05 21:32:24 -04:00
Florent
c9bc4193cd v2.2.20 2026-03-05 15:38:39 -04:00
Florent
a83956ec1f some optimizations 2026-03-05 15:37:54 -04:00
Florent
322736024a fix 2026-03-05 14:53:43 -04:00
Florent
601dfabe15 v2.2.18 2026-03-05 14:43:42 -04:00
Florent
91be955044 error when msg_hash was not here 2026-03-05 14:41:19 -04:00
Florent
9f66885594 verify if channels has hashes ... 2026-03-05 13:56:29 -04:00
Florent
af9f90b5bd example to show how to get chan messages with path 2026-03-05 12:35:56 -04:00
Florent
3d47d6d8b2 if possible, add path and rssi to channel messages 2026-03-05 11:50:41 -04:00
Florent
b1abb8e4d3 extract some info from log_rx 2026-03-05 09:32:19 -04:00