Repository navigation
Add sourced console support - #13
Merged
Merged
Conversation
ataffanel
marked this pull request as ready for review
August 31, 2026 13:03
ataffanel
requested review from
evoggy and
stefanthorstenson
and
a lite review from Copilot
August 31, 2026 13:03
Contributor
There was a problem hiding this comment.
Pull request overview
Adds support for “sourced console” discovery and streaming on top of the existing legacy Crazyflie console behavior, including CSV output for catalog listing and bounded cleanup on exit.
Changes:
- Add
console --list-sources(human/CSV) andconsole --source <PATH>(replay history + live streaming) flows. - Update command classification and cleanup logic to treat sourced-console streaming correctly and disable an enabled source before disconnecting.
- Document the new UX and add focused unit tests around argument behavior and source-path rendering.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/modules/console.rs | Implements source catalog listing, not-found errors, and single-source streaming (replay + live). |
| src/main.rs | Routes new console flags, adjusts streaming-command detection, and adds bounded disable-on-exit cleanup. |
| src/cli.rs | Adds --source / --list-sources flags and clap conflict rules. |
| README.md | Documents sourced-console discovery/streaming and updates --csv coverage list. |
| docs/console.md | Adds detailed sourced-console UX docs and timeout/cleanup behavior. |
| Cargo.toml | Bumps crazyflie-link and pins crazyflie-lib to a git rev with sourced-console support. |
| Cargo.lock | Updates lockfile for dependency changes and bumps cfcli version. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+89
to
+90
| *enabled_source = Some(selector); | ||
| cf.console.enable(selector).await?; |
ataffanel
force-pushed
the
sourced-console
branch
from
October 15, 2026 09:00
ba3ad3b to
5116c9f
Compare
ataffanel
force-pushed
the
sourced-console
branch
from
November 5, 2026 13:47
00873db to
89b712c
Compare
crazyflie-lib now exposes all consoles as equal entries, cf:stm32 being one of them, so cfcli no longer treats the STM32 console as a default. Running `console` in a terminal asks which console to show, skipping the question when there is only one. `--source <PATH>` selects it on the command line and is required in non-interactive use, so `console` alone now exits with code 30 there. `--list-sources` is renamed `--list` and includes cf:stm32. Move to the library's handle API, closing the handle in the bounded cleanup after a timeout or a signal. Signal cleanup now applies to every console. Preserved history stays tied to cf:stm32. Not tested on hardware.
The completion cache now also holds the connected Crazyflie's console paths, written on every connection like the param and log names, and `cfcli __complete console-paths` offers them in bash, zsh and PowerShell. Listing the consoles asks the Crazyflie for its catalog, so it is given 500 ms. When it does not answer in time, the paths cached from the previous connection are kept, with cf:stm32 always offered. A cache written by an older cfcli still loads. In bash, ':' splits the word being completed, so the path is rebuilt from the line and only the part after its last ':' is replaced. Files are not offered for --source. Tested on a Crazyflie 2.1 Brushless with a Camera Deck: the cache lists cf:stm32 and deck:bcCam, connecting takes no measurably longer, and Tab completes the paths in bash. zsh and PowerShell were not run.
evoggy
approved these changes
Nov 16, 2026
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
This PR adds support for all of the Crazyflie's consoles to
cfcli, so users can discover and read output from sources such as the Camera Deck. It makes deck startup and runtime messages available from the CLI through CRTP protocol 13. It followscrazyflie-lib-rs, where consoles are a list of equal entries:cf:stm32is no longer a default, it is one of the available consoles.cfcli consolein a terminalcfcli consolenon-interactively--source.cfcli console --source PATHcfcli console --listcf:stm32, in a table or CSV.This is a breaking change for scripts.
cfcli consolewithout a selection now fails when non-interactive, including when only one console exists, because a script would otherwise work until a deck is attached. Usecfcli console --source cf:stm32.The selected console replays available output and continues streaming live output, formatted or raw. The pinned library can retain packets received before console discovery, so replay may include output from an earlier connection. It keeps a 64 KiB budget for these early packets and cannot recover packets lost over radio.
On timeout, Ctrl-C or SIGTERM,
cfclimakes a bounded attempt to close the console before disconnecting. This now applies to every console, so Ctrl-C oncf:stm32exits with code 130 and saves--preserve-consolehistory.--preserve-consolehistory still applies only tocf:stm32. With--source cf:stm32it prints before connecting, so it stays readable if the Crazyflie no longer connects. Through the picker it can only print after connecting. Because the library has no call that returns the history directly, saving reads until output pauses for 10 ms, for at most 500 ms, so very chatty firmware could get a truncated save.--timeoutalso counts the time spent answering the picker, so--sourceshould be used with it.Shell completion offers console paths for
--sourcein bash, zsh and PowerShell, like parameter and log names. The paths are cached on every connection. Listing them asks the Crazyflie for its console catalog, so it gets 500 ms; when that runs out, for example while a deck is still starting, the paths cached from the previous connection are kept andcf:stm32is always offered. In bash,:splits the word being completed, so the path is rebuilt from the line.Related work
Verification
On commit
e60e5af(on top of main at 0.18.0, pinningcrazyflie-lib-rsat0e7ea9f, the current head of bitcraze/crazyflie-lib-rs#66):cargo test --lockedpassed: 122 tests, including the console argument tests and the process-signal cleanup tests.cargo build --lockedpassed.git diff --checkpassed.cfcli --non-interactive consoleexits with code 30.On commit
e0be93c, which adds console path completion:cargo test --lockedpassed: 123 tests, including loading a completion cache written by an oldercfcli.cf:stm32anddeck:bcCam, and a command takes 0.29 s, the same as before.--source de,--source cf:,--source cf:stand--source=deck:bto the full path, and param,--targets,--binand--zipcompletion is unchanged.console-pathsforconsole --source.End-to-end hardware test passed on a Crazyflie 2.1 Brushless with a Camera Deck rev G, running crazyflie-firmware master
d794c5ca(with bitcraze/crazyflie-firmware#1689), camera-deck-firmware main2610869, this library at0e7ea9fandcfcliate60e5af:cf:stm32anddeck:bcCam, in a table and in CSV.deck:bcCamreplays the deck startup log, then streams live output.cf:stm32replays the boot log after a reboot, complete and in order.cf:stm32is listed and it streams normally.--source, exit code 20 for an unknown console.--preserve-consoleprints the savedcf:stm32history before connecting.Before merge
crazyflie-lib-rsversion containing sourced console support.