Draft
Conversation
Member
Author
|
@Kampfdackel5, @tillx4 Please Review |
Member
Author
|
CIs are now passing. |
Kampfdackel5
approved these changes
Apr 17, 2026
Contributor
Kampfdackel5
left a comment
There was a problem hiding this comment.
Looks good so far, see my comments :)
|
|
||
| httpd_resp_set_type(req, "application/json"); | ||
| size_t payload_capacity = 256 | ||
| + ((size_t)info.added_device_count * 160) |
Contributor
There was a problem hiding this comment.
Maybe add some small comments in the code to not have magic numbers
| (unsigned int)info.detected_device_count | ||
| ); | ||
|
|
||
| if (written < 0 || written >= (int)(payload_capacity - offset)) { |
Contributor
There was a problem hiding this comment.
I think we don't need the cast
Member
Author
There was a problem hiding this comment.
payload_capacity is size_t so im not sure if it makes problems when we compare against an int
Contributor
There was a problem hiding this comment.
So both ways aren't "safe" afaik haha
This is probably a discussion we should have in general anyway: how safe code has to be
| (unsigned int)device->expected_whoami | ||
| ); | ||
|
|
||
| if (written < 0 || written >= (int)(payload_capacity - offset)) { |
Contributor
There was a problem hiding this comment.
if cast is removed above, also remove here
| } | ||
|
|
||
| written = snprintf(payload + offset, payload_capacity - offset, "],\"detected_devices\":["); | ||
| if (written < 0 || written >= (int)(payload_capacity - offset)) { |
| (unsigned int)address | ||
| ); | ||
|
|
||
| if (written < 0 || written >= (int)(payload_capacity - offset)) { |
| } | ||
|
|
||
| written = snprintf(payload + offset, payload_capacity - offset, "]}"); | ||
| if (written < 0 || written >= (int)(payload_capacity - offset)) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request adds a new
/i2cinfoHTTP endpoint to expose detailed I2C bus and device information, and refactors the I2C device management to track and report both registered and detected I2C devices. It also introduces new data structures and APIs to support this functionality, and updates the frontend theme for improved UI consistency.The new "Connected Devices" tab should be used for all kinds of peripherals in the future, not just I2C devices.
I2C Bus and Device Information Exposure:
VigilantI2cInfostruct andvigilant_get_i2cinfoAPI to collect and report I2C bus configuration, registered devices, and detected devices (vigilant.h,vigilant.c). [1] [2]/i2cinfoHTTP GET endpoint that returns a JSON payload with I2C bus status, registered devices, and detected device addresses (http_server.c). [1] [2]I2C Device Detection and Tracking:
i2c.c,i2c.h). [1] [2] [3] [4] [5] [6]vigilant.c). [1] [2] [3] [4]Frontend/UI Improvements:
theme.css).Other:
main.c).This PR closes #8 #12 #48