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

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

  1. Droid
    B3y0ndD34th's Avatar
    Member #
    48912
    Join Date
    Mar 2010
    Posts
    88
    Phone
    Motorola Droid A855
    #11
    I don't mind sharing what I find as of right now I'm trying to figure out how to edit the fella.

    sysrw doesn't help, chmod doesn't help, godmode doesn't help for now I don't know how to edit the file... I don't mind sharing what I come up with but I am by no means looking for a project but I will help as much as I can to steer you in the right directions, but I'm not writing anything for anyone other than myself atm.
  2. Droid Ninja
    Se7enLC's Avatar
    Member #
    5148
    Join Date
    Nov 2009
    Posts
    1,263
    Liked
    6 times
    Phone
    Samsung Galaxy Nexus
    #12
    Quote Originally Posted by peteralfonso View Post
    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.
    Aha, inside the ramdisk! It all makes sense now...

    So unfortunately, to make a change to this means recompiling a kernel, which means that most people won't do it :-P

    Guess it's about time I learn how to compile an android kernel (can't be that different from std linux, right?)
    Cool CM Tricks
    custom_backup_list.txt - make a list of files in /system that will survive a nightly install (ringtones, notifications, system apps, wallpapers, whatever)
    in Terminal Emulator, set this as your shell command: "/system/xbin/su -c /system/xbin/bash". You get all the features of bash, root access, and you can still use the initial command field for whatever you want (default is adding /data/local/bin to your path)
  3. Senior Droid
    bad4u's Avatar
    Member #
    8302
    Join Date
    Nov 2009
    Posts
    226
    Phone
    moto droid
    #13
    Are you opening with text editor in root explorer? I did and was lost at that point. If i was to know which part I am supposed to edit I would do it, but I saw nothing with the key codes for camera or volume. I also checked in the reboot script. That doesnt open right in text editor.
    Themed swypes and stock keybrd for DX .. http://tinyurl.com/22q7mh2
  4. Droid
    B3y0ndD34th's Avatar
    Member #
    48912
    Join Date
    Mar 2010
    Posts
    88
    Phone
    Motorola Droid A855
    #14
    This is the part you edit

    #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

    it's in /init.sholes.rc

    As stated above apparently we have to compile a kernel to fix this... All your need to do is specify different keys for the keycodes and viola, It's near the bottom. I use Astro to view the file as a text document and open it in a text editor the code is near the bottom even has the commented part about Pete's shutdown script, kinda hard to miss tbh.
  5. Junior Droid
    crpngdth2001's Avatar
    Member #
    77745
    Join Date
    Jun 2010
    Location
    Delaware, Ohio
    Posts
    18
    Phone
    Motorola Droid
    #15
    Quote Originally Posted by B3y0ndD34th View Post
    This is the part you edit

    #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

    it's in /init.sholes.rc

    As stated above apparently we have to compile a kernel to fix this... All your need to do is specify different keys for the keycodes and viola, It's near the bottom. I use Astro to view the file as a text document and open it in a text editor the code is near the bottom even has the commented part about Pete's shutdown script, kinda hard to miss tbh.
    I don't believe any of the messages above meant to imply you needed to recompile the kernel to change the keystroke combination in init.sholes.rc. If you want to add other services (aka scripts) and then assign keycodes to them, you would have to recompile.

    I believe you can simply change the keycodes in init.sholes.rc to change the combination (or comment them out to disable them). Pete has included poweroff, reboot, and recovery services in his compiled rom - if you wanted to add something like a media player script or overclock script that could be controlled by up/down volume and another key then you would need to write that script and include it in the compiled kernel, then define as above in init.sholes.rc.

    This is my understanding, take it for what it's worth (esp. if it's wrong), LOL!

    Edit: FYI - I can edit my init.sholes.rc just fine with root explorer, hit the r/w button, open in text edit, save, hit r/o, exit.
    Last edited by crpngdth2001; 06-20-2010 at 09:41 PM. Reason: Added Note.
    Phone: Motorola Droid
    ROM: Kangerade v1.1

    Kernel: ChevyNo1 1.2 ULV
    Theme: Blueberry
  6. Senior Droid
    bad4u's Avatar
    Member #
    8302
    Join Date
    Nov 2009
    Posts
    226
    Phone
    moto droid
    #16
    Ok for anyone who has tried to edit the file, have you restarted and re-looked at the file? Your changes are no longer there.

    How do we get it to stay?
    Themed swypes and stock keybrd for DX .. http://tinyurl.com/22q7mh2
  7. Junior Droid
    crpngdth2001's Avatar
    Member #
    77745
    Join Date
    Jun 2010
    Location
    Delaware, Ohio
    Posts
    18
    Phone
    Motorola Droid
    #17
    Quote Originally Posted by bad4u View Post
    Ok for anyone who has tried to edit the file, have you restarted and re-looked at the file? Your changes are no longer there.

    How do we get it to stay?
    You are right, looks like I am entirely wrong a few posts up. The file must be recreated on reboot as part of the overall process. That would explain what Pete said regarding adding your script or making changes, and placing it in the ramdisk before recompiling...
    Phone: Motorola Droid
    ROM: Kangerade v1.1

    Kernel: ChevyNo1 1.2 ULV
    Theme: Blueberry
  8. Droid
    B3y0ndD34th's Avatar
    Member #
    48912
    Join Date
    Mar 2010
    Posts
    88
    Phone
    Motorola Droid A855
    #18
    Quote Originally Posted by crpngdth2001 View Post
    Quote Originally Posted by bad4u View Post
    Ok for anyone who has tried to edit the file, have you restarted and re-looked at the file? Your changes are no longer there.

    How do we get it to stay?
    You are right, looks like I am entirely wrong a few posts up. The file must be recreated on reboot as part of the overall process. That would explain what Pete said regarding adding your script or making changes, and placing it in the ramdisk before recompiling...
    XD but I did try your way with the Root Explorer, never used this program till today and I think I'm in love so thank you either way
  9. Senior Droid
    bad4u's Avatar
    Member #
    8302
    Join Date
    Nov 2009
    Posts
    226
    Phone
    moto droid
    #19
    so, who's got the how to on compiling a kernel then?
    Themed swypes and stock keybrd for DX .. http://tinyurl.com/22q7mh2
  10. Droid
    B3y0ndD34th's Avatar
    Member #
    48912
    Join Date
    Mar 2010
    Posts
    88
    Phone
    Motorola Droid A855
    #20
    Quote Originally Posted by bad4u View Post
    so, who's got the how to on compiling a kernel then?
    That's the same Question I have
Page 2 of 3 FirstFirst 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+