1.先确认tp的固件已使能手势唤醒。
2.确认代码中打开手势唤醒的宏
3.手势唤醒系统的原理,就是tp接收到特殊的手势信号,tp会产生一个中断,cpu接收到该中断信号后,通过i2c读取具体的手势,然后汇报按键值给系统。由于只有某些特殊的按键值才能唤醒系统https://blog.csdn.net/mike8825/article/details/95904075,我们也可以配置相应的xxx.idc文件(xxx可以由getevent获取),加上属性touch.wake=1或者device.internal=1,这样所有的手势值都能亮屏。
http://androidxref.com/9.0.0_r3/xref/frameworks/native/services/inputflinger/InputReader.cpp
void TouchInputMapper::configureParameters() {
// Initial downs on external touch devices should wake the device.
// Normally we don't do this for internal touch screens to prevent them from waking
// up in your pocket but you can enable it using the input device configuration.
mParameters.wake = getDevice()->isExternal();
getDevice()->getConfiguration().tryGetProperty(String8("touch.wake"),
mParameters.wake);
}
void TouchInputMapper::cookAndDispatch(nsecs_t when) {
bool buttonsPressed = mCurrentRawState.buttonState & ~mLastRawState.buttonState;
if (initialDown || buttonsPressed) {
// If this is a touch screen, hide the pointer on an initial down.
if (mDeviceMode == DEVICE_MODE_DIRECT) {
getContext()->fadePointer();
}
if (mParameters.wake) {
policyFlags |= POLICY_FLAG_WAKE;
}
}
}
4.接入usb,按电源键熄屏,确认能唤醒屏幕。保证中断流程正常,getevent能或者到按键值,系统能亮屏。
5.第3点为假休眠,按电源键,tp会跟随lcd进入休眠,但usb会持有锁,系统不会真正进入休眠,称为浅度睡眠。拔出usb,让手机真正进入休眠。由于每种平台深度唤醒cpu的中断设置有差异,需修改驱动代码。假设深度睡眠后,手势无法唤醒屏幕,先确认手势有没有触发中断,看/proc/interrupts中tp的中断次数有没有增加。如果没有增加,就是中断设置有问题。确认request_irq有设置参数IRQF_NO_SUSPEND。如某些平台需要电平信号才能唤醒cpu,且电平持续100ms,这样就需要在在suspend设置中断类型为低电平irq_set_irq_type(irq, IRQ_TYPE_LEVEL_LOW )或者irq_set_irq_type(irq, IRQ_TYPE_LEVEL_HIGH ),在resume设置中断类型为边沿触发irq_set_irq_type(irq, IRQ_TYPE_EDGE_FALLING )或者irq_set_irq_type(irq, IRQ_TYPE_LEVEL_HIGH )。另外,休眠后,tp相应的引脚状态要正常。
6.确认底电流 手势唤醒一般不会使整机底电流变得过大,但需要确认,以免以后回来排除问题。