Olimex Support Forum

OLinuXino Android / Linux boards and System On Modules => A13 => Topic started by: Thomas on December 29, 2012, 05:32:35 PM

Title: PWR_BUT button usage
Post by: Thomas on December 29, 2012, 05:32:35 PM
Well, here is a good question :

How to get the state (pressed/released) of a the PWR_BUT on A13 ?

I want to have a button to shutdown the board.
Basically (in shell/C/whatever language),

boolean pressed=false;
while(true)
{
pressed=GET_PWR_BUT_VALUE();

if(pressed==true)
{
   System("shutdown -h now");
}
}
Title: Re: PWR_BUT button usage
Post by: Crenshinibon on January 23, 2013, 09:43:31 PM
Hi Thomas,

I'm trying to do the same. Any luck so far?

Regards
Dirk
Title: Re: PWR_BUT button usage
Post by: JohnS on January 23, 2013, 11:51:13 PM
It looks like it will produce KEY_POWER

Have a look on the net for that and such as EV_KEY