DroidForums.net is the original Verizon Android Forum! Registered Users do not see these ads. Please Register - It's Free!
Page 1 of 3 123 LastLast
Results 1 to 10 of 27

Thread: [How To] Make Script Run By Using Hardware Keys

  1. Developer
    peteralfonso's Avatar
    Member #
    48423
    Join Date
    Mar 2010
    Posts
    844
    Liked
    5 times
    Phone
    Enter Current Phone Model Here
    DroidForums.net Developer
    Premium Member
    #1

    [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.

    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
    disabled
    keycodes 107 211

    service reboot /system/bin/shutdown -r
    disabled
    keycodes 107 114

    service recovery /system/bin/shutdown -rr
    disabled
    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.
    Last edited by peteralfonso; 06-19-2010 at 11:16 AM.
  2. Droid
    B3y0ndD34th's Avatar
    Member #
    48912
    Join Date
    Mar 2010
    Posts
    88
    Phone
    Motorola Droid A855
    #2
    What are the other codes for the keys, where do I find them?
  3. Junior Droid
    crpngdth2001's Avatar
    Member #
    77745
    Join Date
    Jun 2010
    Location
    Delaware, Ohio
    Posts
    18
    Phone
    Motorola Droid
    #3
    Sorry for outing your trick - lol
    Phone: Motorola Droid
    ROM: Kangerade v1.1

    Kernel: ChevyNo1 1.2 ULV
    Theme: Blueberry
  4. Droid
    B3y0ndD34th's Avatar
    Member #
    48912
    Join Date
    Mar 2010
    Posts
    88
    Phone
    Motorola Droid A855
    #4
    I want to edit mine to something like

    #shutdown options by pete
    service poweroff /system/bin/shutdown
    disabled
    keycodes 107 211 114

    service reboot /system/bin/shutdown -r
    disabled
    keycodes 107 114

    service recovery /system/bin/shutdown -rr
    disabled
    keycodes 107 115 211

    because I don't know any of the other keys avail, but I guess if this works a lot of the problems will be resolved for me...
    Last edited by B3y0ndD34th; 06-19-2010 at 11:30 AM.
  5. Senior Droid
    bad4u's Avatar
    Member #
    8302
    Join Date
    Nov 2009
    Posts
    226
    Phone
    moto droid
    #5
    CREDIT to pete! Thats all im saying haha ........ too funny

    I think imma change my reboot to like power plus x, had to delete it how it was though.
    Themed swypes and stock keybrd for DX .. http://tinyurl.com/22q7mh2
  6. Junior Droid
    crpngdth2001's Avatar
    Member #
    77745
    Join Date
    Jun 2010
    Location
    Delaware, Ohio
    Posts
    18
    Phone
    Motorola Droid
    #6
    Look in /system/usr/keylayout and you will see the files:

    sholes-keypad.kl
    qwerty.kl

    I think the phone uses qwerty.kl as a default if no other is defined.

    sholes-keypad.kl:

    key 399 GRAVE
    key 2 1 WAKE_DROPPED
    key 3 2 WAKE_DROPPED
    key 4 3 WAKE_DROPPED
    key 5 4 WAKE_DROPPED
    key 6 5 WAKE_DROPPED
    key 7 6 WAKE_DROPPED
    key 8 7 WAKE_DROPPED
    key 9 8 WAKE_DROPPED
    key 10 9 WAKE_DROPPED
    key 11 0 WAKE_DROPPED
    key 158 BACK WAKE_DROPPED
    key 230 SOFT_RIGHT WAKE
    key 60 SOFT_RIGHT WAKE
    key 107 POWER WAKE_DROPPED
    key 62 ENDCALL WAKE_DROPPED
    key 229 MENU WAKE_DROPPED
    key 59 MENU WAKE_DROPPED
    key 139 MENU WAKE_DROPPED
    key 217 SEARCH WAKE_DROPPED
    key 228 POUND WAKE_DROPPED
    key 227 STAR
    key 231 CALL WAKE_DROPPED
    key 61 CALL WAKE_DROPPED
    key 232 DPAD_CENTER WAKE_DROPPED
    key 108 DPAD_DOWN WAKE_DROPPED
    key 103 DPAD_UP WAKE_DROPPED
    key 102 HOME WAKE
    key 105 DPAD_LEFT WAKE_DROPPED
    key 106 DPAD_RIGHT WAKE_DROPPED
    key 115 VOLUME_UP WAKE
    key 114 VOLUME_DOWN WAKE
    key 116 POWER WAKE
    key 211 FOCUS
    key 212 CAMERA

    key 16 Q WAKE_DROPPED
    key 17 W WAKE_DROPPED
    key 18 E WAKE_DROPPED
    key 19 R WAKE_DROPPED
    key 20 T WAKE_DROPPED
    key 21 Y WAKE_DROPPED
    key 22 U WAKE_DROPPED
    key 23 I WAKE_DROPPED
    key 24 O WAKE_DROPPED
    key 25 P WAKE_DROPPED
    key 26 LEFT_BRACKET WAKE_DROPPED
    key 27 RIGHT_BRACKET WAKE_DROPPED
    key 43 BACKSLASH WAKE_DROPPED

    key 30 A WAKE_DROPPED
    key 31 S WAKE_DROPPED
    key 32 D WAKE_DROPPED
    key 33 F WAKE_DROPPED
    key 34 G WAKE_DROPPED
    key 35 H WAKE_DROPPED
    key 36 J WAKE_DROPPED
    key 37 K WAKE_DROPPED
    key 38 L WAKE_DROPPED
    key 214 SEMICOLON WAKE_DROPPED
    key 40 APOSTROPHE WAKE_DROPPED
    key 14 DEL WAKE_DROPPED

    key 44 Z WAKE_DROPPED
    key 45 X WAKE_DROPPED
    key 46 C WAKE_DROPPED
    key 47 V WAKE_DROPPED
    key 48 B WAKE_DROPPED
    key 49 N WAKE_DROPPED
    key 50 M WAKE_DROPPED
    key 51 COMMA WAKE_DROPPED
    key 52 PERIOD WAKE_DROPPED
    key 53 SLASH WAKE_DROPPED
    key 28 ENTER WAKE_DROPPED

    key 56 ALT_LEFT WAKE
    key 100 ALT_RIGHT WAKE
    key 42 SHIFT_LEFT WAKE
    key 54 SHIFT_RIGHT WAKE
    key 15 TAB WAKE_DROPPED
    key 57 SPACE WAKE_DROPPED
    key 150 EXPLORER
    key 155 ENVELOPE

    key 12 MINUS WAKE_DROPPED
    key 13 EQUALS WAKE_DROPPED
    key 215 AT WAKE_DROPPED
    Phone: Motorola Droid
    ROM: Kangerade v1.1

    Kernel: ChevyNo1 1.2 ULV
    Theme: Blueberry
  7. Droid
    B3y0ndD34th's Avatar
    Member #
    48912
    Join Date
    Mar 2010
    Posts
    88
    Phone
    Motorola Droid A855
    #7
    Quote Originally Posted by crpngdth2001 View Post
    Look in /system/usr/keylayout and you will see the files:

    sholes-keypad.kl
    qwerty.kl

    I think the phone uses qwerty.kl as a default if no other is defined.

    sholes-keypad.kl:

    key 399 GRAVE
    key 2 1 WAKE_DROPPED
    key 3 2 WAKE_DROPPED
    key 4 3 WAKE_DROPPED
    key 5 4 WAKE_DROPPED
    key 6 5 WAKE_DROPPED
    key 7 6 WAKE_DROPPED
    key 8 7 WAKE_DROPPED
    key 9 8 WAKE_DROPPED
    key 10 9 WAKE_DROPPED
    key 11 0 WAKE_DROPPED
    key 158 BACK WAKE_DROPPED
    key 230 SOFT_RIGHT WAKE
    key 60 SOFT_RIGHT WAKE
    key 107 POWER WAKE_DROPPED
    key 62 ENDCALL WAKE_DROPPED
    key 229 MENU WAKE_DROPPED
    key 59 MENU WAKE_DROPPED
    key 139 MENU WAKE_DROPPED
    key 217 SEARCH WAKE_DROPPED
    key 228 POUND WAKE_DROPPED
    key 227 STAR
    key 231 CALL WAKE_DROPPED
    key 61 CALL WAKE_DROPPED
    key 232 DPAD_CENTER WAKE_DROPPED
    key 108 DPAD_DOWN WAKE_DROPPED
    key 103 DPAD_UP WAKE_DROPPED
    key 102 HOME WAKE
    key 105 DPAD_LEFT WAKE_DROPPED
    key 106 DPAD_RIGHT WAKE_DROPPED
    key 115 VOLUME_UP WAKE
    key 114 VOLUME_DOWN WAKE
    key 116 POWER WAKE
    key 211 FOCUS
    key 212 CAMERA

    key 16 Q WAKE_DROPPED
    key 17 W WAKE_DROPPED
    key 18 E WAKE_DROPPED
    key 19 R WAKE_DROPPED
    key 20 T WAKE_DROPPED
    key 21 Y WAKE_DROPPED
    key 22 U WAKE_DROPPED
    key 23 I WAKE_DROPPED
    key 24 O WAKE_DROPPED
    key 25 P WAKE_DROPPED
    key 26 LEFT_BRACKET WAKE_DROPPED
    key 27 RIGHT_BRACKET WAKE_DROPPED
    key 43 BACKSLASH WAKE_DROPPED

    key 30 A WAKE_DROPPED
    key 31 S WAKE_DROPPED
    key 32 D WAKE_DROPPED
    key 33 F WAKE_DROPPED
    key 34 G WAKE_DROPPED
    key 35 H WAKE_DROPPED
    key 36 J WAKE_DROPPED
    key 37 K WAKE_DROPPED
    key 38 L WAKE_DROPPED
    key 214 SEMICOLON WAKE_DROPPED
    key 40 APOSTROPHE WAKE_DROPPED
    key 14 DEL WAKE_DROPPED

    key 44 Z WAKE_DROPPED
    key 45 X WAKE_DROPPED
    key 46 C WAKE_DROPPED
    key 47 V WAKE_DROPPED
    key 48 B WAKE_DROPPED
    key 49 N WAKE_DROPPED
    key 50 M WAKE_DROPPED
    key 51 COMMA WAKE_DROPPED
    key 52 PERIOD WAKE_DROPPED
    key 53 SLASH WAKE_DROPPED
    key 28 ENTER WAKE_DROPPED

    key 56 ALT_LEFT WAKE
    key 100 ALT_RIGHT WAKE
    key 42 SHIFT_LEFT WAKE
    key 54 SHIFT_RIGHT WAKE
    key 15 TAB WAKE_DROPPED
    key 57 SPACE WAKE_DROPPED
    key 150 EXPLORER
    key 155 ENVELOPE

    key 12 MINUS WAKE_DROPPED
    key 13 EQUALS WAKE_DROPPED
    key 215 AT WAKE_DROPPED
    Freakin awesome thanks... now if only I could get /init.sholes.rc to go r/w and can get it to chmod to edit :/
  8. Senior Droid
    bad4u's Avatar
    Member #
    8302
    Join Date
    Nov 2009
    Posts
    226
    Phone
    moto droid
    #8
    Since i deleted that shutdown script, can someone post it or tell me how to pull it from the update.zip.

    much thanks

    NM found the file. trying to break my phone right now. :P
    Last edited by bad4u; 06-19-2010 at 11:50 AM.
    Themed swypes and stock keybrd for DX .. http://tinyurl.com/22q7mh2
  9. Master Droid
    ashkev843's Avatar
    Member #
    7743
    Join Date
    Nov 2009
    Posts
    321
    Phone
    Enter Current Phone Here
    #9
    Can someone write one. To use the volume up and down to skip tracks on the music player when long pressed.
  10. Senior Droid
    bad4u's Avatar
    Member #
    8302
    Join Date
    Nov 2009
    Posts
    226
    Phone
    moto droid
    #10
    can we edit the shutdown script in root explorer?

    I opened it in text editor and now im officially lost. Any one feel like helping?


    Actually it might be a good idea for some one to post a howto and claim no responsibility before this becomes a "can i have, can you make me a..." thread.
    Last edited by bad4u; 06-19-2010 at 12:00 PM.
    Themed swypes and stock keybrd for DX .. http://tinyurl.com/22q7mh2
Page 1 of 3 123 LastLast

Links

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Similar Threads

  1. Help with writing a script
    By RichStevenson in forum Android Hacks and Help
    Replies: 3
    Last Post: 02-24-2014, 12:45 AM
  2. bb_improve - another script by me
    By Se7enLC in forum Bugless
    Replies: 3
    Last Post: 06-16-2010, 10:52 AM
  3. Script
    By ashin001 in forum Bugless
    Replies: 7
    Last Post: 05-27-2010, 05:06 PM
  4. Enableing script
    By Chris1980 in forum Android Hacks and Help
    Replies: 0
    Last Post: 05-15-2010, 03:52 PM

Search tags for this page

android hard key run script
,

android init keycodes

,

android wake dropped

,

init.rc keycodes

,

key 399 grave

,
keycodes 107 android
,

options pete init.sholes

,
run script hard key droid 2
,
service reboot /system/bin/shutdown
,
wake dropped android
Click on a term to search our site for related topics.
Find us on Google+