Skip to content

embedded-batteries: Implement TryFrom<u32> for ACPI types#39

Merged
kurtjd merged 1 commit intoOpenDevicePartnership:mainfrom
kurtjd:impl-tryfrom-u32
Jan 20, 2026
Merged

embedded-batteries: Implement TryFrom<u32> for ACPI types#39
kurtjd merged 1 commit intoOpenDevicePartnership:mainfrom
kurtjd:impl-tryfrom-u32

Conversation

@kurtjd
Copy link
Contributor

@kurtjd kurtjd commented Jan 19, 2026

A few of the ACPI types were missing a TryFrom<u32> impl which is useful for de-serialization purposes. Didn't see a suitable existing Error type to use so decided to just use unit type for errors since there isn't really any useful info to return for these.

Resolves #38

@kurtjd kurtjd self-assigned this Jan 19, 2026
@kurtjd kurtjd requested a review from a team as a code owner January 19, 2026 18:38
@kurtjd kurtjd added the enhancement New feature or request label Jan 19, 2026
@kurtjd kurtjd requested a review from asasine January 19, 2026 18:38
@kurtjd kurtjd moved this to In review in Embedded Controller Jan 19, 2026
@kurtjd kurtjd changed the title Implement TryFrom<u32> for ACPI types embedded-batteries: Implement TryFrom<u32> for ACPI types Jan 20, 2026
kurtjd added a commit to OpenDevicePartnership/embedded-services that referenced this pull request Jan 20, 2026
Some serialization/deserialization was omitted because it wouldn't be
used by the EC, however the service-message crates can be used outside
the EC, so add them in.

I experimented with zerocopy for this in #678 but it's a bit clunky and
getting it to work for Battery messages will be challenging, so just
rolled it by hand for now since that's what we are already doing. Can
revisit later once we've decided on a serialization strategy.

Tested these by using the service message crates to
serialize/deserialize messages over UART in the ratatui and works fine
for the ones I could test (though many of the battery commands are not
yet supported by the ratatui app).

Was going to wait until
OpenDevicePartnership/embedded-batteries#39 is
merged, but it seems relying on an updated `embedded-batteries` causes a
ton of breakage and headache, so just have functions for converting in
here and can update a later time.
Copy link
Contributor

@tullom tullom left a comment

Choose a reason for hiding this comment

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

Looks good, i have another change coming down the pipe so ill include this change as in one uprev

@kurtjd kurtjd merged commit 112f9c8 into OpenDevicePartnership:main Jan 20, 2026
19 of 26 checks passed
@github-project-automation github-project-automation bot moved this from In review to Done in Embedded Controller Jan 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

embedded-batteries: Needs TryFrom<u32> for T on several types

3 participants