Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
0f09eee
Make idol_result return a Loadable type
mkeeter May 7, 2026
5171b49
Automatically unpack `value` member of REPLY
mkeeter May 18, 2026
f1b8bcc
Make hiffy_decode return a non-nested error
mkeeter May 7, 2026
bccc530
Dispatch on an `enum Subcommand`
mkeeter May 13, 2026
00588c8
Rename humility-cmd -> humility-hexdump
mkeeter May 13, 2026
4c980ca
Update README
mkeeter May 13, 2026
11ce6e2
Introduce `humility-vpd-lib`
labbott May 19, 2026
84d55ab
license and fmt
labbott May 19, 2026
2c5399b
clippy
labbott May 19, 2026
b824513
spelling
labbott May 19, 2026
a6a5711
Old humility setup
labbott May 19, 2026
7da3949
drop loopback support
labbott May 20, 2026
edbe30b
just take the `anyhow` error
labbott May 20, 2026
c68f772
drop deps
labbott May 20, 2026
5b655e6
only you can prevent namespace polution
labbott May 20, 2026
aed53a0
const
labbott May 20, 2026
50a24c5
Use duration
labbott May 20, 2026
d6d5fdf
Add `HubrisArchive::load_from_path`
labbott May 21, 2026
42ce304
cleanup examples
labbott May 21, 2026
28983d9
Introduce extension trait for attaching
labbott May 21, 2026
ad0ed80
fmt
labbott May 21, 2026
62f286e
clippy
labbott May 21, 2026
97c9748
Try the extension trait
labbott May 21, 2026
1c81e47
re-order checks
labbott May 21, 2026
4aef909
Fix list
labbott May 21, 2026
ac1919e
switch from String -> Path
labbott May 21, 2026
c8e15af
Bring back some messages to the humility binary
labbott May 21, 2026
60717b2
Make that borrowed
labbott May 21, 2026
fd2558a
Out of date comment
labbott May 21, 2026
99406cc
single line
labbott May 21, 2026
3b5601f
Remove comment
labbott May 21, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 36 additions & 68 deletions Cargo.lock

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ members = [
"humility-arch-cortex",
"humility-auxflash",
"humility-bin",
"humility-cmd",
"humility-cli",
"humility-core",
"humility-doppel",
"humility-dump-agent",
"humility-hexdump",
"humility-hiffy",
"humility-i2c",
"humility-idol",
Expand All @@ -23,6 +23,7 @@ members = [
"humility-probes-core",
"humility-spd",
"humility-stack",
"humility-vpd-lib",
"cmd/auxflash",
"cmd/console-proxy",
"cmd/counters",
Expand Down Expand Up @@ -114,10 +115,10 @@ humility = { path = "./humility-core", package = "humility-core" }
humility-arch-arm = { path = "./humility-arch-arm" }
humility-auxflash = { path = "./humility-auxflash" }
humility-cortex = { path = "./humility-arch-cortex" }
humility-cmd = { path = "./humility-cmd" }
humility-cli = { path = "./humility-cli", default-features = false }
humility-dump-agent = { path = "./humility-dump-agent" }
humility-doppel = { path = "./humility-doppel" }
humility-hexdump = { path = "./humility-hexdump" }
humility-hiffy = { path = "./humility-hiffy" }
humility-i2c = { path = "./humility-i2c" }
humility-idol = { path = "./humility-idol" }
Expand All @@ -129,6 +130,7 @@ humility-pmbus = { path = "./humility-pmbus" }
humility-probes-core = { path = "./humility-probes-core" }
humility-spd = { path = "./humility-spd" }
humility-stack = { path = "./humility-stack" }
humility-vpd-lib = { path = "./humility-vpd-lib" }
cmd-auxflash = { path = "./cmd/auxflash", package = "humility-cmd-auxflash" }
cmd-console-proxy = { path = "./cmd/console-proxy", package = "humility-cmd-console-proxy" }
cmd-counters = { path = "./cmd/counters", package = "humility-cmd-counters" }
Expand Down Expand Up @@ -205,6 +207,7 @@ ctrlc = "3.1.5"
env_logger = "0.11.10"
gimli = "0.33.0"
goblin = "0.10"
heck = "0.5"
hex = "0.4.3"
hubpack = "0.1.1"
ihex = "3.0"
Expand Down
10 changes: 3 additions & 7 deletions DEVELOPING.mkdn
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,18 @@ So you've decided to add a subcommand to Humility. Here's what you need to do.
make sure any new name starts with `humility-cmd-` (e.g.
`humility-cmd-yourcommand`).

2. Review the settings in the `init` routine you cribbed from to make sure they
reflect your subcommand. In particular, the name must appear a second time in
the `name:` field.

3. Cite your new subcommand from the root `Cargo.toml`. This needs to happen in
2. Cite your new subcommand from the root `Cargo.toml`. This needs to happen in
three places using two different names: in the `workspace.members` element
using the relative path (e.g. `cmd/yourcommand`); in the
`workspace.dependencies` section using the name of your package with the
leading `humility-` stripped off, so e.g. `cmd-yourcommand`; and then in the
`dependencies` table with a line reading `cmd-yourcommand = {workspace =
true}`.

4. Regenerate the README file by running `cargo xtask readme`. The `xtask` bit
3. Regenerate the README file by running `cargo xtask readme`. The `xtask` bit
there is very important.

5. If you're adding a new command, you almost certainly want to bump Humility's
4. If you're adding a new command, you almost certainly want to bump Humility's
patch version. This makes it easier to tell whether users have the command.
Doing this requires an extra step compared to a normal Rust package; see the
previous section in this file.
1 change: 0 additions & 1 deletion cmd/auxflash/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,4 @@ parse_int.workspace = true

humility.workspace = true
humility-auxflash.workspace = true
humility-cmd.workspace = true
humility-cli.workspace = true
20 changes: 12 additions & 8 deletions cmd/auxflash/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,15 @@
//! program auxiliary flash when needed.

use anyhow::Result;
use clap::{CommandFactory, Parser};
use clap::Parser;
use colored::Colorize;
use humility_cli::ExecutionContext;
use humility_cli::{ExecutionContext, HumilitySubcommand};

use humility_auxflash::AuxFlashHandler;
use humility_cmd::Command;

#[derive(Parser, Debug)]
#[clap(name = "auxflash", about = env!("CARGO_PKG_DESCRIPTION"))]
struct AuxFlashArgs {
pub struct AuxFlashArgs {
/// sets timeout
#[clap(
long, short = 'T', default_value_t = 15000, value_name = "timeout_ms",
Expand Down Expand Up @@ -97,8 +96,10 @@ fn auxflash_status(mut worker: AuxFlashHandler, verbose: bool) -> Result<()> {
Ok(())
}

fn auxflash(context: &mut ExecutionContext) -> Result<()> {
let subargs = AuxFlashArgs::try_parse_from(&context.cli.cmd)?;
fn auxflash(
subargs: AuxFlashArgs,
context: &mut ExecutionContext,
) -> Result<()> {
let hubris = &context.cli.archive()?;
let core = &mut *context.cli.attach_live_booted(hubris)?;
let timeout = std::time::Duration::from_millis(subargs.timeout);
Expand Down Expand Up @@ -131,6 +132,9 @@ fn auxflash(context: &mut ExecutionContext) -> Result<()> {
Ok(())
}

pub fn init() -> Command {
Command { app: AuxFlashArgs::command(), name: "auxflash", run: auxflash }
pub type Args = AuxFlashArgs;
impl HumilitySubcommand for AuxFlashArgs {
fn run(args: Args, context: &mut ExecutionContext) -> Result<()> {
auxflash(args, context)
}
}
1 change: 0 additions & 1 deletion cmd/console-proxy/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ crossbeam-channel.workspace = true
parse_int.workspace = true

humility.workspace = true
humility-cmd.workspace = true
humility-cli.workspace = true
humility-hiffy.workspace = true
humility-idol.workspace = true
Expand Down
18 changes: 8 additions & 10 deletions cmd/console-proxy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@
//!
//! Act as a proxy for the host serial console when it is jumpered to the SP.

use clap::Parser;
use humility_cli::{ExecutionContext, HumilitySubcommand};
use std::path::PathBuf;

use clap::{CommandFactory, Parser};

use humility_cmd::Command;

#[cfg(not(windows))]
mod posix;

Expand All @@ -20,14 +18,15 @@ use posix::console_proxy;

#[cfg(windows)]
fn console_proxy(
_args: UartConsoleArgs,
_context: &mut humility_cli::ExecutionContext,
) -> anyhow::Result<()> {
anyhow::bail!("the console-proxy subcommand is not available on Windows")
}

#[derive(Parser, Debug)]
#[clap(name = "console-proxy", about = env!("CARGO_PKG_DESCRIPTION"))]
struct UartConsoleArgs {
pub struct UartConsoleArgs {
#[clap(
long,
short = 'T',
Expand Down Expand Up @@ -108,10 +107,9 @@ enum UartConsoleCommand {
Client,
}

pub fn init() -> Command {
Command {
app: UartConsoleArgs::command(),
name: "console-proxy",
run: console_proxy,
pub type Args = UartConsoleArgs;
impl HumilitySubcommand for UartConsoleArgs {
fn run(args: Args, context: &mut ExecutionContext) -> anyhow::Result<()> {
console_proxy(args, context)
}
}
7 changes: 4 additions & 3 deletions cmd/console-proxy/src/posix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ use std::time::Duration;
use std::{io, thread};

use anyhow::{Context, Result};
use clap::Parser;
use crossbeam_channel::{Sender, select};
use picocom_map::RemapRules;
use termios::Termios;
Expand Down Expand Up @@ -279,8 +278,10 @@ impl UnrawTermiosGuard {
}
}

pub(super) fn console_proxy(context: &mut ExecutionContext) -> Result<()> {
let subargs = UartConsoleArgs::try_parse_from(&context.cli.cmd)?;
pub(super) fn console_proxy(
subargs: UartConsoleArgs,
context: &mut ExecutionContext,
) -> Result<()> {
let hubris = &context.cli.archive()?;
let core = &mut *context.cli.attach_live_booted(hubris)?;
let hiffy_timeout = Duration::from_millis(subargs.hiffy_timeout);
Expand Down
1 change: 0 additions & 1 deletion cmd/counters/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,4 @@ serde_json = { workspace = true }

humility = { workspace = true }
humility-doppel = { workspace = true, features = ["serde"] }
humility-cmd = { workspace = true }
humility-cli = { workspace = true }
20 changes: 12 additions & 8 deletions cmd/counters/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,13 +200,12 @@
//! show only the calls to specific IPC interfaces from specific tasks.

use anyhow::{Result, bail};
use clap::{CommandFactory, Parser, ValueEnum};
use clap::{Parser, ValueEnum};
use colored::Colorize;
use humility::core::Core;
use humility::hubris::*;
use humility::reflect::{self, Load, Value};
use humility_cli::ExecutionContext;
use humility_cmd::Command;
use humility_cli::{ExecutionContext, HumilitySubcommand};
use humility_doppel::{CountedRingbuf, CounterVariant, Counters};
use indexmap::IndexMap;
use std::collections::BTreeMap;
Expand All @@ -218,7 +217,7 @@ mod ipc;
// This attribute means that any the args defined in `Options` will conflict
// with the `list` subcommand.
#[clap(args_conflicts_with_subcommands = true)]
struct CountersArgs {
pub struct CountersArgs {
#[clap(subcommand)]
command: Option<Subcmd>,

Expand Down Expand Up @@ -323,9 +322,11 @@ enum Output {
const LIST_HINT: &str = "use `humility counters list` to list all \
available counters";

fn counters(context: &mut ExecutionContext) -> Result<()> {
fn counters(
subargs: CountersArgs,
context: &mut ExecutionContext,
) -> Result<()> {
let hubris = &context.cli.archive()?;
let subargs = CountersArgs::try_parse_from(&context.cli.cmd)?;

if let Some(Subcmd::Ipc(ipc)) = subargs.command {
let core = &mut *context.cli.attach_live_or_dump_match(hubris)?;
Expand Down Expand Up @@ -622,6 +623,9 @@ fn hint() -> impl std::fmt::Display {
"hint:".bold()
}

pub fn init() -> Command {
Command { app: CountersArgs::command(), name: "counters", run: counters }
pub type Args = CountersArgs;
impl HumilitySubcommand for Args {
fn run(args: Self, context: &mut ExecutionContext) -> Result<()> {
counters(args, context)
}
}
1 change: 0 additions & 1 deletion cmd/dashboard/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ crossterm.workspace = true
ratatui.workspace = true

humility.workspace = true
humility-cmd.workspace = true
humility-cli.workspace = true
humility-hiffy.workspace = true
humility-idol.workspace = true
24 changes: 14 additions & 10 deletions cmd/dashboard/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
//!

use anyhow::{Result, anyhow, bail};
use clap::{CommandFactory, Parser};
use clap::Parser;
use crossterm::{
event::{
self, DisableMouseCapture, EnableMouseCapture, Event, KeyCode,
Expand All @@ -28,8 +28,7 @@ use crossterm::{
use hif::*;
use humility::core::Core;
use humility::hubris::*;
use humility_cli::ExecutionContext;
use humility_cmd::Command;
use humility_cli::{ExecutionContext, HumilitySubcommand};
use humility_hiffy::*;
use humility_idol::{self as idol, HubrisIdol};
use ratatui::{
Expand All @@ -51,7 +50,7 @@ use std::time::{Duration, Instant};

#[derive(Parser, Debug)]
#[clap(name = "dashboard", about = env!("CARGO_PKG_DESCRIPTION"))]
struct DashboardArgs {
pub struct DashboardArgs {
/// sets timeout
#[clap(
long, short = 'T', default_value_t = 5000, value_name = "timeout_ms",
Expand Down Expand Up @@ -736,8 +735,10 @@ where
}
}

fn dashboard(context: &mut ExecutionContext) -> Result<()> {
let subargs = DashboardArgs::try_parse_from(&context.cli.cmd)?;
fn dashboard(
subargs: DashboardArgs,
context: &mut ExecutionContext,
) -> Result<()> {
let hubris = &context.cli.archive()?;
let core = &mut *context.cli.attach_live_booted(hubris)?;

Expand Down Expand Up @@ -766,10 +767,6 @@ fn dashboard(context: &mut ExecutionContext) -> Result<()> {
Ok(())
}

pub fn init() -> Command {
Command { app: DashboardArgs::command(), name: "dashboard", run: dashboard }
}

fn sensor_ops(
hubris: &HubrisArchive,
context: &mut HiffyContext,
Expand Down Expand Up @@ -1086,3 +1083,10 @@ fn draw(f: &mut Frame, dashboard: &mut Dashboard) {
draw_graphs(f, screen[0], dashboard);
draw_status(f, screen[1], &dashboard.status());
}

pub type Args = DashboardArgs;
impl HumilitySubcommand for Args {
fn run(args: Self, context: &mut ExecutionContext) -> Result<()> {
dashboard(args, context)
}
}
1 change: 0 additions & 1 deletion cmd/debugmailbox/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,4 @@ parse_int.workspace = true
probe-rs.workspace = true

humility-cortex.workspace = true
humility-cmd.workspace = true
humility-cli.workspace = true
23 changes: 11 additions & 12 deletions cmd/debugmailbox/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@ use std::{

use anyhow::{Context, Result, bail};
use byteorder::{ByteOrder, LittleEndian, WriteBytesExt};
use clap::{CommandFactory, Parser};
use humility_cli::ExecutionContext;
use humility_cmd::Command;
use clap::Parser;
use humility_cli::{ExecutionContext, HumilitySubcommand};
use probe_rs::{
DebugProbeError, DebugProbeSelector, Probe,
architecture::arm::{ApAddress, ArmProbeInterface, DapError, DpAddress},
Expand Down Expand Up @@ -265,9 +264,10 @@ fn read_return<'a>(
.context("Reading debugmailbox RETURN register")
}

fn debugmailboxcmd(context: &mut ExecutionContext) -> Result<()> {
let subargs = DebugMailboxArgs::try_parse_from(&context.cli.cmd)?;

fn debugmailboxcmd(
subargs: DebugMailboxArgs,
context: &mut ExecutionContext,
) -> Result<()> {
// Get a list of all available debug probes.
let probes = Probe::list_all();

Expand Down Expand Up @@ -454,15 +454,14 @@ fn debugmailboxcmd(context: &mut ExecutionContext) -> Result<()> {
}
#[derive(Parser, Debug)]
#[clap(name = "debugmailbox", about = env!("CARGO_PKG_DESCRIPTION"))]
struct DebugMailboxArgs {
pub struct DebugMailboxArgs {
#[clap(subcommand)]
cmd: DebugMailboxCmd,
}

pub fn init() -> Command {
Command {
app: DebugMailboxArgs::command(),
name: "debugmailbox",
run: debugmailboxcmd,
pub type Args = DebugMailboxArgs;
impl HumilitySubcommand for Args {
fn run(args: Self, context: &mut ExecutionContext) -> Result<()> {
debugmailboxcmd(args, context)
}
}
1 change: 0 additions & 1 deletion cmd/diagnose/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ anyhow.workspace = true
parse_int.workspace = true

humility.workspace = true
humility-cmd.workspace = true
humility-cli.workspace = true
humility-doppel.workspace = true
humility-jefe.workspace = true
Loading