drv-i2c-devices: make TMP117 driver nicer - #2666
Merged
hawkw merged 5 commits intoSep 4, 2026
Merged
Conversation
This code appears to predate `u16::from_be_bytes`, and therefore is in the habit of representing a big-endian 16 bit register as a tuple and then passing it around, which I found unfortunate. Presumably the fact that only the driver understands the tuple's endianness is also the reason it, it makes the enum of device registers public, but does not make the `read_reg` function public, which I *also* found unfortunate. THis commit fixes all of that. It also changes `host=-sp-comms` to actually use the driver instead of ignoring it.
hawkw
force-pushed
the
eliza/OOPS-I-ACCIDENTALLY-THE-WHOLE-TEMPERATURE-SENSOR-DRIVER
branch
from
September 2, 2026 00:05
ec40422 to
2a70456
Compare
hawkw
marked this pull request as draft
September 2, 2026 20:37
Member
Author
|
poking around a bit via 2YFH3T3G # /usr/lib/fm/fmd/fmtopo -V hc://:product-id=913-0000023:product-sn=2YFH3T3G:server-id=2YFH3T3G:chassis-id=2YFH3T3G:serial=0117a9520f93a57a:part=TMP117:revision=0/chassis=0/systemboard=0/slot=27/board=0/ic=0?sensor=temp
TIME UUID
Feb 02 11:10:42 14a5bf46-f7ae-4656-a95f-ea560d1104ac
hc://:product-id=913-0000023:product-sn=2YFH3T3G:server-id=2YFH3T3G:chassis-id=2YFH3T3G:serial=0117a9520f93a57a:part=TMP117:revision=0/chassis=0/systemboard=0/slot=27/board=0/ic=0?sensor=temp
group: protocol version: 1 stability: Private/Private
resource fmri hc://:product-id=913-0000023:product-sn=2YFH3T3G:server-id=2YFH3T3G:chassis-id=2YFH3T3G:serial=0117a9520f93a57a:part=TMP117:revision=0/chassis=0/systemboard=0/slot=27/board=0/ic=0?sensor=temp
group: authority version: 1 stability: Private/Private
product-id string 913-0000023
product-sn string 2YFH3T3G
chassis-id string 2YFH3T3G
server-id string 2YFH3T3G
group: facility version: 1 stability: Private/Private
sensor-class string threshold
type uint32 0x1 (TEMP)
units uint32 0x1 (DEGREES_C)
remote-agents string[] [ "mgs" ]
group: remote-mgs version: 1 stability: Private/Private
mgs-sensor-id uint32 0x69
2YFH3T3G #2YFH3T3G # /usr/lib/fm/fmd/fmtopo -V hc://:product-id=913-0000023:product-sn=2YFH3T3G:server-id=2YFH3T3G:chassis-id=2YFH3T3G:serial=0117a9520f93a57a:part=TMP117:revision=0/chassis=0/systemboard=0/slot=27/board=0/ic=0?sensor=temp
TIME UUID
Dec 28 00:01:47 88626dae-2aa5-4776-a39f-6f0f064acd84
hc://:product-id=913-0000023:product-sn=2YFH3T3G:server-id=2YFH3T3G:chassis-id=2YFH3T3G:serial=0117a9520f93a57a:part=TMP117:revision=0/chassis=0/systemboard=0/slot=27/board=0/ic=0?sensor=temp
group: protocol version: 1 stability: Private/Private
resource fmri hc://:product-id=913-0000023:product-sn=2YFH3T3G:server-id=2YFH3T3G:chassis-id=2YFH3T3G:serial=0117a9520f93a57a:part=TMP117:revision=0/chassis=0/systemboard=0/slot=27/board=0/ic=0?sensor=temp
group: authority version: 1 stability: Private/Private
product-id string 913-0000023
product-sn string 2YFH3T3G
chassis-id string 2YFH3T3G
server-id string 2YFH3T3G
group: facility version: 1 stability: Private/Private
sensor-class string threshold
type uint32 0x1 (TEMP)
units uint32 0x1 (DEGREES_C)
remote-agents string[] [ "mgs" ]
group: remote-mgs version: 1 stability: Private/Private
mgs-sensor-id uint32 0x69
2YFH3T3G #
|
…ATURE-SENSOR-DRIVER
hawkw
marked this pull request as ready for review
September 2, 2026 21:24
evan-oxide
approved these changes
Sep 3, 2026
jamesmunns
approved these changes
Sep 4, 2026
Member
Author
|
triple-checking that 2CN2M459 # /usr/lib/fm/fmd/fmtopo | grep part=TMP117
hc://:product-id=913-0000023:product-sn=2CN2M459:server-id=2CN2M459:chassis-id=2CN2M459:serial=0117b2cb0fa2a57a:part=TMP117:revision=0/chassis=0/systemboard=0/slot=24/board=0/ic=0
hc://:product-id=913-0000023:product-sn=2CN2M459:server-id=2CN2M459:chassis-id=2CN2M459:serial=0117b2cb0fa2a57a:part=TMP117:revision=0/chassis=0/systemboard=0/slot=24/board=0/ic=0?sensor=temp
hc://:product-id=913-0000023:product-sn=2CN2M459:server-id=2CN2M459:chassis-id=2CN2M459:serial=0117a4790f6da57a:part=TMP117:revision=0/chassis=0/systemboard=0/slot=25/board=0/ic=0
hc://:product-id=913-0000023:product-sn=2CN2M459:server-id=2CN2M459:chassis-id=2CN2M459:serial=0117a4790f6da57a:part=TMP117:revision=0/chassis=0/systemboard=0/slot=25/board=0/ic=0?sensor=temp
hc://:product-id=913-0000023:product-sn=2CN2M459:server-id=2CN2M459:chassis-id=2CN2M459:serial=0117a48a0f84a57a:part=TMP117:revision=0/chassis=0/systemboard=0/slot=26/board=0/ic=0
hc://:product-id=913-0000023:product-sn=2CN2M459:server-id=2CN2M459:chassis-id=2CN2M459:serial=0117a48a0f84a57a:part=TMP117:revision=0/chassis=0/systemboard=0/slot=26/board=0/ic=0?sensor=temp
hc://:product-id=913-0000023:product-sn=2CN2M459:server-id=2CN2M459:chassis-id=2CN2M459:serial=0117a4660f9ba57a:part=TMP117:revision=0/chassis=0/systemboard=0/slot=27/board=0/ic=0
hc://:product-id=913-0000023:product-sn=2CN2M459:server-id=2CN2M459:chassis-id=2CN2M459:serial=0117a4660f9ba57a:part=TMP117:revision=0/chassis=0/systemboard=0/slot=27/board=0/ic=0?sensor=temp
hc://:product-id=913-0000023:product-sn=2CN2M459:server-id=2CN2M459:chassis-id=2CN2M459:serial=0117a2160f5ba57a:part=TMP117:revision=0/chassis=0/systemboard=0/slot=28/board=0/ic=0
hc://:product-id=913-0000023:product-sn=2CN2M459:server-id=2CN2M459:chassis-id=2CN2M459:serial=0117a2160f5ba57a:part=TMP117:revision=0/chassis=0/systemboard=0/slot=28/board=0/ic=0?sensor=temp
hc://:product-id=913-0000023:product-sn=2CN2M459:server-id=2CN2M459:chassis-id=2CN2M459:serial=0117a6ef0f8ea57a:part=TMP117:revision=0/chassis=0/systemboard=0/slot=29/board=0/ic=0
hc://:product-id=913-0000023:product-sn=2CN2M459:server-id=2CN2M459:chassis-id=2CN2M459:serial=0117a6ef0f8ea57a:part=TMP117:revision=0/chassis=0/systemboard=0/slot=29/board=0/ic=0?sensor=temp
2CN2M459 #and in fact, it is properly endianness-confused! |
hawkw
deleted the
eliza/OOPS-I-ACCIDENTALLY-THE-WHOLE-TEMPERATURE-SENSOR-DRIVER
branch
September 4, 2026 20:11
hawkw
added a commit
that referenced
this pull request
Sep 4, 2026
Depends on oxidecomputer/management-gateway-service#500. Depends on #2666. This branch updates the `gateway-messages` dependency to pick up the new `component-get-vpd` API and associated messages for reading the vital product data from a component, and, well, implements that API. While the MGS PR better describes the layout of the various wire types, this is where most of the actual heavy lifting happened. Of the various attempts I've made at adding FRUID VPD to `control-plane-agent`, this is the first one I'm actually more or less satisfied with. Fixes #2212. Closes #2217. Closes #2220.
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.
OOPS I ACCIDENTALLY REWROTE THE WHOLE TEMPERATURE SENSOR DRIVER AND ALSO ALL THE CODE THAT USES IT SORRY GUYS.
In particular, in #2650, @jamesmunns quite reasonably asked why I wasn't using the driver and hard coding register reads (which I had done because I copied the code from
host-sp-commsand hadn't realized the driver did the EEPROM stuff. It turned out that it did, but I didn't like the way it was doing it...and clearly, Matt hadn't liked it either, which is whyhost-sp-commswas also not using it. In particular, the driver code appears to have been written by Bryan some time before the existence ofu16::from_be_bytes, and therefore is in the habit of representing a big-endian 16 bit register as a tuple and then passing it around, which I found unfortunate. Presumably the fact that only the driver understands the tuple's endianness is also the reason it, it makes the enum of device registers public, but does not make theread_regfunction public, which I also found unfortunate. This commit fixes all of that. It also changeshost-sp-commsto actually use the driver instead of ignoring it.I pulled this out of #2650 because it felt unrelated.