Repository navigation
Conversation
`wchisp config set <HEX>` was a stub that logged the value and then hit `unimplemented!()`, so it could not be used at all. Implement it as a verbatim write of the RDPR/USER/DATA/WPR config block: - read the current block (to learn its length and log the before value); - accept the new block as hex, optionally `0x`-prefixed, and require it to match the chip's reported block length; - write it with WriteConfig and read back. This is the generic, whole-block counterpart to the existing field-specific `reset_config` / `enable_debug` / `disable_debug`. The intended workflow is `config info` to read the block, edit the bytes, then `config set` to write it back. Help text updated to describe the hex-block format.
`config info` reads with CFG_MASK_ALL and prints the config block followed by the bootloader version and chip UID, while `config set` requires exactly the RDPR/USER/DATA/WPR block. The help text told users to pass the string `config info` prints, which is rejected by the length check. Say which part of that string to use.
Contributor
There was a problem hiding this comment.
Note
Copilot was unable to complete this review at the selected tier due to model policy or plan restrictions.
🟡 Changes recommended
A critical active finding remains because src/main.rs:366 passes a String to Flashing::set_config which expects &str, causing a compilation error unless the value is borrowed (e.g., via &value or value.as_str()).
1 open issue
What changed in this PR
Implements the previously-stubbed wchisp config set <HEX> command to perform a verbatim write of the device’s RDPR/USER/DATA/WPR configuration block, supporting the intended workflow of reading config, editing bytes, and writing the block back.
Changes:
- Updated
config setCLI help text to clarify expected hex input (config block only). - Wired the CLI subcommand to a new flashing-layer implementation.
- Implemented config-block read/length validation, write via
WriteConfig, and read-back logging.
| File | Description |
|---|---|
| src/main.rs | Updates the config set CLI documentation and routes the subcommand to the flashing implementation. |
| src/flashing.rs | Adds set_config to parse/validate a hex config block, write it verbatim to the device, and read it back for logging. |
Review effort: Balanced
This branch has not been deployed
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.

wchisp config set <HEX>is currently a stub: it logs the value and then hitsunimplemented!(). This implements it as a verbatim write of the RDPR/USER/DATA/WPR config block.0x-prefixed) and requires it to match the length the chip reports. Anything else is rejected before writing.This is the whole-block counterpart to
config reset/enable-debug/disable-debug, which only write the per-device preset values. The idea is to read the block withconfig info, edit the bytes, and write it back withconfig set.config inforeads withCFG_MASK_ALLso the string it prints is the config block followed by the bootloader version and chip UID.config settakes only the leading config block (12 bytes) and the help text says so.