Skip to content
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

Minor fixup and adding a few missed functions #5

Merged
merged 18 commits into from
Feb 25, 2025

Conversation

RobertZ2011
Copy link
Contributor

@RobertZ2011 RobertZ2011 commented Feb 12, 2025

Fixup a few minor things that didn't get caught in the initial implementation.

The older version had a bug that could cause issues including this crate
in other crates.
@RobertZ2011 RobertZ2011 changed the title Minor changes Minor fixup Feb 12, 2025
@RobertZ2011 RobertZ2011 self-assigned this Feb 12, 2025
@RobertZ2011 RobertZ2011 marked this pull request as ready for review February 12, 2025 22:01
This constant is currently only used in testing and in the embassy FW
update implementation. Mark it as `dead_code` to suppress warnings when
building without this feature.
Change the FW update error type to directly accept its generic argument
instead of indirectly using traits. This puts the trait restrictions on
those types instead of on the traits.
Copy link
Contributor

@felipebalbi felipebalbi left a comment

Choose a reason for hiding this comment

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

Doesn't compile when only log feature is enabled:

git status
On branch minor-changes
Your branch is up to date with 'origin/minor-changes'.

nothing to commit, working tree cleancargo build --no-default-features -F log
   Compiling tps6699x v0.1.0 (D:\workspace\odp\tps6699x)
error[E0277]: `command::ReturnValue` doesn't implement `Display`
   --> src\asynchronous\fw_update.rs:158:86
    |
158 |                 info!("Controller {}: Failed to initialize FW update, result {}", i, r);
    |                                                                                      ^ `command::ReturnValue` cannot be formatted with the default formatter
    |
    = help: the trait `Display` is not implemented for `command::ReturnValue`
    = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
    = note: this error originates in the macro `$crate::__private_api::format_args` which comes from the expansion of the macro `info` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: `command::TfuqBlockStatus` doesn't implement `Display`
   --> src\asynchronous\fw_update.rs:194:87
    |
194 |                 error!("Controller {}: Header block validation failed, result {}", i, r);
    |                                                                                       ^ `command::TfuqBlockStatus` cannot be formatted with the default formatter
    |
    = help: the trait `Display` is not implemented for `command::TfuqBlockStatus`
    = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
    = note: this error originates in the macro `$crate::__private_api::format_args` which comes from the expansion of the macro `error` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: `command::TfuqBlockStatus` doesn't implement `Display`
   --> src\asynchronous\fw_update.rs:295:80
    |
295 |                 error!("Controller {}: Block validation failed, result {}", i, r);
    |                                                                                ^ `command::TfuqBlockStatus` cannot be formatted with the default formatter
    |
    = help: the trait `Display` is not implemented for `command::TfuqBlockStatus`
    = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
    = note: this error originates in the macro `$crate::__private_api::format_args` which comes from the expansion of the macro `error` (in Nightly builds, run with -Z macro-backtrace for more info)

For more information about this error, try `rustc --explain E0277`.
error: could not compile `tps6699x` (lib) due to 3 previous errors

@RobertZ2011 RobertZ2011 changed the title Minor fixup Minor fixup and adding a few missed functions Feb 21, 2025
@RobertZ2011
Copy link
Contributor Author

Currently needs OpenDevicePartnership/embedded-usb-pd#3 to build.

@RobertZ2011
Copy link
Contributor Author

Checks are failing due to permissions with embedded-usb-pd, but I ran tests and built examples locally. Going to merge, both this crate and embedded-usb-pd are stated to become public in the next round so hopefully this will be one of the last PRs that will need a bypass.

@RobertZ2011 RobertZ2011 merged commit 5d23774 into OpenDevicePartnership:main Feb 25, 2025
54 of 128 checks passed
@RobertZ2011 RobertZ2011 deleted the minor-changes branch February 25, 2025 23:13
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.

3 participants