问题描述:
迅为4412itop精英版10.1寸电容屏。
分辨率是1024*600。
最小linux系统下想通过读取/dev/input/event2事件
获取触摸坐标值,已经顺利的读出值。
1.但是手指在0-1023像素点间移动时,读取到的却是2-597范围。
2.在0-599像素点间移动时,读取到的却是7-1016范围。
内核部分源码如下
下面对input_x和Input_y的赋值应该怎样修改……
#endif
if (pre_touch || touch_num)
{
s32 pos = 0;
u16 touch_index = 0;
u8 report_num = 0;
coor_data = &point_data[3];
if(touch_num)
{
id = coor_data[pos] & 0x0F;
#if GTP_WITH_PEN
id = coor_data[pos]; //input_set_abs_params
if ((id & 0x80))
{
GTP_DEBUG("Pen touch DOWN(Slot)!");
input_x = coor_data[pos + 1] | (coor_data[pos + 2] << 8);
input_y = coor_data[pos + 3] | (coor_data[pos + 4] << 8);
input_w = coor_data[pos + 5] | (coor_data[pos + 6] << 8);
gtp_pen_down(input_x, input_y, input_w, 0);
pre_pen = 1;
pre_touch = 0;
pen_active = 1;
}
#endif
touch_index |= (0x01<<id);
}
GTP_DEBUG("id = %d,touch_index = 0x%x, pre_touch = 0x%x\n",id, touch_index,pre_touch);
for (i = 0; i < GTP_MAX_TOUCH; i++)
{
#if GTP_WITH_PEN
if (pre_pen == 1)
{
break;
}
#endif
if ((touch_index & (0x01<<i)))
{
input_x = coor_data[pos + 1] | (coor_data[pos + 2] << 8);
input_y = coor_data[pos + 3] | (coor_data[pos + 4] << 8);
input_w = coor_data[pos + 5] | (coor_data[pos + 6] << 8);
gtp_touch_down(ts, id, input_x, input_y, input_w);
pre_touch |= 0x01 << i;
report_num++;
if (report_num < touch_num)
{
pos += 8;
id = coor_data[pos] & 0x0F;
touch_index |= (0x01<<id);
}
}
else
{
gtp_touch_up(ts, i);
pre_touch &= ~(0x01 << i);
}
}
}
#else
if (touch_num)
{
for (i = 0; i < touch_num; i++)
{
coor_data = &point_data[i * 8 + 3];
id = coor_data[0] & 0x0F;
input_x = coor_data[1] | (coor_data[2] << 8);
input_y = coor_data[3] | (coor_data[4] << 8);
input_w = coor_data[5] | (coor_data[6] << 8);
#if GTP_WITH_PEN
id = coor_data[0];
if (id & 0x80)
{
GTP_DEBUG("Pen touch DOWN!");
gtp_pen_down(input_x, input_y, input_w, 0);
pre_pen = 1;
pen_active = 1;
break;
}
else
#endif
{
gtp_touch_down(ts, id, input_x, input_y, input_w);
}
}
}
else if (pre_touch)
{
#if GTP_WITH_PEN
if (pre_pen == 1)
{
GTP_DEBUG("Pen touch UP!");
gtp_pen_up(0);
pre_pen = 0;
pen_active = 1;
}
else
#endif
{
GTP_DEBUG("Touch Release!");
gtp_touch_up(ts, 0);
}
}
pre_touch = touch_num;
#endif