oxidecomputer / oxidecomputer/humility

`humility i2c` could maybe return a non-zero exit code when the I2C operation returns an error

Open
#489 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
584
Forks
63
Avg merge
3h
Merged PRs (30d)
2

Description

I wanted to use a bash until loop to retry a humility i2c command until it succeeds, but it looks like humility i2c (and possibly also humility hiffy?) exits with 0 when it was able to successfully execute the hiffy IPC operation on the device, but the IPC returned an error. For example:

eliza@niles ~ $ pfexec humility -t gimlet-c i2c -b rear --device 0x20 --register 0x00 --nbytes 1 --timeout 10000
humility: attached to 0483:3754:000D00344741500820383733 via ST-Link V3
Controller I2C4, device 0x20, register 0x0 = Err(BusLocked)
eliza@niles ~ $ echo $?
0
eliza@niles ~ $

IMO, it would be a bit nicer for humility to exit with a non-zero exit code when the on-device operation fails. That way, the error is visible to the user's shell and you don't have to do things like grepping for the string that indicates an error...

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the Rust implementation of the humility i2c command and trace how the hiffy IPC result is converted into the CLI status. Reproduce the shown BusLocked example, then verify that device-operation errors return a non-zero shell status while successful operations still return zero; check whether humility hiffy follows the same path.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.