Hi,
We are currently working on IMX6 custom board & our OS is android lollipop with 3.10.53 linux kernel. When we press the power button, we have to get Reboot / Shutdown power status popup but we are not able to configure our gpio to perform this power button functionality.
Please provide a solution to fix it
Regards,
Haji
Hi Haji,
In dts under gpio-keys section add the below line.
power {
label = "Power Button";
gpios = <&gpio3 29 1>; //Here you need to give your gpio number
gpio-key,wakeup;
linux,code = <KEY_POWER>;
};
Hope above information is helpful for you!
Regards,
Aravinth
Hi,
When we using below code,we are able to get only power off popup (working). If i want to reboot/restart popup what are the changes i need to do
#define POWER_OFF IMX_GPIO_NR(2, 4)
static struct gpio_keys_button buttons[] = {
{
.gpio = POWER_OFF,
.code = KEY_POWER,
.desc = "Power Off Button",
.type = EV_KEY,
.active_low = 0,
.wakeup = 1,
}
};
static struct gpio_keys_platform_data button_data = {
.buttons = buttons,
.nbuttons = ARRAY_SIZE(buttons),
};
static struct platform_device button_device = {
.name = "gpio-keys",
.id = -1,
.num_resources = 0,
.dev = {
.platform_data = &button_data,
}
};
Hi Haji,
For restart you can try by modifying the below code.
.code = KEY_POWER,
.code = KEY_RESTART, //try this
Thanks,
Vinod
Hi Haji,
Do the below changes,
.code = KEY_SCREENLOCK,
Regards,
Aravinth
Hi aravinthkumar,
With below code changes also we are getting only poweroff popup. but we need reboot/restart popup
.code = KEY_SCREENLOCK,
Hi Haji,
That is application layer dependency. Ask them to check, If you get long press event from "KEY_SCREENLOCK" , popup the expected function(Reboot, poweroff, Screenshot, etc).
Hope above information is helpful for you!
Regards,
Aravinth
Is there any way to configure the same power button click event to show reboot option also ?
Thank you,
Deepanraj.A
Hi Deepanraj,
Yes. we can do it. It's just android pop-up.
Regards,
Aravinth
How to configure that pop up do you know ?
Thank you,
Deepanraj.A
Hi Deepanraj,
Sorry for the delay. Android App developer know about it.
Regards,
Aravinth
Hi haji,
You need to do a key mapping to the AOSP power key
PowerManager | Android Developers
Key layout files are searched for in the following order:
Regards