[Question] How can we use underscore "_" in sensor name?

Oskar Senft osk at google.com
Wed Sep 15 23:54:47 AEST 2021


+1 to using something more explicit, like %20 instead of "_" for
replacing " " for D-bus names.

We're facing the same problem where "_" in sensor names from D-bus get
unconditionally replaced with " " in dbus-sensors. This is currently
preventing us from "converting" an older platform to Entity Manager.

Oskar.

On Wed, Sep 15, 2021 at 12:58 AM Heyi Guo <guoheyi at linux.alibaba.com> wrote:
>
> Hi Johnathan,
>
> The code in dbus-sensors will translate sensor name by replacing space "
> " to "_", e.g. ADCSensor.cpp:
>
> 53     Sensor(boost::replace_all_copy(sensorName, " ", "_"),
>
> Then in phosphor-ipmi-host dbus-sdr/sensorcommands.cpp, it will try to
> revert "_" back to " ":
>
>   419     std::replace(name.begin(), name.end(), '_', ' ');
>
> The first conversion does nothing for our case, but the 2nd conversion
> will unconditionally convert "_" to space " ".
>
> If we don't really forbid to use "_" in sensor names, I think we'd
> better replace space " " with %20 in dbus-sensors, and convert %20 back
> to " " in ipmi-host.
>
> Thanks,
>
> Heyi
>
> On 2021/9/13 下午10:57, Johnathan Mantey wrote:
> > Heyi,
> >
> > On 9/13/21 3:49 AM, Heyi Guo wrote:
> >> Hi all,
> >>
> >> Can we use underscore "_" in IPMI sensor names? Now we see that "_"
> >> in sensor names will be replaced with space in the code, even if we
> >> really use "_" for sensor names in json configuration files.
> >>
> >
> > Which layer is translating the "_" char?
> > Are you referring to D-Bus?
> > IPMITool?
> > Some other locatioN?
> >
> > It would be helpful to know.
> > As an example, D-Bus translates "-" to "%2D" and back because D-Bus,
> > or one of the D-Bus consumers can't accept the hyphen character.
> >
> > It is likely that the underscore character has some similar naming
> > convention issue.
> >
> > You may want to investigate using the same scheme to translate between
> > "_" and a "%5F" combination.
> >
> >> The background is that we used underscore "_" in sensor names in
> >> legacy BMC, and all the OOB software uses such names to get sensor
> >> data. Therefore we want to make it compatible for switching to OpenBMC.
> >>
> >> Is there any way to achieve this?
> >>
> >> Thanks,
> >>
> >> Heyi
> >>
> >


More information about the openbmc mailing list