Commit Graph

1407 Commits

Author SHA1 Message Date
Thomas Göttgens
f623732694 Half-close TCP connections so the last write is not lost
close() went straight to shutdown(SHUT_RDWR) + close(). Doing that while either
side still has unread data makes the stack send RST rather than FIN, and the
device's FromRadio stream means there is essentially always unread data.

Winsock discards data that was received but not yet read when an RST arrives, so
an admin message written moments earlier is thrown away before the device reads
it. Linux delivers the buffered bytes before reporting ECONNRESET, which is why
this only surfaced on Windows: every one-shot TCP write there (--set, --seturl,
--sendtext) reported success and did nothing.

writeConfig() does not wait for an ack, so close() runs microseconds after
sendall(). The device cannot compensate; it polls every 5ms and the RST beats its
next read.

Send FIN first with shutdown(SHUT_WR), which lets the device consume what we
wrote, wait briefly for the reader thread to drain and exit, then tear down
exactly as before. The full shutdown is kept so a reader still blocked in recv()
is unblocked for the join in StreamInterface.close(). The wait is bounded: the
device is not obliged to close just because we half-closed.

Fixes #957
2026-07-17 14:34:18 +02:00
Ian McEwen
5760fb3ad9 Add reconnect for firmware_node 2026-07-07 12:40:25 -07:00
Ian McEwen
2281ea5b64 Set the region on the simradio nodes so we can test setting presets other than LONG_FAST properly 2026-07-07 12:17:34 -07:00
Ian McEwen
7950798378 quick-win review fixes 2026-07-06 14:36:25 -07:00
Ian McEwen
bffaff1c71 Update ch-preset shorthand arguments 2026-07-06 14:16:12 -07:00
Ian McEwen
ceca7b3b10 Add a few extra tests of the revamped channel deletion behavior 2026-07-06 11:26:19 -07:00
Ian McEwen
9b892711df Restructure tests, fix up a few other things, rework smokevirt thoroughly 2026-07-04 02:37:22 -07:00
Ian McEwen
1cd1aed33c Fix pylint/mypy stuff 2026-07-02 23:31:38 -07:00
Ian McEwen
ab14fb2a86 Initial implementation of simradio-based testing with a multi-node simulated mesh 2026-07-02 22:48:01 -07:00
Ian McEwen
b05e545396 guard against None
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-07-01 15:21:25 -07:00
Ian McEwen
b6a13d58fe Refactor DeviceProfile import/export and harden handling
- Unify parsing for yaml/DeviceProfile paths
- Improve autodetection
- Ensure partial-config behavior with yaml
- gate configuration to local node (avoiding some pre-existing bugs)
- gate fixed position updates behind explicit opt-in via position settings field
- use setOwner properly
- tests, tests, and more tests
2026-07-01 13:57:42 -07:00
tylerpieper
8c5efb926c add support for .cfg export/import
adds binary import and export to mirror functionality of android (and soon ios) app
2026-06-29 14:41:16 -07:00
Ian McEwen
74cce6bab9 protobufs: v2.7.26 2026-06-26 12:51:57 -07:00
Ian McEwen
fa01cb7a5d Fix mypy complaint 2026-06-26 11:09:15 -07:00
Ian McEwen
dcdbda0524 feat: add named-flag/power-of-2 bitfield support to --set
This enables e.g. `--set position.position_flags ALTITUDE,SPEED`
rather than the dedicated `--pos-flags`, and similarly for
`network.enabled_protocols`.

Displaying these named values when printing out configurations
is not yet implemented.
2026-06-26 11:01:19 -07:00
Ian McEwen
990ecc2350 Better document how to specify a port when using TCP connection
Fixes #868

Also, fix a pylint complaint.
2026-06-25 14:46:45 -07:00
Ian McEwen
7fc69e957c Fail earlier if the ota update file isn't found 2026-06-25 14:28:32 -07:00
Ian McEwen
f0de977be5 Some more test improvements 2026-06-25 14:07:36 -07:00
Ian McEwen
c118334933 Add tests for the flags_to_list util function 2026-06-18 20:55:13 -07:00
Ian McEwen
405a6bbc5d Fix an issue in to_node_num and add a bunch of tests to it as well 2026-06-16 20:36:06 -07:00
Ian McEwen
db746a0981 pylint appeasement 2026-06-16 20:32:38 -07:00
Ian McEwen
13b8cdcb04 Improve test coverage, use property-based tests 2026-06-16 20:27:14 -07:00
Ian McEwen
9d445098f4 small fixes 2026-06-14 20:39:26 -07:00
Ian McEwen
8c84074c1d pylint appeasement 2026-06-14 19:06:45 -07:00
Ian McEwen
1cffae6add Add support for adding contacts using the CLI, including remotely 2026-06-14 15:28:07 -07:00
Nox
953d01206b Handle NONE errorReason in onResponseTraceRoute and add regression test
ROUTING_APP with errorReason NONE is an ACK (success), not an error.
Only print failure message for non-NONE error reasons.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-04 21:03:49 +08:00
Nox
c71d3df332 Add unit test for onResponseTraceRoute ROUTING_APP error handling
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-04 12:45:59 +08:00
Nox
0413d00825 Handle ROUTING_APP error response in onResponseTraceRoute
Previously, receiving a ROUTING_APP packet in response to a traceroute
would cause the function to attempt parsing it as a RouteDiscovery
payload, resulting in a crash or silent failure followed by a timeout.

This mirrors the error handling already present in onResponseTelemetry
and onResponseWaypoint, but displays the specific errorReason instead
of a hardcoded firmware version message, since traceroute is a
diagnostic tool where the exact failure reason is more valuable.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-03 22:50:56 +08:00
Ian McEwen
c575547fae Merge branch 'review/pr-894'
Closes #894
2026-05-31 18:10:59 -07:00
Ian McEwen
0bef1370d7 tests of new BLEError functionality 2026-05-31 18:10:30 -07:00
Ian McEwen
f9a1357816 Add a BLEError 'kind' field and branch on it instead of string matching 2026-05-31 18:03:26 -07:00
Ian McEwen
6909d3d21f make test more deterministic for reconnect count testing 2026-05-31 15:10:37 -07:00
Ian McEwen
dbf4cabee1 Avoid deadlocking on potentially re-entrant _startConfig call, and don't reconnect when _wantExit 2026-05-31 15:03:58 -07:00
Ian McEwen
435e53eae2 Re-establish the OSError being raised to match former behavior, but still reconnect. TBD if this is quite the right approach. 2026-05-31 14:53:46 -07:00
Ian McEwen
12509bef30 Merge branch 'master' into review/pr-901 2026-05-31 14:30:04 -07:00
Ian McEwen
02485a88fb some pre-merge cleanup 2026-05-31 14:23:34 -07:00
Ian McEwen
4d3553b955 pylint/test fixes 2026-05-31 14:06:08 -07:00
Ian McEwen
95bd3ea7af pylint strikes again 2026-05-31 13:53:47 -07:00
Ian McEwen
ce5bbcda68 Fix some leaks/hangs on close: unstarted StreamInterface streams & TCP reader unblock 2026-05-31 13:48:06 -07:00
Ian McEwen
c2a01f8294 fix a missing paren in a comment 2026-05-31 13:35:24 -07:00
Ian McEwen
14f53398d7 Merge commit 'refs/pull/857/head' of github.com:meshtastic/python into tmp/merge-918-857 2026-05-31 12:52:02 -07:00
Ian McEwen
4d8091a7e3 Merge commit 'refs/pull/918/head' of github.com:meshtastic/python into tmp/merge-918-857 2026-05-31 12:52:01 -07:00
Ian McEwen
15ce4968db pylint fix 2026-05-31 12:48:18 -07:00
Ian McEwen
9c0b253103 Merge branch 'review/pr-883'
Closes #883
2026-05-31 12:43:49 -07:00
Ian McEwen
c7f43b3100 Document the use of --ch-index along with --reply a little 2026-05-31 12:43:38 -07:00
Ian McEwen
8c7eb118fc Merge branch 'review/pr-917'
Closes #917
2026-05-31 12:30:49 -07:00
Ian McEwen
badf7279af Update the other factory reset to use integer too 2026-05-31 12:30:34 -07:00
Ian McEwen
13c9f34589 Merge pull request #911 from syn-ack-ai/fix/position-precision-overwrite
Fix position overwrite by lower-precision data
2026-05-31 12:21:14 -07:00
Ian McEwen
a7d13eb2c1 the fuzz 2026-05-31 10:17:27 -07:00
Ian McEwen
3916009dbd pylint cleanups 2026-05-31 10:01:39 -07:00