[How To] Make Script Run By Using Hardware Keys
Ok, so it looks like my little trick was found so I guess it's time to explain myself. :icon_eek:
I came up with a way to use the hardware keys to make services (a.k.a. scripts) run. It was rumored that these options were already built into Froyo and/or used in Cyanogen Mod, neither being true. This is just one of those ideas I wake up with in my head. After playing with it a few minutes it worked flawlessly.
To add these options to your boot.img add the following lines to your preferred init script inside the ramdisk before compiling.
#shutdown options by pete
service poweroff /system/bin/shutdown
keycodes 107 211
service reboot /system/bin/shutdown -r
keycodes 107 114
service recovery /system/bin/shutdown -rr
keycodes 107 115
Obviously you can make these do different things other than shutdown. You can even choose different keys to make them run (hint dont use the half press camera button or people go crazy! lol)
As always please be respectful and atleast put idea by Pete or some sort of credit to make me feel happy if you use it.