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

dbus-sdr:can not build two sensors with same path in sensorTree #189

Open
LinflAsh opened this issue Apr 13, 2023 · 0 comments
Open

dbus-sdr:can not build two sensors with same path in sensorTree #189

LinflAsh opened this issue Apr 13, 2023 · 0 comments

Comments

@LinflAsh
Copy link

LinflAsh commented Apr 13, 2023

I am using phosphor-host-ipmid at SRCREV = "f53696edb8c9560b5d6a0f681429cf67f168a083"
when I enabled Dynamic Sensors and Hybrid Sensors, The sensor expected to appear did not appear, look my sensor.yaml(copy from other meta) below two sensors have the same path field:

0x01:
  entityID: 34
  entityInstance: 1
  interfaces:
      xyz.openbmc_project.State.Boot.Progress:
          BootProgress:
              Offsets:
                  0:
                      set: xyz.openbmc_project.State.Boot.Progress.ProgressStages.Unspecified
                      type: string
                  1:
                      set: xyz.openbmc_project.State.Boot.Progress.ProgressStages.MemoryInit
                      type: string
                  3:
                      set: xyz.openbmc_project.State.Boot.Progress.ProgressStages.SecondaryProcInit
                      type: string
                  7:
                      set: xyz.openbmc_project.State.Boot.Progress.ProgressStages.PCIInit
                      type: string
                  19:
                      set: xyz.openbmc_project.State.Boot.Progress.ProgressStages.OSStart
                      type: string
                  20:
                      set: xyz.openbmc_project.State.Boot.Progress.ProgressStages.MotherboardInit
                      type: string
  mutability: Mutability::Write|Mutability::Read
  path: /xyz/openbmc_project/state/host0
  readingType: eventdata2
  sensorNamePattern: nameProperty
  sensorReadingType: 111
  sensorType: 15
  serviceInterface: org.freedesktop.DBus.Properties
0x02:
    entityID: 34
    entityInstance: 2
    interfaces:
        xyz.openbmc_project.Control.Boot.RebootAttempts:
            AttemptsLeft:
                Offsets:
                    255:
                        type: uint32_t
    mutability: Mutability::Write|Mutability::Read
    path: /xyz/openbmc_project/state/host0
    readingType: readingAssertion
    sensorNamePattern: nameProperty
    sensorReadingType: 111
    sensorType: 195
    serviceInterface: org.freedesktop.DBus.Properties

Unfortunately, only one sensor appeared
I can recreate this in qemu:

~# ipmitool sensor list
...
BootProgress     | 0x0        | discrete   | 0x0000| na        | na        | na        | na        | na        | na
...

Looking for the answer in the code, I found that if two sensors use the same sensorPath, only one of them is built:

#ifdef FEATURE_HYBRID_SENSORS
    if (!ipmi::sensor::sensors.empty())
    {
        for (const auto& sensor : ipmi::sensor::sensors)
        {
            if (boost::starts_with(sensor.second.sensorPath,
                                   "/xyz/openbmc_project/sensors/"))
            {
                continue;
            }
            boost::container::flat_map<std::string, std::vector<std::string>>
                connectionMap{
                    {"", {sensor.second.propertyInterfaces.begin()->first}}};
            sensorTreePtr->emplace(sensor.second.sensorPath, connectionMap);  // maybe some errors here
        }
    }

#endif

What I want to know is whether this is a mistake.

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

No branches or pull requests

1 participant