using busctl to read sensor values in openbmc

3.9k views Asked by At

I'm trying to explore sensor values and signals in openbmc. I can see the available bus names:

# busctl |grep Sensor|sed -e 's| .*||'
xyz.openbmc_project.ADCSensor
xyz.openbmc_project.CPUSensor
xyz.openbmc_project.ExitAirTempSensor
xyz.openbmc_project.FanSensor
xyz.openbmc_project.HwmonTempSensor
xyz.openbmc_project.IntrusionSensor
xyz.openbmc_project.IpmbSensor
xyz.openbmc_project.MCUTempSensor
xyz.openbmc_project.PSUSensor

But, I can't get any objects out of these. For example:

# busctl tree xyz.openbmc_project.HwmonTempSensor
Only root object discovered.

Since I'm not getting objects, how do a do a 'busctl introspect'? Sorry if this is obevious. New to dbus...

2

There are 2 answers

3
John b On

I am not an authority on either openbmc or DBus, but I will tell you what I can.

When I am not familiar with a bmc platform I will run busctl tree | less then search in the output for either xyz.openbmc_project.Hwmon or the sensor name I want. Example:

 Service xyz.openbmc_project.Hwmon-3372718265.Hwmon1:
 └─/xyz
   └─/xyz/openbmc_project
     └─/xyz/openbmc_project/sensors
       └─/xyz/openbmc_project/sensors/temperature
         └─/xyz/openbmc_project/sensors/temperature/i2cool_0

Then I am able to make my dbus introspect command.

busctl introspect xyz.openbmc_project.Hwmon-3372718265.Hwmon1 /xyz/openbmc_project/sensors/temperature/i2cool_0 | less

And that brings up the following sections

xyz.openbmc_project.Sensor.Value
.MaxValue
.MinValue                                      
.Scale
.Unit
.Value   

There are many people in the community that work more closely with the dbus sensor interface. But I thought I would share my method. This is the document I follow when I have a dbus sensor read question. https://github.com/openbmc/docs/blob/master/architecture/sensor-architecture.md

0
Dan Gilson On

The process is to first find the sensor. For that the name of the sensor needs to be known.

root@pavilion-evb:~# busctl tree | grep sensor

will give you a list.

Then have ObjectMapper tell what Hwmon is monitoring that sensor.

root@pavilion-evb:~# dbus-send --system --print-reply  --dest=xyz.openbmc_project.ObjectMapper  /xyz/openbmc_project/object_mapper  xyz.openbmc_project.ObjectMapper.GetObject  string:"\<**SENSOR NAME**>" array:string:

example:

root@pavilion-evb:~# dbus-send --system --print-reply  --dest=xyz.openbmc_project.ObjectMapper  /xyz/openbmc_project/object_mapper  xyz.openbmc_project.ObjectMapper.GetObject  string:"/xyz/openbmc_project/sensors/voltage/psu4_vin" array:string:

returns

method return time=1663175959.916697 sender=:1.12 -> destination=:1.24984 serial=220988 reply_serial=2 array [ dict entry( string "xyz.openbmc_project.Hwmon-3678593568.Hwmon1" array [ string "org.freedesktop.DBus.Introspectable" string "org.freedesktop.DBus.Peer" string "org.freedesktop.DBus.Properties" string "xyz.openbmc_project.Sensor.Threshold.Critical" string "xyz.openbmc_project.Sensor.Threshold.Warning" string "xyz.openbmc_project.Sensor.Value" string "xyz.openbmc_project.State.Decorator.OperationalStatus" ] ) ]

The key information here is: xyz.openbmc_project.Hwmon-3678593568.Hwmon1

The use busctl introspect:

root@pavilion-evb:~# busctl introspect   xyz.openbmc_project.Hwmon-3678593568.Hwmon1 /xyz/openbmc_project/sensors/voltage/psu4_vin  xyz.openbmc_project.Sensor.Value 
NAME                             TYPE      SIGNATURE RESULT/VALUE                             FLAGS
.MaxValue                        property  d         inf                                      emits-change writable
.MinValue                        property  d         -inf                                     emits-change writable
.Unit                            property  s         "xyz.openbmc_project.Sensor.Value.Unit.\u2026 emits-change writable
.Value                           property  d         208.25                                   emits-change writable

Or just the value can be gotten by:

root@pavilion-evb:~# busctl get-property  xyz.openbmc_project.Hwmon-3678593568.Hwmon1 /xyz/openbmc_project/sensors/voltage/psu4_vin  xyz.openbmc_project.Sensor.Value Value
d 208.25