Repository navigation
fix: re-enable LAN after stopping SD card logging - #159
Merged
Merged
Conversation
StartSdCardLoggingAsync disables LAN (SD card and WiFi share the SPI bus), but StopSdCardLoggingAsync never re-enabled it. This left WiFi/LAN silently disabled after SD logging was stopped. Every other SD operation (GetSdCardFilesAsync, DeleteSdCardFileAsync, DownloadSdCardFileAsync) correctly restored LAN in their finally blocks via PrepareLanInterface(). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Entire-Checkpoint: a0fb8798807b
ⓘ You are approaching your monthly quota for Qodo. Upgrade your plan Review Summary by QodoRe-enable LAN after stopping SD card logging
WalkthroughsDescription• Re-enable LAN interface after stopping SD card logging • StartSdCardLoggingAsync disables LAN (shared SPI bus), but StopSdCardLoggingAsync never restored it • Left WiFi/LAN silently disabled after SD logging sessions • Updated test to verify LAN re-enable command is sent Diagramflowchart LR
A["StartSdCardLoggingAsync<br/>disables LAN"] --> B["SD card logging active"]
B --> C["StopSdCardLoggingAsync"]
C --> D["Stop stream data"]
D --> E["Disable SD storage"]
E --> F["Restore USB interface"]
F --> G["Re-enable LAN interface<br/>NEW"]
G --> H["LAN restored"]
File Changes1. src/Daqifi.Core/Device/DaqifiStreamingDevice.cs
|
Code Review by Qodo
1.
|
StopStreaming() is a no-op when IsStreaming is false, but IsStreaming can be stale (issue #118). Other SD operations already use the defensive pattern of unconditionally sending the stop command. Apply the same pattern here and add a test verifying the command is sent even when IsStreaming is false. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
cptkoolbeenz
added a commit
that referenced
this pull request
Jul 18, 2026
Two real defects the pre-merge review caught, both blocking the feature: - Qodo "WiFi SD ops disable LAN" (Correctness, high): PrepareSdInterface() unconditionally sent DisableNetworkLan to free the shared SPI bus for the SD card — correct for USB, but over WiFi it tears down the very TCP channel that carries the SD reply (codebase precedent: PRs #153/#159). Firmware #598/#599 disable the enable-level SPI mutex because the Harmony SPI driver arbitrates SD/WiFi transactions on the shared bus (app_freertos.c: "transaction-level arbitration", 7+ hours stable concurrent operation), and the reply routes back over the requesting interface. So PrepareSdInterface/PrepareLanInterface are now transport-aware: over WiFi the LAN is left enabled (only the SD subsystem is toggled); over USB the LAN disable/restore is unchanged. - Audit "overflowing firmware strings crash the gate" (crash, low): the regex matches an unbounded digit run for the major component but FirmwareVersion. TryParse used int.Parse (throws) for major vs int.TryParse (safe) for minor/patch — a TryParse that violates its no-throw contract. A corrupted/ spoofed DeviceFwRev like "999999999999999999.0.0" (untrusted wire string on the non-USB path the gate hardens) threw OverflowException instead of failing closed to FeatureNotSupportedException. Fixed at the root: major now uses int.TryParse and an out-of-range version is reported unparseable, symmetric with minor/patch. Tests: WiFi PrepareSdInterface/PrepareLanInterface leave-LAN-alone coverage + USB toggle regression; SD-over-WiFi LIST asserts LAN untouched; TryParse overflow cases; NetworkConfigurableTests device marked USB (its interface-prep assertions encode the USB sequence). Full suite 1404 passed / 0 failed / 2 skipped. Claude-Session: https://claude.ai/code/session_01PK5697Y1eDH3DB75Tii5Nh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
StopSdCardLoggingAsync()never re-enabled the LAN interface after stopping SD card logging.StartSdCardLoggingAsync()disables LAN because the SD card and WiFi share the SPI bus, but the stop method only disabled SD storage and restored the stream interface to USB — it never sentSYSTem:COMMunicate:LAN:ENAbled 1.GetSdCardFilesAsync,DeleteSdCardFileAsync,DownloadSdCardFileAsync) correctly restored LAN viaPrepareLanInterface()in theirfinallyblocks.StopSdCardLoggingAsync_SendsCorrectCommandsasserted only 3 commands (matching the buggy behavior). Updated to assert 4 commands including the LAN re-enable.Test plan
🤖 Generated with Claude Code