GT9XX触摸屏双击唤醒功能分析
来源:互联网 发布:octane render mac 编辑:程序博客网 时间:2024/05/21 15:38
一、触摸屏唤醒方式
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_PEN u8 pen_active = 0; static u8 pre_pen = 0;#endif u8 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_MODE u8 rqst_buf[3] = {0x80, 0x43}; // for GT9XXF#endif#if GTP_GESTURE_WAKEUP u8 doze_buf[3] = {0x81, 0x4B};#endif GTP_DEBUG_FUNC(); ts = container_of(work, struct goodix_ts_data, work); if (ts->enter_update) { return; }#if GTP_GESTURE_WAKEUP if (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 0x814B doze_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 0x814B doze_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 0x814B doze_buf[2] = 0x00; gtp_i2c_write(i2c_connect_client, doze_buf, 3); } else { // clear 0x814B doze_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; }#endif ret = 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];}
0 0
- GT9XX触摸屏双击唤醒功能分析
- 触摸屏GT9xx移植
- GT9xx触摸屏驱动总结
- IMX6 GT9XX 10.1寸触摸屏移植
- 触摸屏唤醒实现
- 如何给触摸屏增加GT9XX内核编译选项
- 双击唤醒的原理:
- android 触摸屏双击事件
- android 触摸屏双击事件
- Linux触摸屏唤醒驱动实现
- Symbian触摸屏双击事件处理
- 功能分析
- touch的双击唤醒如何实现
- tp 双击唤醒 最终方案 实现流程
- s3c2440双击触摸屏的一种判定
- 关于unity的鼠标双击和移动触摸屏的双击
- 关于unity的鼠标双击和移动触摸屏的双击
- unity的鼠标双击和移动触摸屏的双击
- Buff系统
- iOS 不规则的ImageView
- sqlserver连接oracle数据库
- 【设计模式】【十一】策略模式
- pytest学习笔记
- GT9XX触摸屏双击唤醒功能分析
- Swift 闭包
- CART-分类回归树
- 手机消息推送之web端开发
- 文章标题app开发经历的过程
- 找出创新点后的变化思路
- TogetherJS:Mozilla推出的实时协作工具
- ipv4与ipv6
- css中的reset样式(含clearfix)