Calibrating and configuring evdevtouch on embedded qt project

一个人想着一个人 提交于 2020-03-05 05:38:46

问题


I have a Qt project running on a icoremx6solo with linux. I've setted up the graphics and run the code, but i can't handle touch inputs. Enabling the input logging with

export QT_LOGGING_RULES="qt.qpa.input=true"

i discovered that the coordinates ar not setted, i think that this is the main problem with that:

qt.qpa.input: evdevtouch: /dev/input/event0: Protocol type B  (multi)   
qt.qpa.input: evdevtouch: /dev/input/event0: min X: 0 max X: -1
qt.qpa.input: evdevtouch: /dev/input/event0: min Y: 0 max Y: -1
qt.qpa.input: evdevtouch: /dev/input/event0: min pressure: 0 max pressure: 0      
qt.qpa.input: evdevtouch: /dev/input/event0: device name: EP0790M09

but i can't find a way to calibrate that evdevtouch.

I tried runnin the executable with -plugin tslib attribute after executing the ts_calibrate command but the output is the same.

so, how can i fix that having a running touchscreen?


回答1:


Looking at QT's source (qevdevtouchhandler.cpp) the calibration values (min, max, pressure…) are obtained directly from the device ioctl.

There doesn't seem to be a way in Qt to change these values.

Looking at the kernel source for my controller (ADS7843 on Atmel spi) there doesn't seem to a way to change the values from user space (/proc, /sys).

The following snippet seems to do the job – reading and writing the calibration values:

    // check the parameter count
    if (argc != 3 && argc != 5) {
        puts ("Get usage: evgetset device absnumber");
        puts ("Set usage: evgetset device absnumber valname value");
        return (1);
    }

    // the first parameter is the device file name
    fd = open(argv[1], O_RDONLY);
    if (fd < 0) {
            puts ("Could not open device file - are you running as root");
        return (1);
    }

    // the second parameter is the parameter number
    absnumber = atoi (argv[2]);
    if (absnumber < 0 || absnumber > ABS_MAX) {
        puts ("absnumber out of range");
        return (1);
    }

    // Read the ioctl and display the current values
    ioctl(fd, EVIOCGABS(absnumber), &absval);
    printf ("Properties for %d\n", absnumber);
    printf ("Value : %d\n", absval.value);
    printf ("Minimum : %d\n", absval.minimum);
    printf ("Maximum : %d\n", absval.maximum);
    printf ("Fuzz : %d\n", absval.fuzz);
    printf ("Flat : %d\n", absval.flat);
//  printf ("Resolution : %d\n", absval.resolution);

    // check if a write is wanted - and do it
    if (argc == 5) {
        valvalue = atoi (argv[4]);
        if (!strcmp ("Value", argv[3])) absval.value = valvalue;
        if (!strcmp ("Minimum", argv[3])) absval.minimum = valvalue;
        if (!strcmp ("Maximum", argv[3])) puts ("Got Maximum");
        if (!strcmp ("Maximum", argv[3])) absval.maximum = valvalue;
        if (!strcmp ("Fuzz", argv[3])) absval.fuzz = valvalue;
        if (!strcmp ("Flat", argv[3])) absval.flat = valvalue;
//      if (!strcmp ("Resolution", argv[2]) absval.resolution = valvalue;
        ioctl(fd, EVIOCSABS(absnumber), &absval);
    }
    // all done
    close(fd);


来源:https://stackoverflow.com/questions/53299595/calibrating-and-configuring-evdevtouch-on-embedded-qt-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!