-
Notifications
You must be signed in to change notification settings - Fork 31
[protocol] Convert hello command and libhoth to use the new error #254
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
esnguyen
wants to merge
1
commit into
google:main
Choose a base branch
from
esnguyen:esnguyen/poc_hello_error
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| // Copyright 2026 Google LLC | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| #include "status.h" | ||
|
|
||
| const char* libhoth_error_ctx_str(uint32_t ctx) { | ||
| switch (ctx) { | ||
| case HOTH_CTX_NONE: | ||
| return "NONE"; | ||
| case HOTH_CTX_INIT: | ||
| return "INIT"; | ||
| case HOTH_CTX_USB: | ||
| return "USB"; | ||
| case HOTH_CTX_SPI: | ||
| return "SPI"; | ||
| case HOTH_CTX_CMD_EXEC: | ||
| return "CMD_EXEC"; | ||
| default: | ||
| return "UNKNOWN"; | ||
| } | ||
| } | ||
|
|
||
| const char* libhoth_error_space_str(uint16_t space) { | ||
| switch (space) { | ||
| case HOTH_HOST_SPACE_FW: | ||
| return "FW"; | ||
| case HOTH_HOST_SPACE_POSIX: | ||
| return "POSIX"; | ||
| case HOTH_HOST_SPACE_LIBUSB: | ||
| return "LIBUSB"; | ||
| case HOTH_HOST_SPACE_LIBHOTH: | ||
| return "LIBHOTH"; | ||
| default: | ||
| return "UNKNOWN"; | ||
| } | ||
| } | ||
|
|
||
| const char* libhoth_error_code_fw_str(uint16_t code) { | ||
| switch (code) { | ||
| case HOTH_FW_SUCCESS: | ||
| return "SUCCESS"; | ||
| case HOTH_FW_INVALID_COMMAND: | ||
| return "INVALID_COMMAND"; | ||
| case HOTH_FW_ERROR: | ||
| return "ERROR"; | ||
| case HOTH_FW_INVALID_PARAM: | ||
| return "INVALID_PARAM"; | ||
| case HOTH_FW_ACCESS_DENIED: | ||
| return "ACCESS_DENIED"; | ||
| case HOTH_FW_INVALID_RESPONSE: | ||
| return "INVALID_RESPONSE"; | ||
| case HOTH_FW_INVALID_VERSION: | ||
| return "INVALID_VERSION"; | ||
| case HOTH_FW_INVALID_CHECKSUM: | ||
| return "INVALID_CHECKSUM"; | ||
| case HOTH_FW_IN_PROGRESS: | ||
| return "IN_PROGRESS"; | ||
| case HOTH_FW_UNAVAILABLE: | ||
| return "UNAVAILABLE"; | ||
| case HOTH_FW_TIMEOUT: | ||
| return "TIMEOUT"; | ||
| case HOTH_FW_OVERFLOW: | ||
| return "OVERFLOW"; | ||
| case HOTH_FW_INVALID_HEADER: | ||
| return "INVALID_HEADER"; | ||
| case HOTH_FW_REQUEST_TRUNCATED: | ||
| return "REQUEST_TRUNCATED"; | ||
| case HOTH_FW_RESPONSE_TOO_BIG: | ||
| return "RESPONSE_TOO_BIG"; | ||
| case HOTH_FW_BUS_ERROR: | ||
| return "BUS_ERROR"; | ||
| case HOTH_FW_BUSY: | ||
| return "BUSY"; | ||
| case HOTH_FW_INVALID_HEADER_VERSION: | ||
| return "INVALID_HEADER_VERSION"; | ||
| case HOTH_FW_INVALID_HEADER_CRC: | ||
| return "INVALID_HEADER_CRC"; | ||
| case HOTH_FW_INVALID_DATA_CRC: | ||
| return "INVALID_DATA_CRC"; | ||
| case HOTH_FW_DUP_UNAVAILABLE: | ||
| return "DUP_UNAVAILABLE"; | ||
| default: | ||
| return "UNKNOWN"; | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume the plan is to complete the migrate to this function and then to just rename everything back to
libhoth_hostcm_exec? I don't think we have any consumers of this API outside of this repo so that should be safe.