Power Button - Android imx53 loco board

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Power Button - Android imx53 loco board

992 Views
MauricioCirelli
Contributor I

Hello!

 

I would like to change the behavior of my Android system when user clicks the power button.

The default behavior is to turn the screen off and on. I need to make this button act as an Android HOME button (going to Home).

Has anyone already modified the behavior of this button? Which .c file should I edit in the BSP source code to achieve my needs?

 

Im using Adeneo's Android BSP v4.1 (last Gingerbread version).

 

Any hints would be much appreciated!

 

Thank you!

 

EDIT:

I have found some interesting files inside Android file system:

/system/usr/keylayout/

Contains some .kl files which describes keys and actions. Where should I edit in my BSP source code to change this files after recompiling BSP? The /system is a read-only file system, so I cannot edit it through adb.

Tags (1)
0 Kudos
4 Replies

718 Views
MauricioCirelli
Contributor I

Hi Remi,

Thanks for your help.

 

Here’s what I’ve tried up to now:

-          Look at the src/kernel_imx/arch/arm/mach_mx5/mx53_loco.c file

  • Here I’ve found that Power Button is mapped to the KEY_F4 keyboard button. Is it right?
  • The power key event handler is registered here, to the pmic module.

-          Look at the src/kernel_imx/drivers/input/keyboard/mxc_pwrkey.c file

  • Here I’ve found that pwrkey_event_handler function is the handler for the Power Button event
  • This function delegates to the general input system handler input_report_key function

-          Look at the src/kernel_imx/drivers/input/input.c file

  • Here I’ve found a table of devices and their event handlers
  • I’ve also found that input_handle_event function handles all input events and I’m interested in the EV_KEY event type. Its delegated to the input_pass_event function.
  • The input_pass_event  function delegates to the function defined in the structure handle->handler->event(handle, type, code, value);  Now I’m lost.

 

Where is the callback function (the final one, because I could see this event is being thrown to many handlers and none of them actually handles it, just pass it to a next handler) for those events? Please, help me finding and implementing what I need.

0 Kudos

718 Views
rlorriaux
Contributor I

It corresponds the KEY_F4 and it is defined in the kernel sources, under arch/arm/mach-mx5/mx53_loco.c

0 Kudos

718 Views
MauricioCirelli
Contributor I

Hi Kirill,

Thank you for your reply.

I will try remounting, but its not a good solution. A good solution would be to modify BSP source code and rebuild Android image. 

I have already checked the schematics. I know power button is controlled by GPIO_8, but I cannot find where its actions are defined in the source code.

0 Kudos

718 Views
Kirill
Contributor I

You can edit /system through adb. You should remount this partition with rw rights. 

mount -o rw,remount /dev/block/mmcblk0p2 /system 

"/dev/block/mmcblk0p2" you should check this partition if had it. type mount , and you will see current mounting points. 

Check shematics of imx53 board , track lane of this button, may be it will lead you to some conclusions

0 Kudos