Power button trigger

Post your questions and help other users.

Moderator: Martin

Post Reply
ferda-mravenec
Posts: 8
Joined: 26 Aug 2015 09:03

Power button trigger

Post by ferda-mravenec » 08 Apr 2016 18:48

Hello.
I was unable to find a proper answer how to set up a trigger which will fire after long press on power button is registered. I came around with Command Output, but had no luck to set it up ,(
I am running stock 6.0 on LG G4 with root access.

Any help will be appreciated.
Thank you.

Martin

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Power button trigger

Post by Martin » 08 Apr 2016 19:25

Hi,

On a Nexus following configuration of trigger Command Output works:
Command: while true; do getevent -l -c1 /dev/input/event2; done
select as root
Output trigger condition: matches glob *KEY_POWER*UP*

Unfortunately I don't have a G4 test device. The device (/dev/input/event2) might be a different one like event0 or event1.

Regards,
Martin

ferda-mravenec
Posts: 8
Joined: 26 Aug 2015 09:03

Re: Power button trigger

Post by ferda-mravenec » 09 Apr 2016 12:25

Works like a charm with event1. Is it possible to stop propagating this event after it is handled by Automagic?
Thank you.

User avatar
MURTUMA
Posts: 697
Joined: 05 Mar 2013 22:43

Re: Power button trigger

Post by MURTUMA » 09 Apr 2016 14:04

It should not be possible by regular apps. However, there are an Xposed module Xposed Additions which allows you to remap hardware keys. If you are rooted and have Xposed Framework installed, that might be your solution. It has a risk of bricking your device so I will not recommend it any more than saying, it is possible.

ferda-mravenec
Posts: 8
Joined: 26 Aug 2015 09:03

Re: Power button trigger

Post by ferda-mravenec » 09 Apr 2016 17:25

I already have xposed installed. I will give the module a try. Thanks!

Post Reply