雨中徒步八英里 2018-11-18 08:04 采纳率: 0%
浏览 2816
已采纳

linux系统下读取触摸坐标值相反

问题描述:
迅为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

  • 写回答

2条回答 默认 最新

  • 雨中徒步八英里 2019-04-01 17:55
    关注

    自己写了个触摸屏校准程序,解决了.......

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。
  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝
  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
  • ¥15 让node服务器有自动加载文件的功能
  • ¥15 jmeter脚本回放有的是对的有的是错的