action on phisical button on 4.0.4

Post your questions and help other users.

Moderator: Martin

Post Reply
holymoz
Posts: 113
Joined: 13 Sep 2013 10:27

action on phisical button on 4.0.4

Post by holymoz » 01 Feb 2014 09:00

hi, I'm not able to assign any action to phisical buttons (home, volume..). the assist trigger doesn't work because of android 4.0.4, also tried with xposed framework various module but nothing, before I quit can someone please :P confirm me that it's impossible to do or there's a solution? thanks :P

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

Re: action on phisical button on 4.0.4

Post by Martin » 04 Feb 2014 18:27

Hi,

It's probably not possible in the current version of Automagic. It should be possible to do something like this with the next version of Automagic with the new trigger Command Output.
It will be quite complicated and requires a rooted device with command getevent. I only tested this on an S3 and a Nexus 5 for now so it might not work on all devices.

Regards,
Martin

holymoz
Posts: 113
Joined: 13 Sep 2013 10:27

Re: action on phisical button on 4.0.4

Post by holymoz » 04 Feb 2014 18:45

ok thanks

holymoz
Posts: 113
Joined: 13 Sep 2013 10:27

Re: action on phisical button on 4.0.4

Post by holymoz » 06 Feb 2014 12:32

I played around with the getevent and sendevent shell commands and effectively works for me but it's a little complicated to set a function, needs to record the buttons or taps with getevent and reproduce the codes with sendevent in decimal.
I wish if you can get this process more easy, thanks

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

Re: action on phisical button on 4.0.4

Post by Martin » 07 Feb 2014 09:35

getevent supports some options that can make it easier to work with.

getevent -l will also print the name of the keys. Output will look like this:

Code: Select all

/dev/input/event1: EV_KEY       KEY_VOLUMEDOWN       DOWN                
/dev/input/event1: EV_SYN       SYN_REPORT           00000000            
/dev/input/event1: EV_KEY       KEY_VOLUMEDOWN       UP                  
/dev/input/event1: EV_SYN       SYN_REPORT           00000000
Instead of sendevent it's often possible to use command input to press some keys or produce touch input.

Code: Select all

usage: input ...
       input text <string>
       input keyevent <key code number or name>
       input tap <x> <y>
       input swipe <x1> <y1> <x2> <y2>

holymoz
Posts: 113
Joined: 13 Sep 2013 10:27

Re: action on phisical button on 4.0.4

Post by holymoz » 07 Feb 2014 13:00

thanks, I know about keyevent but prior to jelly bean does not support taps, I have ics.

for the getevent I use in terminal

getevent | grep event<code>

and returns the codes of the the keys or taps (usually 6 lines for 1 tap) like

/dev/input/event<code>: <hex> <hex> <hex>

, example event0 for touch or event1 for phisical keys, then I convert this codes in decimal and use them in

sendevent /dev/input/event<code> <dec> <dec> <dec>

every group of lines (single tap) end with 0 0 0, for long press I put a sleep 1 command before last line of zeros.

it works for me, altough for who can't use controlUI action due to pre-JB roms.

Post Reply