archive mirror
 help / color / mirror / Atom feed
* [phosphor-virtual-sensor] Exception "The name is not activatable" when get the source sensor value.
@ 2021-03-30 17:06 Thu Nguyen OS
  0 siblings, 0 replies; only message in thread
From: Thu Nguyen OS @ 2021-03-30 17:06 UTC (permalink / raw)
  To: openbmc; +Cc: Matt Spinler

[-- Attachment #1: Type: text/plain, Size: 2401 bytes --]

Dear All,

In MtJade platform, we are using phosphor-virtual-sensor to create the host virtual sensors.
The source sensors of the virtual sensors are created by phosphor-hwmon.
The phosphor-hwmon get the sensor value from sysfs which created by SMPro-hwmon driver.
As linux kernel requirement, SMPro-hwmon driver will not be binded until the device is accessible.
In our case, it is when the host is off. So the source sensors of the host virtual sensors are not available when the host is off.
When the SMPro-hwmon driver start binding the source sensors, the serviceName of the sensor is available.
But the its’ value interface can be unavailable in the short time.

Below is my observation:
+ Turn on the host.
+ The SMPro-hwmon driver starts binding the source sensors.
+ The phosphor-hwmon starts creating dbus sensor for the source sensors getService() return the corrected service name.
But in the sort time, the value interface “xyz.openbmc_project.Sensor.Value” is not available. Calling getDbusProperty() exit with the exception
“sd_bus_call: org.freedesktop.DBus.Error.ServiceUnknown: The name is not activatable”

As my opinion, we should add try catch when get the sensor value. And return std::numeric_limits<double>::quiet_NaN() when the exception appears.
I’m changing the code of GetSensorValue() as below to fix the exception.
/** @brief Get sensor value property from D-bus interface */
    double getSensorValue()
        double ret = -1;

        if (servName.empty())
            servName = getService(bus, path, sensorIntf);
            if (servName.empty())
                return std::numeric_limits<double>::quiet_NaN();
         * When the sensor driver is binding, getting its' value can be
         * cause exception:
         * "sd_bus_call: org.freedesktop.DBus.Error.ServiceUnknown: \
         * The name is not activatable"
         * Add try catch to cover this exception case.
            ret = getDbusProperty<double>(bus, servName, path, sensorIntf,
        catch(const std::exception& e)
            ret = std::numeric_limits<double>::quiet_NaN();

        return ret;

Is the patch file?

Thu Nguyen.

[-- Attachment #2: Type: text/html, Size: 18241 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-03-30 17:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-30 17:06 [phosphor-virtual-sensor] Exception "The name is not activatable" when get the source sensor value Thu Nguyen OS

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).