5,595,339 Members 48,371 Now Online
XDA Developers Android and Mobile Development Forum

[FIX] Prevent home button from waking device, add support for HTC headset button

Tip us?
 
paalkr
Old
(Last edited by paalkr; 27th May 2011 at 02:56 PM.)
#1  
Senior Member - OP
Thanks Meter 45
Posts: 677
Join Date: Jul 2005
Location: Hønefoss
Default [FIX] Prevent home button from waking device, add support for HTC headset button

Hi all!

By altering the key layout files I have managed to
a) prevent the device form waking up by pressing the home button. I was very annoyed by the fact that I almost always turned on the device when pulling it out of my pocket.

b) Enable support for HTC headset buttons

Because I have moved form HTC to the SGSII I had a leftover HTC headset with one button and a 3,5mm extension jack (see attached picture).

Over the stock SGSII headset the option to use custom earpieces is a great benefit in my opinion. The sound and microphone part of the HTC headset worked out of the box, but the SGSII did not react to button press from the headset.

Prevent wake on home button, alter system/usr/keylayout/sec_key.kl
(Remove wake from key 102)
Code:
key 115   VOLUME_UP            WAKE
key 114   VOLUME_DOWN        WAKE
key 102   HOME
key 107   ENDCALL           
key 105   DPAD_LEFT         
key 106   DPAD_RIGHT        
key 103   DPAD_UP           
key 108   DPAD_DOWN         
key 232   DPAD_CENTER       
key 116   POWER             WAKE
key 212   CAMERA            WAKE
Support for HTC headset, alter system/usr/keylayout/sec_jack.kl
(Add key 76)
Code:
key 163   MEDIA_NEXT        WAKE
key 165   MEDIA_PREVIOUS    WAKE
key 226   HEADSETHOOK       WAKE
key 76    HEADSETHOOK       WAKE
Regards,
PK

------------- Devices ---------------
HTC One, Samsung Galaxy tab 3 8-inch
Sony Xperia Z Returned
Samsung Galaxy SII | Samsung Galaxy Tab 10.1 | HTC Desire HD | HTC Desire
HTC HD2 | HTC Diamond2 | HTC Diamond Pro | HTC P3300 | Qtek S100
The Following 19 Users Say Thank You to paalkr For This Useful Post: [ Click to Expand ]
 
sheridan2000
Old
#2  
Senior Member
Thanks Meter 11
Posts: 128
Join Date: Dec 2009
What prog do i use to edit the KL file?
 
iOStoAndroid
Old
#3  
Senior Member
Thanks Meter 13
Posts: 100
Join Date: Aug 2010
why would even want to do that?
I spent ages trying to get ROMs on my HTC desire to enable OJ wake and the HTC head is only good enough for the bin (not even the recycle bin)

sorry only my 2p
 
paalkr
Old
#4  
Senior Member - OP
Thanks Meter 45
Posts: 677
Join Date: Jul 2005
Location: Hønefoss
Quote:
Originally Posted by iOStoAndroid View Post
why would even want to do that?
I spent ages trying to get ROMs on my HTC desire to enable OJ wake and the HTC head is only good enough for the bin (not even the recycle bin)

sorry only my 2p
Well, if you like the device to wake on home button or not is a personal choice.

I think you have misunderstood the HTC headset support. The whole point is to NOT use the earplugs from either HTC or Samsung (they both suck). But with the HTC one you are able to extend with any 3.5 regular headset and still play, pause, answer and hang up without taking the phone out of the pocket.

Regards,
PK

Sent from my GT-I9100 using XDA App
Regards,
PK

------------- Devices ---------------
HTC One, Samsung Galaxy tab 3 8-inch
Sony Xperia Z Returned
Samsung Galaxy SII | Samsung Galaxy Tab 10.1 | HTC Desire HD | HTC Desire
HTC HD2 | HTC Diamond2 | HTC Diamond Pro | HTC P3300 | Qtek S100
 
paalkr
Old
#5  
Senior Member - OP
Thanks Meter 45
Posts: 677
Join Date: Jul 2005
Location: Hønefoss
Quote:
Originally Posted by sheridan2000 View Post
What prog do i use to edit the KL file?
I used root explorer.

Sent from my GT-I9100 using XDA App
Regards,
PK

------------- Devices ---------------
HTC One, Samsung Galaxy tab 3 8-inch
Sony Xperia Z Returned
Samsung Galaxy SII | Samsung Galaxy Tab 10.1 | HTC Desire HD | HTC Desire
HTC HD2 | HTC Diamond2 | HTC Diamond Pro | HTC P3300 | Qtek S100
 
HumanoidTalking
Old
#6  
HumanoidTalking's Avatar
Senior Member
Thanks Meter 170
Posts: 561
Join Date: Sep 2010
Location: Doha
use Root explorer or ASTRO or ES File Explorer..
in Root explorer do to the file and long press it> options will come up and scroll down to see "Edit in text Editor" once done save it and thats it..


Quote:
Originally Posted by sheridan2000 View Post
What prog do i use to edit the KL file?
SGS2 Secret Codes + Volume Boosting Click HERE :

N7000 STOCK ROM Installation Guide HERE
 
sheridan2000
Old
(Last edited by sheridan2000; 27th May 2011 at 11:36 PM.)
#7  
Senior Member
Thanks Meter 11
Posts: 128
Join Date: Dec 2009
Quote:
Originally Posted by nasgilani View Post
use Root explorer or ASTRO or ES File Explorer..
in Root explorer do to the file and long press it> options will come up and scroll down to see "Edit in text Editor" once done save it and thats it..
Thanks ES File cant save it, so will try ASTRO, nope astro cant edit just cut, paste move....i think root explorere is paid so will look into that...

Quote:
Originally Posted by paalkr View Post
I used root explorer.

Sent from my GT-I9100 using XDA App
Thanks
 
mljjlm
Old
(Last edited by mljjlm; 4th June 2011 at 06:20 PM.)
#8  
Senior Member
Thanks Meter 68
Posts: 379
Join Date: Mar 2010
Location: Copenhagen

 
DONATE TO ME
Is "WAKE" the only thing that can be set for these buttons, or are there other commands as well?
EDIT: Nevermind, the answer is here
 
Emporioo
Old
#9  
Junior Member
Thanks Meter 12
Posts: 20
Join Date: Dec 2009
Location: Warrington

 
DONATE TO ME
Ahhhh I did the above to try and make a 'samsung' headset I have to try and make the button function work, but it did not work.

Must be a problem with the actual headset as I realise the command you added is just to make the button work while the phone is asleep.

Thanks anyway
 
walkergeri
Old
(Last edited by walkergeri; 7th June 2011 at 06:58 PM.)
#10  
walkergeri's Avatar
Senior Member
Thanks Meter 4
Posts: 200
Join Date: Feb 2008
Quote:
Originally Posted by paalkr View Post

Prevent wake on home button, alter system/usr/keylayout/sec_key.kl
(Remove wake from key 102)
[CODE]
key 115 VOLUME_UP WAKE
key 114 VOLUME_DOWN WAKE
key 102 HOME
key 107 ENDCALL
key 105 DPAD_LEFT
key 106 DPAD_RIGHT
key 103 DPAD_UP
key 108 DPAD_DOWN
key 232 DPAD_CENTER
key 116 POWER WAKE
key 212 CAMERA WAKE
its not working.... ah sorry, i forgot to make a reset, not its working fine, thanks.
HTC One M8
Android Revolution HD

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes