openbmc.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Thu Ba Nguyen <tbnguyen1985@gmail.com>
To: Vijay Khemka <vijaykhemka@fb.com>,
	Matt Spinler <mspinler@linux.ibm.com>,
	 Patrick Williams <patrick@stwcx.xyz>
Cc: OpenBMC Maillist <openbmc@lists.ozlabs.org>
Subject: Re: Enable/Disable some sensors when Host On/Off
Date: Thu, 22 Oct 2020 21:49:42 +0700	[thread overview]
Message-ID: <CALioo37LBToJaMs9Zt4q4WcMYKT_rF9zG1ujxv3q8HOQvsE8-w@mail.gmail.com> (raw)
In-Reply-To: <CALioo37b-BjgUdfZz2Vm+=6K6VMYRO9auyuHHo7=AZBFpoBzdw@mail.gmail.com>

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

I started on supporting enable/disable host sensors.
Everythings is fine until I add code to monitor host status as below.
bool MainLoop::isHostOn(void)
{
char buff[128];

if (!powerMatch)
{
log<level::ERR>("Power Match Not Created");
}
sprintf(buff, "isHostOn powerStatusOn: %d\n",powerStatusOn);
log<level::INFO>(buff);
return powerStatusOn;
}

std::shared_ptr<sdbusplus::bus::match::match>
MainLoop::startHostStateMonitor(void) {
return std::make_shared<sdbusplus::bus::match::match>(
*conn,
"type='signal',interface='org.freedesktop.DBus.Properties',"
"member='PropertiesChanged',arg0='xyz.openbmc_project.State.Host'",
[](sdbusplus::message::message &msg) {
std::string interfaceName;
boost::container::flat_map<std::string, std::variant<std::string>>
propertiesChanged;
try {
msg.read(interfaceName, propertiesChanged);
} catch (std::exception &e) {
log<level::ERR>("Unable to read host state\n");
return;
}
// We only want to check for CurrentHostState
if (propertiesChanged.begin()->first != "CurrentHostState") {
return;
}
auto findState = propertiesChanged.find(powProperty);
if (findState != propertiesChanged.end())
{
powerStatusOn = boost::ends_with(
std::get<std::string>(findState->second), "Running");
}
powerMatch = true;
});
}

void MainLoop::read()
{
// TODO: Issue#3 - Need to make calls to the dbus sensor cache here to
// ensure the objects all exist?

/* Host changed state from On to Off */
if (!isHostOn() && (lastPowerState == HOST_ON ||
lastPowerState == HOST_NA)) {
removeHostSensors();
lastPowerState = HOST_OFF;
}

/* Host changed state from Off to On */
if (isHostOn() && lastPowerState == HOST_OFF) {
addDroppedHostSensors();
lastPowerState = HOST_ON;
}

When build openBMC I got error:
tmp/work/arm1176jzs-openbmc-linux-gnueabi/phosphor-hwmon/1.0+gitAUTOINC+5906173aec-r1/recipe-sysroot/lib/libpthread.so.0:
error adding symbols: DSO missing from command line
| collect2: error: ld returned 1 exit status
| make[2]: *** [Makefile:643: phosphor-hwmon-readd] Error 1

It seems I need adding the threads lib to defend lib.
Any suggestion to add threads lib to build configuration?

Thanks.
Thu.

On Wed, Oct 21, 2020 at 11:54 PM Thu Ba Nguyen <tbnguyen1985@gmail.com>
wrote:

> Hi Vijay,
>
> I took a look on entity-manager and openbmc source.
> Don't have many companies  using entity-manager model to support sensors.
>
> Regards
> Thu Nguyen.
>
>
> On Wed, Oct 21, 2020 at 7:15 AM Vijay Khemka <vijaykhemka@fb.com> wrote:
>
>>
>>
>>
>>
>> *From: *openbmc <openbmc-bounces+vijaykhemka=fb.com@lists.ozlabs.org> on
>> behalf of Thu Ba Nguyen <tbnguyen1985@gmail.com>
>> *Date: *Monday, October 19, 2020 at 11:23 AM
>> *To: *Ed Tanous <ed@tanous.net>
>> *Cc: *OpenBMC Maillist <openbmc@lists.ozlabs.org>
>> *Subject: *Re: Enable/Disable some sensors when Host On/Off
>>
>>
>>
>> Hi Ed Tanous,
>>
>>
>>
>> > Thanks for your info,
>>
>> > But in your platform we are using phosphor-hwmon to manage sensors.
>>
>> > We don't use entity-manager.
>>
>> > As I knew we can't use both entity-manager and phosphor-hwmon for one
>> project.
>>
>>
>>
>> You can use both but for different sensors. You can decide what sensors
>> to configure
>>
>> via EM/dbus-sensors and which one for phosphor-hwmon.
>>
>>
>>
>> Regards
>>
>> Thu Nguyen.
>>
>

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

  reply	other threads:[~2020-10-22 14:51 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-18 13:58 Enable/Disable some sensors when Host On/Off Thu Ba Nguyen
2020-10-19 14:16 ` Matt Spinler
2020-10-19 15:23   ` Thu Ba Nguyen
2020-10-20 13:46     ` Matt Spinler
2020-10-20 14:18       ` Patrick Williams
2020-10-20 21:26         ` Matt Spinler
2020-10-20 23:21         ` Thu Ba Nguyen
2020-10-20 23:39         ` Thu Ba Nguyen
2020-10-20 23:16       ` Thu Ba Nguyen
2020-10-19 17:31 ` Ed Tanous
2020-10-19 18:22   ` Thu Ba Nguyen
2020-10-19 18:31     ` Ed Tanous
2020-10-20 23:05       ` Thu Ba Nguyen
2020-10-21  0:15     ` Vijay Khemka
2020-10-21 16:54       ` Thu Ba Nguyen
2020-10-22 14:49         ` Thu Ba Nguyen [this message]
2020-10-22 15:51           ` Matt Spinler
2020-10-22 22:45             ` Thu Ba Nguyen
2020-11-04  9:15               ` Thu Ba Nguyen
2020-11-04 16:31                 ` Matt Spinler
2020-11-04 22:18                   ` Thu Ba Nguyen
2020-11-05 20:52                     ` Matt Spinler
2020-11-05 23:16                       ` Thu Ba Nguyen
2020-11-05 23:24                         ` Matt Spinler

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=CALioo37LBToJaMs9Zt4q4WcMYKT_rF9zG1ujxv3q8HOQvsE8-w@mail.gmail.com \
    --to=tbnguyen1985@gmail.com \
    --cc=mspinler@linux.ibm.com \
    --cc=openbmc@lists.ozlabs.org \
    --cc=patrick@stwcx.xyz \
    --cc=vijaykhemka@fb.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).