Skip to content

Power button status on event0 #20

@ruisebastiao

Description

@ruisebastiao

Hello,

i want to monitor the status of the power button in the beaglbone black, i found in google some info and i tested the following script:

!/bin/sh

BTN=/dev/input/event0

echo "Waiting for events..."

while true; do
BTNVAL=hexdump -e '8/2 "%x " "\n"' -n 16 $BTN | grep ' 74 ' | awk '{print $7}'
if [ "$BTNVAL" = "1" ]
then
echo "Power button detected"
break
fi
echo "(other event detected)"
sleep 1
done

echo "Sending shutdown..."
/sbin/shutdown -h now
echo "Finished!"

but i didn't work,

When i dumped the /dev/input/event0 nothing appears, why i'm not receiving power button events ?

I'm using a yocto generated linux distro with kernel 3.14.

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions