Repository navigation
Add htool commands to enable and get enabled I2C filtering endpoints. - #336
daimeng-wang wants to merge 1 commit into
Conversation
| 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) || |
There was a problem hiding this comment.
nit: Would it be a good idea to check dev == NULL as well?
| 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)) { |
There was a problem hiding this comment.
nit: Would it be a good idea to check dev == NULL as well?
|
|
||
| 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 |
There was a problem hiding this comment.
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)
| 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]); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
6dcb0e1 to
1ffd47c
Compare
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.
1ffd47c to
7b7c255
Compare
Host software needs
libhothandhtoolsupport 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()andlibhoth_i2c_filtering_get_enabled_endpoints()to thelibhothprotocol library along with unit tests, and exposehtool i2c filter enable_endpointsandhtool i2c filter get_enabled_endpointsCLI subcommands that parse and format the hex endpoint identifier payload and count.