Skip to content

Add htool commands to enable and get enabled I2C filtering endpoints. - #336

Open
daimeng-wang wants to merge 1 commit into
google:mainfrom
daimeng-wang:i2c_filtering_endpoints
Open

daimeng-wang wants to merge 1 commit into
google:mainfrom
daimeng-wang:i2c_filtering_endpoints

Conversation

@daimeng-wang

Copy link
Copy Markdown
Collaborator

Host software needs libhoth and htool support to configure active I2C passthrough filtering endpoints on Dauntless and inspect the currently enabled endpoint list stored in gNVRAM.

Add libhoth_i2c_filtering_enable_endpoints() and libhoth_i2c_filtering_get_enabled_endpoints() to the libhoth protocol library along with unit tests, and expose htool i2c filter enable_endpoints and htool i2c filter get_enabled_endpoints CLI subcommands that parse and format the hex endpoint identifier payload and count.

@daimeng-wang
daimeng-wang requested a review from xorptr November 12, 2026 04:15
xorptr
xorptr previously approved these changes Nov 12, 2026
Comment thread protocol/i2c.c Outdated
size_t req_len,
struct hoth_response_i2c_endpoints_enabled_for_filtering* resp,
size_t max_resp_len, size_t* resp_len) {
if (req == NULL || resp == NULL || req_len < sizeof(*req) ||

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit: Would it be a good idea to check dev == NULL as well?

Comment thread protocol/i2c.c Outdated
struct libhoth_device* dev,
struct hoth_response_i2c_endpoints_enabled_for_filtering* resp,
size_t max_resp_len, size_t* resp_len) {
if (resp == NULL || max_resp_len < sizeof(*resp)) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit: Would it be a good idea to check dev == NULL as well?

Comment thread protocol/i2c.h Outdated

struct hoth_response_i2c_endpoints_enabled_for_filtering {
uint8_t ids_count; // Number of endpoints that have been enabled
uint8_t reserved[3]; // Padding for alignment for rest of the data

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit: I am wondering if we should impose the restriction that reserved bytes should be 0 and document it here. Same thought regarding reserved field in hoth_request_enable_i2c_endpoints_for_filtering. That'll allow using reserved fields for other purposes later (if needed)

Comment thread tools/htool/htool_i2c.c
const uint8_t* data = (const uint8_t*)resp + sizeof(*resp);
const size_t data_len = resp_len - sizeof(*resp);
for (size_t i = 0; i < data_len; ++i) {
printf(" 0x%02X", data[i]);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

minor nit: I am wondering if we can format it with newline at end of each identifier to make it "easier" for humans to visually parse. Please skip if the code to do so becomes cumbersome here. We can probably explore better formats in the future

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I don't think it helps much and will involve too much additional code.

In the future we should consider returning human-readable strings as an output option. Also in the firmware I'm printing human-readable device names in console.

Host software needs `libhoth` and `htool` support to configure active I2C passthrough filtering endpoints on Dauntless and inspect the currently enabled endpoint list stored in gNVRAM.

Add `libhoth_i2c_filtering_enable_endpoints()` and `libhoth_i2c_filtering_get_enabled_endpoints()` to the `libhoth` protocol library along with unit tests, and expose `htool i2c filter enable_endpoints` and `htool i2c filter get_enabled_endpoints` CLI subcommands that parse and format the hex endpoint identifier payload and count.
@daimeng-wang
daimeng-wang force-pushed the i2c_filtering_endpoints branch from 1ffd47c to 7b7c255 Compare November 14, 2026 00:31
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.

2 participants