一、触摸屏唤醒方式
1.在屏幕上画其中26个字母中的一个来唤醒屏幕:例如:a/b/c/d….
2. 在屏幕上画线唤醒屏幕:”上/下/左/右”
3.双击屏幕唤醒:在屏幕上双击两下。
二、触摸屏唤醒的原理
其实唤醒屏幕的原理很简单,就是检测触摸屏上面的动作,如果该动作是唤醒手势,则触发电源开关键来唤醒屏幕,调用的方法是
input_report_key(ts->input_dev, KEY_POWER, 1);
input_sync(ts->input_dev);
input_report_key(ts->input_dev, KEY_POWER, 0);
input_sync(ts->input_dev);
三、GT9XX触摸屏的唤醒代码
static void goodix_ts_work_func(struct work_struct *work)
{u8 end_cmd[3] = {GTP_READ_COOR_ADDR >> 8, GTP_READ_COOR_ADDR & 0xFF, 0};u8 point_data[2 + 1 + 8 * GTP_MAX_TOUCH + 1]={GTP_READ_COOR_ADDR >> 8, GTP_READ_COOR_ADDR & 0xFF};u8 touch_num = 0;u8 finger = 0;static u16 pre_touch = 0;static u8 pre_key = 0;
#if GTP_WITH_PENu8 pen_active = 0;static u8 pre_pen = 0;
#endifu8 key_value = 0;u8* coor_data = NULL;s32 input_x = 0;s32 input_y = 0;s32 input_w = 0;s32 id = 0;s32 i = 0;s32 ret = -1;struct goodix_ts_data *ts = NULL;#if GTP_COMPATIBLE_MODEu8 rqst_buf[3] = {0x80, 0x43}; // for GT9XXF
#endif#if GTP_GESTURE_WAKEUPu8 doze_buf[3] = {0x81, 0x4B};
#endifGTP_DEBUG_FUNC();ts = container_of(work, struct goodix_ts_data, work);if (ts->enter_update){return;}
#if GTP_GESTURE_WAKEUPif (DOZE_ENABLED == doze_status){ ret = gtp_i2c_read(i2c_connect_client, doze_buf, 3);GTP_DEBUG("0x814B = 0x%02X", doze_buf[2]);if (ret > 0){ /*************** 画字母唤醒 **********************/if ((doze_buf[2] == 'a') || (doze_buf[2] == 'b') || (doze_buf[2] == 'c') ||(doze_buf[2] == 'd') || (doze_buf[2] == 'e') || (doze_buf[2] == 'g') || (doze_buf[2] == 'h') || (doze_buf[2] == 'm') || (doze_buf[2] == 'o') ||(doze_buf[2] == 'q') || (doze_buf[2] == 's') || (doze_buf[2] == 'v') || (doze_buf[2] == 'w') || (doze_buf[2] == 'y') || (doze_buf[2] == 'z') ||(doze_buf[2] == 0x5E) /* ^ */){if (doze_buf[2] != 0x5E){GTP_INFO("Wakeup by gesture(%c), light up the screen!", doze_buf[2]);}else{GTP_INFO("Wakeup by gesture(^), light up the screen!");}doze_status = DOZE_WAKEUP;input_report_key(ts->input_dev, KEY_POWER, 1);input_sync(ts->input_dev);input_report_key(ts->input_dev, KEY_POWER, 0);input_sync(ts->input_dev);// clear 0x814Bdoze_buf[2] = 0x00;gtp_i2c_write(i2c_connect_client, doze_buf, 3);}/*************** 画直线唤醒 **********************/ else if ( (doze_buf[2] == 0xAA) || (doze_buf[2] == 0xBB) ||(doze_buf[2] == 0xAB) || (doze_buf[2] == 0xBA) ){char *direction[4] = {"Right", "Down", "Up", "Left"};u8 type = ((doze_buf[2] & 0x0F) - 0x0A) + (((doze_buf[2] >> 4) & 0x0F) - 0x0A) * 2;GTP_INFO("%s slide to light up the screen!", direction[type]);doze_status = DOZE_WAKEUP;input_report_key(ts->input_dev, KEY_POWER, 1);input_sync(ts->input_dev);input_report_key(ts->input_dev, KEY_POWER, 0);input_sync(ts->input_dev);// clear 0x814Bdoze_buf[2] = 0x00;gtp_i2c_write(i2c_connect_client, doze_buf, 3);}/*************** 双击屏幕唤醒 **********************/else if (0xCC == doze_buf[2]){GTP_INFO("Double click to light up the screen!");doze_status = DOZE_WAKEUP;/ 模拟按下电源键唤醒 ///input_report_key(ts->input_dev, KEY_POWER, 1);input_sync(ts->input_dev);input_report_key(ts->input_dev, KEY_POWER, 0);input_sync(ts->input_dev);// clear 0x814Bdoze_buf[2] = 0x00;gtp_i2c_write(i2c_connect_client, doze_buf, 3);}else{// clear 0x814Bdoze_buf[2] = 0x00;gtp_i2c_write(i2c_connect_client, doze_buf, 3);gtp_enter_doze(ts);}}if (ts->use_irq){gtp_irq_enable(ts);}return;}
#endifret = gtp_i2c_read(ts->client, point_data, 12);if (ret < 0){GTP_ERROR("I2C transfer error. errno:%d\n ", ret);if (ts->use_irq){gtp_irq_enable(ts);}return;}finger = point_data[GTP_ADDR_LENGTH];
}