关机充电如何实现短按pwrkey灭屏

目前关机充电PWRKEY实现长按开机和短按亮屏功能,灭屏是根据BL_SWITCH_TIMEOUTS时间,自动灭屏的;如果需要实现PWRKEY主动灭屏,请按照如下方法修改:
 
 
alps/mediatek/platform/mt6577/uboot/mt6577_bat.c 函数mt65xx_bat_init
 
 1、修改:
  if (mt6577_detect_key(BACKLIGHT_KEY) || (!mt6577_detect_powerkey() && press_pwrkey_count > 0))
修改为:if (mt6577_detect_key(BACKLIGHT_KEY))
 
 
2、添加:
在if (mt6577_detect_key(BACKLIGHT_KEY))
{
.......
}
后面添加如下语句:
// add start
 if(!mt6577_detect_powerkey() && press_pwrkey_count > 0)
    {
        if(g_bl_on)
     {
        bl_switch = false;
                    bl_switch_timer = BL_SWITCH_TIMEOUT;
                    g_bl_on = true; 
                    printf("[BATTERY] ready to mt65xx_backlight_off ");
        }
     else
     {
     bl_switch = false;
                    bl_switch_timer = 0;
                    g_bl_on = true;
                    printf("[BATTERY] mt65xx_backlight_on ");
     }
    }
// add end
原文地址:https://www.cnblogs.com/liang123/p/6325370.html