help: OpenBMC host power on from power button press

A, Maheswari maheswari.a at atos.net
Fri Nov 9 19:20:16 AEDT 2018


Hi Matt,

I was not able to work on OpenBMC project last 1 week due to some hardware unavailability

Sorry for the delay in response.

Able to find button power related services in standby target.
/etc/systemd/system/obmc-standby.target.wants/org.openbmc.buttons.Power at 0.service<mailto:/etc/systemd/system/obmc-standby.target.wants/org.openbmc.buttons.Power at 0.service>

hwmi:~# journalctl --no-pager | grep button
Oct 22 14:10:14 bullhwmi systemd[1]: Started Phosphor GPIO power_button monitor.
Oct 22 14:10:18 bullhwmi systemd[1]: Started Phosphor GPIO id_button monitor.

hwmi:~# journalctl --no-pager | grep power
Oct 22 14:10:14 bullhwmi systemd[1]: Started Phosphor GPIO power_button monitor.
Oct 22 14:10:42 bullhwmi systemd[1]: Starting Wait for /xyz/openbmc_project/control/host0/power_restore_policy...
Oct 22 14:10:46 bullhwmi systemd[1]: Started Wait for /xyz/openbmc_project/control/host0/power_restore_policy.
Oct 22 14:11:01 bullhwmi phosphor-discover-system-state[1088]: Host power is off, checking power policy.

OBMC_POWER_BUTTON_INSTANCES is defined in
./meta-bull/conf/distro/include/bull-defaults.inc and phosphor-defaults.inc.

hwmi:~# button_power.exe
GPIO Lookup:  POWER_BUTTON = 34,both
ERROR PowerButton: GPIO setup (rc=16)  .  (I hope this error in coming from button_power_obj.c.)


Trying to put debug message in “obmc-button-power/1.0-r1/git/pwrbutton/button_power_obj.c” which will be in build directory (git).
// get gpio device paths
        int rc = GPIO_OK;
        do {
                rc = gpio_init(&gpio_button);
                gpio_inits_done();
                if(rc != GPIO_OK) { break; }
                rc = gpio_open_interrupt(&gpio_button,on_button_interrupt,object);
                if(rc != GPIO_OK) { break; }
        } while(0);
        if(rc != GPIO_OK)
        {
                printf("ERROR PowerButton: GPIO setup (rc=%d)\n",rc);
                exit(-1);
        }


After building  my workspace all /debug message are gone.

For power button press – host-poweron.sh GPIO pulse script should run.
For power button long press – host-poweroff.sh GPIO pulse script should run.

How do integrate script into button-power.exe. ?
Please give your advice on how do create debug version of obmc image to check by debug log.
Please help to proceed further on ERROR PowerButton: GPIO setup (rc=16).

Attached journal log for reference.

Thanks
Maheswari A
From: Matt Spinler <mspinler at linux.vnet.ibm.com>
Sent: Tuesday, October 30, 2018 12:35 AM
To: A, Maheswari <maheswari.a at atos.net>
Cc: OpenBMC Maillist <openbmc at lists.ozlabs.org>
Subject: Re: help: OpenBMC host power on from power button press




On 10/29/2018 7:05 AM, A, Maheswari wrote:

Hi Matt,

Thanks for your response.

I am able to power on the Host by monitoring GPIO using “phosphor-gpio-monitor” service.

But still we need to achieve same result by org.openbmc.buttons.Power at 0.service<mailto:org.openbmc.buttons.Power at 0.service> in future.

Here is the response :

# systemctl status org.openbmc.buttons.Power at 0.service<mailto:org.openbmc.buttons.Power at 0.service>
● org.openbmc.buttons.Power at 0.service<mailto:org.openbmc.buttons.Power at 0.service> - Phosphor Power Button0
   Loaded: loaded (/lib/systemd/system/org.openbmc.buttons.Power at .service<mailto:/lib/systemd/system/org.openbmc.buttons.Power at .service>; indirect; vendor preset: enabled)
   Active: inactive (dead)

hwmi~# ps | grep button_power.exe
1205 root      3100 S    grep button_power.exe
hwmi:~#

button_power.exe is not running in BMC.  Service status with instance 0 is not showing any error. But button_power.exe is not running. So that I tried with instance 1.

Can you check if this link exists?

/etc/systemd/system/obmc-standby.target.wants/org.openbmc.buttons.Power at 0.service<mailto:/etc/systemd/system/obmc-standby.target.wants/org.openbmc.buttons.Power at 0.service>

That will start the service on the way to standby.  If it does exist, then it should be running, so maybe check
the journal for errors, or try running button_power.exe from the command line and see if it crashes.

(can also check that the standby target was reached with systemctl status obmc-standby.target)

If it doesn't exist, then you probably don't have OBMC_POWER_BUTTON_INSTANCES defined, though
that should be in phosphor-defaults.inc.



I think below file is responsible for button power controlling in OBMC.
c/skeleton/blob/master/pwrbutton/button_power_obj.c

Here is the receipe file.

Cat ./meta-phosphor/recipes-phosphor/chassis/obmc-button-power.bb
SUMMARY = "OpenBMC org.openbmc.Button example implementation"
DESCRIPTION = "A sample implementation for a button controlling a power domain."
PR = "r1"

inherit skeleton-gdbus
inherit obmc-phosphor-dbus-service
inherit pkgconfig

SKELETON_DIR = "pwrbutton"

FMT = "org.openbmc.buttons.Power@{0}.service"<mailto:org.openbmc.buttons.Power@%7b0%7d.service>
DBUS_SERVICE_${PN} += "${@compose_list(d, 'FMT', 'OBMC_POWER_BUTTON_INSTANCES')}"

If you need journal log, then I can share it. I need to understand the flow.

Please help to achieve.

Thanks
Maheswari A
From: Matt Spinler <mspinler at linux.vnet.ibm.com><mailto:mspinler at linux.vnet.ibm.com>
Sent: Saturday, October 27, 2018 1:45 AM
To: A, Maheswari <maheswari.a at atos.net><mailto:maheswari.a at atos.net>
Cc: OpenBMC Maillist <openbmc at lists.ozlabs.org><mailto:openbmc at lists.ozlabs.org>
Subject: Re: help: OpenBMC host power on from power button press


On 10/25/2018 11:52 PM, A, Maheswari wrote:
Hi,

I am new to openBMC project.

We are in the process of porting power button gpio interrupt handling in openBMC.

After some a lot of analysis, I found that obmc-button-power related service are necessary to power on the host using power button press event.

I have added POWER_BUTTON and machine specific GPIO number and polarity in gpio_defs.json.

While starting the “org.openbmc.button.Power” service, I am getting the below error.

   org.openbmc.buttons.Power at 1.service<mailto:org.openbmc.buttons.Power at 1.service> - Phosphor Power Button1
   Loaded: [[0;1;31merror[[0m (Reason: File exists)
   Active: inactive (dead)

Oct 22 14:14:13 hwmi systemd[1]: [[0;1;31m[[0;1;39m[[0;1;31morg.openbmc.buttons.Power at 1.service<mailto:0;1;31morg.openbmc.buttons.Power at 1.service>: Two services allocated for the same bus name org.open
bmc.butto.Power, refusing operation.[[0m

Please help to figure out and proceed.


Hi Maheswari,

I'm guessing you already have an org.openbmc.buttons.Power at 0.service<mailto:org.openbmc.buttons.Power at 0.service> running.

You can check with:

# systemctl status org.openbmc.buttons.Power at 0.service<mailto:org.openbmc.buttons.Power at 0.service>
or just check for the button_power.exe process already running.





Thanks
Maheswari A



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ozlabs.org/pipermail/openbmc/attachments/20181109/6875f866/attachment-0001.html>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: journalctl-log.txt
URL: <http://lists.ozlabs.org/pipermail/openbmc/attachments/20181109/6875f866/attachment-0001.txt>


More information about the openbmc mailing list