[yocto] Power button not shutting down the OS

Mark O'Donovan shiftee at eircom.net
Wed Aug 10 00:28:53 PDT 2016


On Tue, Aug 9, 2016 at 8:51 PM, Paul Knopf <pknopf at medxchange.com> wrote:
> Hey guys,
>
> I am having an issue with trying to get my power button (i.MX6) to shutdown
> the OS.
>
> My kernel has no configuration options for acpi, and acpid gives me the
> following error:
>
> -------
> root at seco-uq7-dl-256mbx4:~# /usr/sbin/acpid
> RTNETLINK1 answers: No such file or directory
> acpid: error talking to the kernel via netlink
> -------
>
> So, my guess is that I have to use udev. If I use udevadm monitor, no events
> get raised when I press the power switch.
>
> After digging through the kernel source code (Linux seco-uq7-dl-256mbx4
> 3.0.101 #1 SMP PREEMPT Thu Jun 2 10:49:45 PDT 2016 armv7l GNU/Linux) and the
> imx6 drivers, I finally found something that may help me.
>
> 1. I found the power button driver in the OS at
> /sys/bus/platform/drivers/imx_seco_pwrb.
>
> 2. Some more info that may be helpful.
>
> root at seco-uq7-dl-256mbx4:~# cat /proc/ectrl/events/power_button/enable
> disable
> root at seco-uq7-dl-256mbx4:~# cat /proc/ectrl/events/power_button/en_flash
> disable
> root at seco-uq7-dl-256mbx4:~# ls /sys/bus/platform/drivers/imx_seco_pwrb/
> bind    uevent  unbind
> 3. I found /proc/ectrl/events/event_state/power_button which stores the
> current state of the power button.
>
> root at seco-uq7-dl-256mbx4:~# cat /proc/ectrl/events/event_state/power_button
> active
> root at seco-uq7-dl-256mbx4:~# cat /proc/ectrl/events/event_state/power_button
> active
> root at seco-uq7-dl-256mbx4:~# cat /proc/ectrl/events/event_state/power_button
> active
> root at seco-uq7-dl-256mbx4:~# cat /proc/ectrl/events/event_state/power_button
> inactive
> root at seco-uq7-dl-256mbx4:~# cat /proc/ectrl/events/event_state/power_button
> inactive
> root at seco-uq7-dl-256mbx4:~# cat /proc/ectrl/events/event_state/power_button
> inactive
> My embedded operating system is using sysvinit, if that helps.
>
> I effectively need the power button to perform a shutdown -h now. Any ideas
> why it isn't currently?
>
> Thanks,
> Paul Knopf
> Software Engineer
> Med X Change, Inc
> pknopf at medxchange.com
>
> --
> _______________________________________________
> yocto mailing list
> yocto at yoctoproject.org
> https://lists.yoctoproject.org/listinfo/yocto
>

>From what I read online this should be done in userspace.
As I am not familiar with udev I made the following script:

#!/bin/sh
echo "monitoring poweroff key"
cat /dev/input/by-path/platform-gpio-keys-event | read -n 1
echo "shutting down"
/sbin/shutdown -hP now

Regards,
Mark



More information about the yocto mailing list