use "home" to select instead of "power" button in CWM Recovery


Last Updated:

  1. stayboogy

    stayboogy Well-Known Member

    i have successfully ported CWM Recovery to my ZTE Merit/Avail/Roamer using the CyanogenMod gingerbread source

    (i did not use the unofficial port that was built from the ZTE Blade because the screen is upside down)

    everything works just like it is supposed to--absolutely flawless. build went through without a hitch.

    decided that i instead wanted to use the "home" key to select menu options in the CWM Recovery instead of the "power" button that is default (had to uncomment BOARD_HAS_NO_SELECT_BUTTON in the BoardConfig.mk because there is no camera button on this phone)

    so i copied the recovery_ui.c from the working Blade source (which uses the "home" key instead of the "power" key), placed it into my ZTE Roamer (Merit/Avail) source and added BOARD_CUSTOM_RECOVERY_KEYMAPPING := /device/zte/roamer/recovery_ui.c to my BoardConfig.mk

    **there is no problem reading the location of the file so don't suggest to change it**

    but when i compile i get these errors and it is not built

    Code (Text):
    1.  
    2. prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/../lib/gcc/arm-eabi/4.4.3/../../../../arm-eabi/bin/ld: out/target/product/roamer/obj/EXECUTABLES/recovery_intermediates/recovery.o: in function get_menu_selection:bootable/recovery/recovery.c:470: error: undefined reference to 'device_handle_key'
    3.  
    4. prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/../lib/gcc/arm-eabi/4.4.3/../../../../arm-eabi/bin/ld: out/target/product/roamer/obj/EXECUTABLES/recovery_intermediates/recovery.o: in function wipe_data:bootable/recovery/recovery.c:681: error: undefined reference to 'device_wipe_data'
    5.  
    6. prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/../lib/gcc/arm-eabi/4.4.3/../../../../arm-eabi/bin/ld: out/target/product/roamer/obj/EXECUTABLES/recovery_intermediates/recovery.o: in function prompt_and_wait:bootable/recovery/recovery.c:707: error: undefined reference to 'device_perform_action'
    7.  
    8. prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/../lib/gcc/arm-eabi/4.4.3/../../../../arm-eabi/bin/ld: out/target/product/roamer/obj/EXECUTABLES/recovery_intermediates/recovery.o: in function prompt_and_wait:bootable/recovery/recovery.c:761: error: undefined reference to 'MENU_HEADERS'
    9.  
    10. prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/../lib/gcc/arm-eabi/4.4.3/../../../../arm-eabi/bin/ld: out/target/product/roamer/obj/EXECUTABLES/recovery_intermediates/recovery.o: in function prompt_and_wait:bootable/recovery/recovery.c:761: error: undefined reference to 'MENU_ITEMS'
    11.  
    12. prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/../lib/gcc/arm-eabi/4.4.3/../../../../arm-eabi/bin/ld: out/target/product/roamer/obj/EXECUTABLES/recovery_intermediates/recovery.o: in function main:bootable/recovery/recovery.c:851: error: undefined reference to 'device_recovery_start'
    13.  
    14. prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/../lib/gcc/arm-eabi/4.4.3/../../../../arm-eabi/bin/ld: out/target/product/roamer/obj/EXECUTABLES/recovery_intermediates/recovery.o: in function main:bootable/recovery/recovery.c:920: error: undefined reference to 'device_wipe_data'
    15.  
    16. prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/../lib/gcc/arm-eabi/4.4.3/../../../../arm-eabi/bin/ld: out/target/product/roamer/obj/EXECUTABLES/recovery_intermediates/ui.o: in function input_thread:bootable/recovery/ui.c:339: error: undefined reference to 'device_toggle_display'
    17.  
    18.  
    19. ./arm-eabi/bin/ld: out/target/product/roamer/obj/EXECUTABLES/recovery_intermediates/ui.o: in function input_thread:bootable/recovery/ui.c:346: error: undefined reference to 'device_reboot_now'
    20.  
    21. prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/../lib/gcc/arm-eabi/4.4.3/../../../../arm-eabi/bin/ld: out/target/product/roamer/obj/EXECUTABLES/recovery_intermediates/extendedcommands.o: in function show_advanced_menu:bootable/recovery/extendedcommands.c:961: error: undefined reference to 'device_handle_key'
    22.  
    the recovery_ui.c has not been edited at all and it works without a flaw on the Blade, and it doesn't use any other sources from /bootable/recovery/ than what any other one uses, but i get these errors when i try to build.

    neither have recovery.o, recovery.c, extendedcommands.o, or ui.c been edited in any way and they are the standard ones included in the CyanogenMod source. and these errors are not present when the Blade is built using the same recovery_ui.c

    here's my BoardConfig.mk

    Code (Text):
    1.  
    2. # inherit from the proprietary version
    3. -include vendor/zte/roamer/BoardConfigVendor.mk
    4.  
    5. TARGET_NO_BOOTLOADER := true
    6. TARGET_BOARD_PLATFORM := unknown
    7. TARGET_CPU_ABI := armeabi
    8. TARGET_BOOTLOADER_BOARD_NAME := roamer
    9. BOARD_KERNEL_CMDLINE :=
    10. BOARD_KERNEL_BASE := 0x02600000
    11. BOARD_KERNEL_PAGESIZE := 2048
    12.  
    13. # fix this up by examining /proc/mtd on a running device
    14. BOARD_BOOTIMAGE_PARTITION_SIZE := 0x00380000
    15. BOARD_RECOVERYIMAGE_PARTITION_SIZE := 0x00480000
    16. BOARD_SYSTEMIMAGE_PARTITION_SIZE := 0x08c60000
    17. BOARD_USERDATAIMAGE_PARTITION_SIZE := 0x105c0000
    18. BOARD_FLASH_BLOCK_SIZE := 131072
    19. TARGET_PREBUILT_KERNEL := device/zte/roamer/kernel
    20.  
    21. TARGET_RECOVER_INITRC := device/zte/roamer/recovery.rc
    22. BOARD_CUSTOM_RECOVERY_KEYMAPPING:= device/zte/roamer/recovery_u.ic
    23.  
    24. #BOARD_HAS_NO_SELECT_BUTTON := true
    25. # Use this flag if the board has a ext4 partition larger than 2gb
    26. #BOARD_HAS_LARGE_FILESYSTEM := true
    27.  
    28.  
    here's the recovery_ui.c

    Code (Text):
    1.  
    2. #include <linux/input.h>
    3.  
    4. #include "recovery_ui.h"
    5. #include "common.h"
    6. #include "extendedcommands.h"
    7. char* MENU_HEADERS[] = { "Use vol keys to highlight and home to select.",
    8.                          "",
    9.                          NULL };
    10.  
    11. char* MENU_ITEMS[] = { "reboot system now",
    12.                        "apply update from sdcard",
    13.                        "wipe data/factory reset",
    14.                        "wipe cache partition",
    15.                        "install zip from sdcard",
    16.                        "backup and restore",
    17.                        "mounts and storage",
    18.                        "advanced",
    19.                        "power off",
    20.                        NULL };
    21. int device_recovery_start() {
    22.     return 0;
    23. }
    24.  
    25. int device_toggle_display(volatile char* key_pressed, int key_code) {
    26.     int alt = key_pressed[KEY_LEFTALT] || key_pressed[KEY_RIGHTALT];
    27.     if (alt && key_code == KEY_L)
    28.         return 1;
    29.     // allow toggling of the display if the correct key is pressed, and the display toggle is allowed or the display is currently off
    30.     if (ui_get_showing_back_button()) {
    31.         return get_allow_toggle_display() && (key_code == KEY_MENU || key_code == KEY_END);
    32.     }
    33.     return get_allow_toggle_display() && (key_code == KEY_MENU || key_code == KEY_POWER || key_code == KEY_END);
    34. }
    35. int device_reboot_now(volatile char* key_pressed, int key_code) {
    36.     return 0;
    37. }
    38.  
    39. int device_handle_key(int key_code, int visible) {
    40.     if (visible) {
    41.         switch (key_code) {
    42.             case KEY_CAPSLOCK:
    43.             case KEY_DOWN:
    44.             case KEY_VOLUMEUP:
    45.                 return HIGHLIGHT_UP;
    46.             case KEY_LEFTSHIFT:
    47.             case KEY_UP:
    48.             case KEY_VOLUMEDOWN:
    49.                 return HIGHLIGHT_DOWN;
    50.  
    51.             case 62:
    52.   return SELECT_ITEM;
    53.             case KEY_POWER:
    54.                 if (ui_get_showing_back_button()) {
    55.                     return SELECT_ITEM;
    56.                 }
    57.                 if (!get_allow_toggle_display())
    58.                     return GO_BACK;
    59.                 break;
    60.             case KEY_LEFTBRACE:
    61.             case KEY_ENTER:
    62.             case BTN_MOUSE:
    63.             case KEY_CENTER:
    64.             case KEY_CAMERA:
    65.             case KEY_F21:
    66.             case KEY_SEND:
    67.      case KEY_HOME:
    68.                 return SELECT_ITEM;
    69.            
    70.             case KEY_END:
    71.             case KEY_BACKSPACE:
    72.             case KEY_BACK:
    73.                 if (!get_allow_toggle_display())
    74.                     return GO_BACK;
    75.         }
    76.     }
    77.  
    78.     return NO_ACTION;
    79. }
    80. int device_perform_action(int which) {
    81.     return which;
    82. }
    83.  
    84. int device_wipe_data() {
    85.     return 0;
    86. }
    87.  
    88.  
    someone who is familiar with this, who is not some novice that knows nothing about building a recovery.img from CyanogenMod source, please help me figure this out so that i can use the home button instead of the power button.

    is there any easier way to change this than by using a custom recovery_ui.c???

    Advertisement
  2. stayboogy

    stayboogy Well-Known Member

    I SOLVED THIS ON MY OWN...

    i edited /bootable/recovery/default_recovery_ui.c to use KEY_HOME and KEY_POWER for select

    now all builds always use these two keys to select items in the menu

Share This Page