最近一段时间在搞android的触摸屏校正,想把心得记下来与大家分享,废话不多说,开始讲解.
注:调试使用的是
一、修改内核驱动
修改触摸屏驱动(kernel/drivers/input/touchscreen/s3c-ts.c)
-input_set_abs_params(ts->dev, ABS_X, X_COOR_MIN, X_COOR_MAX, X_COOR_FUZZ, 0);
-input_set_abs_params(ts->dev, ABS_Y, Y_COOR_MIN, Y_COOR_MAX, Y_COOR_FUZZ, 0);
+input_set_abs_params(ts->dev, ABS_X, 0, 0xFFF, 0, 0);
+input_set_abs_params(ts->dev, ABS_Y, 0, 0xFFF, 0, 0);
-input_set_abs_params(ts->dev, ABS_MT_POSITION_X, X_COOR_MIN,X_COOR_MAX, 0, 0);
-input_set_abs_params(ts->dev, ABS_MT_POSITION_Y, Y_COOR_MIN,Y_COOR_MAX, 0, 0);
+input_set_abs_params(ts->dev, ABS_MT_POSITION_X, 0, 0xFFF, 0, 0);
+input_set_abs_params(ts->dev, ABS_MT_POSITION_Y, 0, 0xFFF, 0, 0);
if(m_status == 1){
input_report_abs(ts->dev, ABS_MT_TOUCH_MAJOR, 500);
input_report_abs(ts->dev, ABS_MT_POSITION_X, m_lx);
input_report_abs(ts->dev, ABS_MT_POSITION_Y, m_ly);
+input_report_abs(ts->dev, ABS_PRESSURE, 1);
printk("X1:%d Y1:%d/n",m_lx,m_ly);
input_mt_sync(ts->dev);
input_report_abs(ts->dev, ABS_MT_TOUCH_MAJOR, 500);
input_report_abs(ts->dev, ABS_MT_POSITION_X, press_x);
input_report_abs(ts->dev, ABS_MT_POSITION_Y, press_y);
+ input_report_abs(ts->dev, ABS_PRESSURE, 1);
input_mt_sync(ts->dev);
}
else{
input_report_abs(ts->dev, ABS_MT_TOUCH_MAJOR, 500);
input_report_abs(ts->dev, ABS_MT_POSITION_X, x);
input_report_abs(ts->dev, ABS_MT_POSITION_Y, y);
+ input_report_abs(ts->dev, ABS_PRESSURE, 1);
printk("X2:%d Y2:%d/n",x,y);
input_mt_sync(ts->dev);
}
#if 1
+ input_report_abs(ts->dev, ABS_PRESSURE, 0);
#endif
-input_set_abs_params(ts->dev, ABS_X, X_COOR_MIN, X_COOR_MAX, X_COOR_FUZZ, 0);
-input_set_abs_params(ts->dev, ABS_Y, Y_COOR_MIN, Y_COOR_MAX, Y_COOR_FUZZ, 0);
+input