[HOWTO] Assign other buttons to show unlock screen

Search This thread

pina_

Senior Member
Mar 5, 2010
146
0
Has anyone already found a way to display the lockscreen using another button then the power on/off button? I can't get used to the new unlocking method. On my Hero, I just had to press a button to see the lockscreen and I even could press a button twice to unlock it.

I guess it should be possible with rooted phones? But I don't know how ofc...


Solution:

You need to edit the file bravo-keypad.kl in /system/usr/keylayout
Open the file in a text editor, you'll see something like this:

Code:
key 102   HOME
key 139   MENU              
key 158   BACK
key 217   SEARCH

key 107   ENDCALL           WAKE_DROPPED
key 116   POWER             WAKE_DROPPED

key 115   VOLUME_UP         WAKE
key 114   VOLUME_DOWN       WAKE

You'll have to put the string 'WAKE_DROPPED' behind the button you wish to use to unlock. It has been set on POWER and ENDCALL by default.

You need to pull the file first via recovery, edit it, then push it back to your phone. You can only do this via the recovery, not via programs like Root Explorer!

Go into recovery, then type in the following commands:

Windows:
  • adb-nilezon shell mount /system
  • adb-nilezon pull /system/usr/keylayout/bravo-keypad.kl c:\
  • edit bravo-keypad.kl to your liking
  • adb-nilezon push c:\bravo-keypad.kl /system/usr/keylayout/bravo-keypad.kl
  • adb-nilezon shell reboot

Mac:
  • ./adb-mac shell mount /system
  • ./adb-mac pull /system/usr/keylayout/bravo-keypad.kl
  • edit bravo-keypad.kl to your liking
  • ./adb-mac push bravo-keypad.kl /system/usr/keylayout/bravo-keypad.kl
  • ./adb-mac shell reboot

many thanks to RedDragCZ and ritdaw! :D
 
Last edited:

RedDragCZ

New member
Sep 14, 2008
3
0
Needs just a little tweak of the "/system/usr/keylayout/bravo-keypad.kl" file, adding the "WAKE_DROPPED" to the end of the line of some other key with which you want to be able to wake up your phone.
Currently, I'm using it this way:
Code:
key 102   HOME
key 139   MENU              WAKE_DROPPED
key 158   BACK
key 217   SEARCH

key 107   ENDCALL           WAKE_DROPPED
key 116   POWER             WAKE_DROPPED

key 115   VOLUME_UP         WAKE
key 114   VOLUME_DOWN       WAKE
Pressing the MENU button now shows the lockscreen and doubletapping it unlocks the device.

I guess it should be possible with rooted phones?
You are right, you need to have root access to your phone to apply this patch.
 

pina_

Senior Member
Mar 5, 2010
146
0
Needs just a little tweak of the "/system/usr/keylayout/bravo-keypad.kl" file, adding the "WAKE_DROPPED" to the end of the line of some other key with which you want to be able to wake up your phone.
Currently, I'm using it this way:
Code:
key 102   HOME
key 139   MENU              WAKE_DROPPED
key 158   BACK
key 217   SEARCH

key 107   ENDCALL           WAKE_DROPPED
key 116   POWER             WAKE_DROPPED

key 115   VOLUME_UP         WAKE
key 114   VOLUME_DOWN       WAKE
Pressing the MENU button now shows the lockscreen and doubletapping it unlocks the device.

You are right, you need to have root access to your phone to apply this patch.

edit2: Edited the file, saved the file but the phone just reboots and reverts the file back to default settings...
 
Last edited:

teitiel

Member
Aug 7, 2009
44
0
i have some issues, after putting the edited file back into /system/usr/keylayout I reboot the phone and the file changes back to default, can you help me here?
 

ivicask

Recognized Developer / Recognized Contributor
May 25, 2009
5,079
16,403
32
Zagreb
venomroms.com
This something i wanted from moment i got phone. Couldn anyone help me to figure this file so that:
1. Disable unlock screen by pressing menu.
2. unlock screen by double pressing optical trackball.

3.Also if i get above 2 working, i would like to disable on screen slide to unlock, so that just double click on optical unlocks phone.
 

ritdaw

Senior Member
Jan 17, 2007
272
8
Awesome find, works like a charm! My biggest nightmare with the desire is turning it on by accident when I push it in my pocket. Wouldn't be keen on disabling the power button though...
 

pina_

Senior Member
Mar 5, 2010
146
0
Awesome find, works like a charm! My biggest nightmare with the desire is turning it on by accident when I push it in my pocket. Wouldn't be keen on disabling the power button though...

what rom are you using? It keeps rebooting each time when I edited the file. And how did you edit the file? Perhaps I have to use a different method to edit the file...?
 

ritdaw

Senior Member
Jan 17, 2007
272
8
what rom are you using? It keeps rebooting each time when I edited the file. And how did you edit the file? Perhaps I have to use a different method to edit the file...?

MCR r3.

You need to use adb when in recovery and pull a copy of the file, then edit it and push it back to the same place. You only have full rw to the system partition in recovery.

For example (using windows root tools):

  • recovery-windows.bat
  • adb-nilezon shell mount /system
  • adb-nilezon pull /system/usr/keylayout/bravo-keypad.kl c:\
  • edit bravo-keypad.kl to your liking
  • adb-nilezon push c:\bravo-keypad.kl /system/usr/keylayout/bravo-keypad.kl
  • adb-nilezon shell reboot
 

pina_

Senior Member
Mar 5, 2010
146
0
MCR r3.

You need to use adb when in recovery and pull a copy of the file, then edit it and push it back to the same place. You only have full rw to the system partition in recovery.

For example (using windows root tools):

  • recovery-windows.bat
  • adb-nilezon shell mount /system
  • adb-nilezon pull /system/usr/keylayout/bravo-keypad.kl c:\
  • edit bravo-keypad.kl to your liking
  • adb-nilezon push c:\bravo-keypad.kl /system/usr/keylayout/bravo-keypad.kl
  • adb-nilezon shell reboot

yeah it works! I used mac os x and it works too :)
 

Don't Ask

Member
May 13, 2010
15
0
Does anyone know what to edit in order to disable the menu button from unlocking the device?

I tried messing around with the bravo-keypad.kl file, but I haven't found a way to configure it so that only the power button is active when the device is locked.
 

Eddiemc

Senior Member
Mar 15, 2010
1,400
535
Which key number is assigned to the trackpad press button?

I want to add WAKE_DROPPED to the correct key number, but I cannot work out which one it is..

The C.M 506 rom has an identical .kl file, yet with that rom I can unlock with trackball press. Guess it's modded elsewere..?

Can someone shed som light?
 
Last edited:

jbaldwinroberts

Senior Member
Mar 7, 2009
66
0
Hello everyone,

I've just rooted my phone and flashed the custom modaco ROM, when you enter the revovery menu by using "recovery-windows.bin" the terminal says
Code:
D:\Downloads\2>echo Desire Recovery Mode
Desire Recovery Mode

D:\Downloads\2>echo.


D:\Downloads\2>echo Pushing required files to device...
Pushing required files to device...

D:\Downloads\2>echo.


D:\Downloads\2>adb-windows.exe push files /
push: files/etc/mtab -> /etc/mtab
push: files/etc/fstab -> /etc/fstab
push: files/sbin/wipe -> /sbin/wipe
push: files/sbin/unyaffs -> /sbin/unyaffs
push: files/sbin/ums_toggle -> /sbin/ums_toggle
push: files/sbin/um -> /sbin/um
push: files/sbin/tune2fs -> /sbin/tune2fs
push: files/sbin/toolbox -> /sbin/toolbox
push: files/sbin/sdparted -> /sbin/sdparted
push: files/sbin/recovery -> /sbin/recovery
push: files/sbin/reboot -> /sbin/reboot
push: files/sbin/parted -> /sbin/parted
push: files/sbin/nandroid-mobile.sh -> /sbin/nandroid-mobile.sh
push: files/sbin/mkyaffs2image -> /sbin/mkyaffs2image
push: files/sbin/mke2fs -> /sbin/mke2fs
push: files/sbin/log2sd -> /sbin/log2sd
push: files/sbin/fs -> /sbin/fs
push: files/sbin/flash_image -> /sbin/flash_image
push: files/sbin/fix_permissions -> /sbin/fix_permissions
push: files/sbin/e2fsck -> /sbin/e2fsck
push: files/sbin/dump_image -> /sbin/dump_image
push: files/sbin/busybox -> /sbin/busybox
push: files/sbin/backuptool.sh -> /sbin/backuptool.sh
push: files/sbin/adbd -> /sbin/adbd
push: files/system/bin/sh -> /system/bin/sh
push: files/system/bin/linker -> /system/bin/linker
push: files/system/lib/libstdc++.so -> /system/lib/libstdc++.so
push: files/system/lib/libm.so -> /system/lib/libm.so
push: files/system/lib/liblog.so -> /system/lib/liblog.so
push: files/system/lib/libcutils.so -> /system/lib/libcutils.so
push: files/system/lib/libc.so -> /system/lib/libc.so
31 files pushed. 0 files skipped.
983 KB/s (3709881 bytes in 3.683s)

D:\Downloads\2>adb-windows.exe shell busybox --install /sbin

D:\Downloads\2>echo.


D:\Downloads\2>adb-windows.exe shell /sbin/recovery

How do i enter in more commands without the prompt??

Thanks for your help.
 

zaphyr

Senior Member
Jun 23, 2008
385
19
For some reason it doesn't work here
I'm trying to use this file

Code:
key 102   HOME
key 139   MENU              WAKE_DROPPED
key 158   BACK
key 217   SEARCH

key 107   ENDCALL           WAKE_DROPPED
key 116   POWER

key 115   VOLUME_UP         WAKE
key 114   VOLUME_DOWN       WAKE

I pulled the file after a reboot, and it has not ben overwritten by default, but I can still use the powerbutton to wake up the phone :confused:

The original file looked like this

Code:
key 102   HOME
key 139   MENU
key 158   BACK
key 217   SEARCH
key 107   ENDCALL           WAKE_DROPPED
key 116   POWER             WAKE_DROPPED
key 115   VOLUME_UP         WAKE
key 114   VOLUME_DOWN       WAKE
# key 399   GRAVE
# key 2     1
# key 3     2
# key 4     3
# key 5     4
# key 6     5
# key 7     6
# key 8     7
# key 9     8
# key 10    9
# key 11    0
# key 158   BACK              WAKE_DROPPED
# key 230   SOFT_RIGHT        WAKE
# key 60    SOFT_RIGHT        WAKE
# 
# key 62    ENDCALL           WAKE_DROPPED
# key 229   MENU              WAKE_DROPPED
# key 59    MENU              WAKE_DROPPED
# key 139   MENU              WAKE_DROPPED
# key 127   SEARCH            WAKE_DROPPED
# key 228   POUND
# key 227   STAR
# key 231   CALL              WAKE_DROPPED
# key 61    CALL              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 211   FOCUS
# key 212   CAMERA
# 
# key 16    Q
# key 17    W
# key 18    E
# key 19    R
# key 20    T
# key 21    Y
# key 22    U
# key 23    I
# key 24    O
# key 25    P
# key 26    LEFT_BRACKET
# key 27    RIGHT_BRACKET
# key 43    BACKSLASH
# 
# key 30    A
# key 31    S
# key 32    D
# key 33    F
# key 34    G
# key 35    H
# key 36    J
# key 37    K
# key 38    L
# key 39    SEMICOLON
# key 40    APOSTROPHE
# key 14    DEL
#         
# key 44    Z
# key 45    X
# key 46    C
# key 47    V
# key 48    B
# key 49    N
# key 50    M
# key 51    COMMA
# key 52    PERIOD
# key 53    SLASH
# key 28    ENTER
#         
# key 56    ALT_LEFT
# key 42    SHIFT_LEFT
# key 15    TAB
# key 57    SPACE
# key 150   EXPLORER
# key 155   ENVELOPE        
# 
# key 12    MINUS
# key 13    EQUALS
# key 215   AT

@viper_campbell: Maybe key 212 can be used for unlocking with the optical button
 
@viper_campbell: Maybe key 212 can be used for unlocking with the optical button

Nope 212 doesnt work :( also tried a few others but no luck... Im thinking the key number isn't included in this file...

Also i reckon the reason why your file isnt working is possibly because you have removed the power button function... As i left that in and changed the menu, and that worked fine, Power button would wake device and double press menu would wake and unlock...
 

zaphyr

Senior Member
Jun 23, 2008
385
19
Nah, I had the powerbutton there as well first, and then changed it because I don't want it to wake the phone...only the menu button should be active imo. But as it is now, all buttons wake the phone, but doubleclicking the menubutton will make a "unlock bar" appear on the screen.

I'm on 1.15.405.4 as provided by Paul when he first released the root guide.