How to prevent the power button from putting the device into sleep?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

How to prevent the power button from putting the device into sleep?

跳至解决方案
2,645 次查看
dennis3
Contributor V

Our device has a power button the user can turn on/off the device like normal.  In fsl-imx8mq.dtsi this is defined via the snvs_pwrkey node:

     snvs_pwrkey: snvs-powerkey {
      compatible = "fsl,sec-v4.0-pwrkey";
      regmap = <&snvs>;
      interrupts = <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>;
      linux,keycode = <KEY_POWER>;
      wakeup-source;
     };

Power functions all work as designed except I have the need to prevent the device from going into a sleep state.  

Power button long press -> show power menu, user can shutdown or reboot (OK)

Power button long press > 5 seconds -> hard shutdown (OK)

Power button short press -> sleep. (wish to disable this)

Power button short press -> wake

Can someone point me to the right layer in Android or Linux where I might change the handler to ignore the short press sleep state?

0 项奖励
1 解答
2,510 次查看
shivanipatel
Senior Contributor II

Hi Dennis Muhlestein,

This is not a i.MX specific rather it is Android supported feature.

To disable the Power button short press sleep functionality, change the value of the variable "config_shortPressOnPowerBehavior" to 0 (zero) in {AOSP}/frameworks/base/core/res/res/values/config.xml file.

Hope this will help you.

Regards,

Shivani

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

在原帖中查看解决方案

2 回复数
2,511 次查看
shivanipatel
Senior Contributor II

Hi Dennis Muhlestein,

This is not a i.MX specific rather it is Android supported feature.

To disable the Power button short press sleep functionality, change the value of the variable "config_shortPressOnPowerBehavior" to 0 (zero) in {AOSP}/frameworks/base/core/res/res/values/config.xml file.

Hope this will help you.

Regards,

Shivani

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

2,510 次查看
dennis3
Contributor V

Thank you for this tip.  That's exactly what I was looking for.

0 项奖励