openbmc.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Johnathan Mantey <johnathanx.mantey@intel.com>
To: Heyi Guo <guoheyi@linux.alibaba.com>,
	Vernon Mauery <vernon.mauery@linux.intel.com>,
	Tom Joseph <rushtotom@gmail.com>,
	"Puli, Apparao" <apparao.puli@linux.intel.com>
Cc: "openbmc@lists.ozlabs.org" <openbmc@lists.ozlabs.org>
Subject: Re: [Question] How can we use underscore "_" in sensor name?
Date: Wed, 15 Sep 2021 07:36:13 -0700	[thread overview]
Message-ID: <a14d0f4f-d114-644e-1e09-9a2c3a0a46ac@intel.com> (raw)
In-Reply-To: <1405025a-fbd8-f350-ae12-5bf94671ff87@linux.alibaba.com>


[-- Attachment #1.1: Type: text/plain, Size: 1436 bytes --]

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@intel.com <mailto:johnathanx.mantey@intel.com>



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]

  parent reply	other threads:[~2021-09-15 14:38 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-13 10:49 [Question] How can we use underscore "_" in sensor name? Heyi Guo
2021-09-13 14:57 ` Johnathan Mantey
2021-09-15  4:57   ` Heyi Guo
2021-09-15 13:54     ` Oskar Senft
2021-09-15 16:23       ` Patrick Williams
2021-09-15 16:35         ` Ed Tanous
2021-09-18  2:38           ` Heyi Guo
2021-09-15 14:36     ` Johnathan Mantey [this message]
2021-09-13 15:22 ` Phil Eichinger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a14d0f4f-d114-644e-1e09-9a2c3a0a46ac@intel.com \
    --to=johnathanx.mantey@intel.com \
    --cc=apparao.puli@linux.intel.com \
    --cc=guoheyi@linux.alibaba.com \
    --cc=openbmc@lists.ozlabs.org \
    --cc=rushtotom@gmail.com \
    --cc=vernon.mauery@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).