最近有一条修改,觉得还算有意义,分享一下。本来当第一个手指点击在屏幕旁边的边框但是又不是虚拟按键的时候,屏幕是无法滑动的,但是现在要求改成可以滑动,修改如下
static void ftxxxx_report_value(struct ftxxxx_ts_data *data)
{
struct ts_event *event = &data->event;
int i;
int uppoint = 0;
static u8 last_touchpoint;
bool report_point=true;
u8 filter_touch_point=0;
int limit_report=13; //这个是屏幕的两侧的黑色边框的宽度
filter_touch_point = event->touch_point;
for (i = 0; i < event->touch_point; i++) {
report_point=true;
if(ASUS_check_point_position(event->au16_x[i],event->au16_y[i])){ //如果点击在虚拟按键的旁边,那么不能上报这个数据
report_point=false;
filter_touch_point--; //这样到时候上报抬起的时候得减去这个点
}
if(!keyboard_enable && report_point){
if(
//if the point is in non-reported area at the first touch.( HD: x < 13 or x > 720-13, FHD: x<23 or x > 1080-23).这里就是左右两边的黑色边框
(first_location[event->au8_finger_id[i]].x < limit_report) ||
(first_location[event->au8_finger_id[i]].x > (ftxxxx_ts->x_max - limit_report))
){
if(//if the point is in the reported area, report the point and set the flag to true.
(event->au8_touch_event[i] == 2) && (limit_report <= event->au16_x[i] && (event->au16_x[i]<= (ftxxxx_ts->x_max-limit_report))))
{
report_point=true;
first_location[event->au8_finger_id[i]].filter_flag = true;
}else{ // if the point is in non-reported area and if the flag to false, skeep the point.
if(!first_location[event->au8_finger_id[i]].filter_flag){
report_point=false;
filter_touch_point--;
}
}
}
}
}
if(!report_point)
continue; //如果判断这个当前的点属于不需要上报的区域则不上报直接返回下一次循环
input_mt_slot(data->input_dev,event->au8_finger_id[i]);
if (event->au8_touch_event[i]== 0 || event->au8_touch_event[i] == 2) {
input_mt_report_slot_state(data->input_dev,MT_TOOL_FINGER,true);
input_report_abs(data->input_dev, ABS_MT_PRESSURE, event->pressure[i]);
input_report_abs(data->input_dev, ABS_MT_TOUCH_MAJOR, event->area[i]);
input_report_abs(data->input_dev, ABS_MT_POSITION_X, event->au16_x[i]);
input_report_abs(data->input_dev, ABS_MT_POSITION_Y, event->au16_y[i]);
//A input_mt_sync(data->input_dev);
} else {
uppoint++;
input_mt_report_slot_state(data->input_dev,MT_TOOL_FINGER,false);
}
}
if((last_touchpoint>0)&&(event->Cur_touchpoint==0))
{
for(i=0;i<CFG_MAX_TOUCH_POINTS;i++)
{
input_mt_slot(data->input_dev,i);
input_mt_report_slot_state(data->input_dev,MT_TOOL_FINGER,false);
}
last_touchpoint=0;
}
if(filter_touch_point == uppoint) { //确认所有的点都抬起了
input_report_key(data->input_dev, BTN_TOUCH, 0);
} else {
input_report_key(data->input_dev, BTN_TOUCH, event->touch_point > 0);
}
input_sync(data->input_dev);
last_touchpoint=event->Cur_touchpoint;
}
看看里面的
static int ASUS_check_point_position(u16 x, u16 y){
int limit_y =1280;//下边框的位置
if((limit_y != 0) && y > limit_y){ 如果在下边缘往下
#ifdef ZE550KL_HD
limit_y = 1280;
if( x < 50 || (230 < x && x < 275) || (445 < x && x < 490) || x > 670)
return 1;
#endif
return 0;
}else
return 0;
return 0;
}
其实中心思想就是不上报在这个区域的点