[Question] How can we use underscore "_" in sensor name?
Johnathan Mantey
johnathanx.mantey at intel.com
Thu Sep 16 00:36:13 AEST 2021
On 9/14/21 9:57 PM, Heyi Guo 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.
>
Rereading your original post you were having issues with sensor names
you explicitly had "_" characters, and the line on 419 turns it into a
blank space. The underscore character is overloaded at the D-Bus level.
I expect there may be an issue with my proposed solution, as D-Bus is
probably not going to allow the use of the '%' character. A solution
that fits within the D-Bus naming rules will be required to provide a
reliable encode/decode scheme.
<snip>
--
Johnathan Mantey
Senior Software Engineer
*azad te**chnology partners*
Contributing to Technology Innovation since 1992
Phone: (503) 712-6764
Email: johnathanx.mantey at intel.com <mailto:johnathanx.mantey at intel.com>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 495 bytes
Desc: OpenPGP digital signature
URL: <http://lists.ozlabs.org/pipermail/openbmc/attachments/20210915/e4054e0f/attachment-0001.sig>
More information about the openbmc
mailing list