Skip to content

Add humility host POST code subcommands#603

Merged
mkeeter merged 1 commit intomasterfrom
mkeeter/host-post-code
Mar 11, 2026
Merged

Add humility host POST code subcommands#603
mkeeter merged 1 commit intomasterfrom
mkeeter/host-post-code

Conversation

@mkeeter
Copy link
Contributor

@mkeeter mkeeter commented Mar 9, 2026

@mkeeter mkeeter requested a review from labbott March 9, 2026 19:29
@mkeeter mkeeter changed the title Add humility host POST code Add humility host POST code subcommands Mar 9, 2026
Comment on lines +369 to +375
bail!("Got bad reflected value: expected U32, got {value:?}");
};

let op = hubris.get_idol_command("Sequencer.get_post_code")?;
let handle_value = |v| {
let Ok(reflect::Value::Base(reflect::Base::U32(v))) = v else {
bail!("Got bad reflected value: expected U32, got {v:?}");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpicky, considered unimportant: perhaps these errors ought to say which IPC returned the surprising value?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, although we're having a really bad day if that matters!

Comment on lines +492 to +495
HostCommand::PostCodes { raw } => host_post_codes(hubris, core, raw),
HostCommand::LastPostCode { raw } => {
host_last_post_code(hubris, core, raw)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm, here's a thought: since these commands are both Cosmo-specific, I wonder if the command line for them ought to make that more obvious. perhaps humility host cosmo post-codes and humility host cosmo last-post-code?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dig it, fixed

@mkeeter mkeeter force-pushed the mkeeter/host-post-code branch 4 times, most recently from d2a5577 to b306bb2 Compare March 10, 2026 14:31
Copy link
Member

@hawkw hawkw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yay, this is really nice!

Comment on lines +128 to 140
#[derive(Parser, Debug)]
enum CosmoHostCommand {
/// Prints the most recent POST code
LastPostCode {
#[clap(long)]
raw: bool,
},
/// Dumps the POST code buffer
PostCodes {
#[clap(long)]
raw: bool,
},
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding the subcommand, I think this will make things much clearer to the user.

Comment on lines +511 to +514
host_post_codes(hubris, core, raw)
}
CosmoHostCommand::LastPostCode { raw } => {
host_last_post_code(hubris, core, raw)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i wonder somewhat if we ought to change the function names to also say "cosmo" in them, but it's not important to me.

Comment on lines +354 to +358
if let Some(board) = &hubris.manifest.board {
format!(" but this is a '{board}'")
} else {
String::new()
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cute!

Copy link
Contributor

@labbott labbott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a terrible HIF compiler but I think your generated code looks correct.

Comment on lines +404 to +406
// For network-attached systems, function calls are cheap and we can just
// spam them. For debugger-attached systems, we'll want to run a HIF loop
// to avoid dispatch overhead.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm guessing this is a very noticeable lag?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh yeah it's terrible – 10+ seconds to read a full 4K codes.

@mkeeter mkeeter force-pushed the mkeeter/host-post-code branch from b306bb2 to 6c6fe94 Compare March 11, 2026 18:16
@mkeeter mkeeter enabled auto-merge (squash) March 11, 2026 18:16
@mkeeter mkeeter merged commit 281e25d into master Mar 11, 2026
12 checks passed
@mkeeter mkeeter deleted the mkeeter/host-post-code branch March 11, 2026 18:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

want a way to get post-code buffer via humility and via network

3 participants