Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Qt 4.8.6 Embedded Touchscreen not calibratable



  • Hi I'm having trouble getting my touchscreen working.

    I have an beaglebone black running debian. I want to use the touch interface of my faytech monitor.
    The Monitor works correctly without any driver installation. The mouse cursor is displayed on the screen if I touch it, but the location is wrong. It always has an offset to the real "touched" position.
    When I plug in a standard mouse into the monitro ( it has an integrated hub) the position is correct.
    So I need to calibrate the touch interface.
    I found out that /dev/interface/event5 is the correct location for the variable TSLIB_TSDEVICE.

    I've setup all the needed TSLIB environment variables. (Cannot post them now because I do not have them here at the moment)

    I build the calibratemouse example from qt, but it is not working with my touch. I can click with the finger as much as I want, the click/touch is not recognized. If I plug in the mouse I can click with it. The calibration process seems to work. But this is of course not what I want. Seems like it uses the wrong event.

    I even tried with the tslib tool ts_test and ts_calibrate.
    If I run ts_calibarate no errors are displayed, the screen resolution is outputted correctly but my clicking/touching is not recognized at all. The same is with the mouse. The cursor is not shown, nothing happens.
    If I run ts_test I can touch the screen and in the console I see output of the positions. They seem to be correct, because the values change from around 30 to 3900 for x and y. The only thing which is wrong is that the position on screen for the crosshair displayed has an offset.
    I inspected the code from tslib tools and found out the the difference is that ts_test uses ts_read() and ts_calibrate uses ts_read_raw().

    What can I do to get my touch working? I'm somehow clueless at the moment.

    I have no file /etc/pointercal because no calibration did take place.
    I'm able to click buttons in Qt if I manage it to move the cursor over an button (with the finger on an offset location).

    What could be the problem?

    Please help me.
    Greetings,
    Ben



  • I played around now for some time and found out that it seems onmy the touch event is not proceeded.

    The relevant code of the calibration method looks like this:

    int Calibration::exec()
    {
       if (QFile::exists("/etc/pointercal"))
       {
          backup = new QWSPointerCalibrationData;
          QWSServer::mouseHandler()->getCalibration(backup);
       }
    
       QWSServer::mouseHandler()->clearCalibration();
       grabMouse();
       activateWindow();
       int ret = QDialog::exec();
       releaseMouse();
       return ret;
    }
    
    void Calibration::mouseReleaseEvent(QMouseEvent *event)
    {
        // Map from device coordinates in case the screen is transformed
        QSize screenSize(qt_screen->width(), qt_screen->height());
        QPoint p = qt_screen->mapToDevice(event->pos(), screenSize);
    
        data.devPoints[pressCount] = p;
    
        if (++pressCount < 5)
            repaint();
        else
            accept();
    }
    

    If I make an breakpoint in mouseReleaseEvent I will never come into this function by a finger "click" on the touch. I I use mouse button it works.
    In the ts_test application I can see the positions if I move around, but it seems like the preassure is always 255.

    Here is a code snippet from ts_test.c:

    ret = ts_read(ts, &samp, 1);
    ...
    printf("%ld.%06ld: %6d %6d %6d\n", samp.tv.tv_sec, samp.tv.tv_usec, samp.x, samp.y, samp.pressure);
    

    example output is:
    ~#./ts_test
    1438012555.111557: 714 1068 255 1438012555.123489: 714 1069 255 1438012555.135494: 714 1070 255 1438012555.141526: 714 1071 255 ... 1438012555.282507: 733 1140 255 1438012555.291506: 735 1150 255 1438012555.297502: 737 1160 255 1438012555.303508: 739 1170 255

    I cannot explain myself why this does not work.

    These are my relevant environment variables:
    TSLIB_CALIBFILE=/etc/pointercal TSLIB_CONFFILE=/etc/ts.conf TSLIB_CONSOLEDEVICE=/dev/tty TSLIB_FBDEVICE=/dev/fb0 TSLIB_PLUGINDIR=/dpconfig/lib/ts TSLIB_TSDEVICE=/dev/input/event4 TSLIB_TSEVENTTYPE=INPUT
    Qt-relevant variables:
    POINTERCAL_FILE=/etc/pointercal QWS_MOUSE_PROTO='tslib:/dev/event4 IntelliMouse:/dev/mouse1'

    ts_calibrate outputs on command line only this:
    ~# ./ts_calibrate xres = 1280, yres = 720
    and then nothing happens; I have to cancel it by Ctrl+C;
    "clicking"/moving around by finger or even mouse click/move does simply nothing.
    While the screen output of ts_calibrate looks correct for me.

    I even compiled a sample code which was inside the driver ZIP-File provided by faytech, but this does not help me as well.
    (http://www.faytech.com/fileadmin/driver/eGTouch_v2.4.1820.L-x.tar.gz)

    I uploaded the code of the example to pastebin to prevent loosing the readability of this post: http://pastebin.com/i9iB1Jcs

    The output of this can be found on pastebin as well:
    I "clicked" one in left upper corner and then once in the right bottom corner.
    http://pastebin.com/k8R7LY96

    The only thing I can see is that I do not get ABS_PREASSURE messages.

    I'm very confused. I am very new to touchscreens.
    PLEASE can someone help me!!?!

    Regards, Ben



  • Hi, bacdk again, still having the same problem. I managed to get the evtest program to work: This is the output of it:

    root@arm:/config/bin# evtest
    No device specified, trying to scan all of /dev/input/event*
    Available devices:
    /dev/input/event0:      tps65217_pwr_but
    /dev/input/event1:      Logitech USB-PS/2 Optical Mouse
    /dev/input/event2:      eGalax Inc. USB TouchController
    /dev/input/event3:      eGalax Inc. USB TouchController
    /dev/input/event4:      eGalax Inc. USB TouchController
    /dev/input/event5:      eGalax Inc. USB TouchController
    /dev/input/event6:      eGalax Inc. USB TouchController
    Select the device event number [0-6]: 5
    Input driver version is 1.0.1
    Input device ID: bus 0x3 vendor 0xeef product 0x1 version 0x210
    Input device name: "eGalax Inc. USB TouchController"
    Supported events:
      Event type 0 (EV_SYN)
      Event type 1 (EV_KEY)
        Event code 330 (BTN_TOUCH)
      Event type 3 (EV_ABS)
        Event code 0 (ABS_X)
          Value   1118
          Min        0
          Max     4095
        Event code 1 (ABS_Y)
          Value   1232
          Min        0
          Max     4095
        Event code 47 (ABS_MT_SLOT)
          Value      0
          Min        0
          Max        7
        Event code 53 (ABS_MT_POSITION_X)
          Value      0
          Min        0
          Max     4095
        Event code 54 (ABS_MT_POSITION_Y)
          Value      0
          Min        0
          Max     4095
        Event code 57 (ABS_MT_TRACKING_ID)
          Value      0
          Min        0
          Max    65535
        Event code 59 (ABS_MT_DISTANCE)
          Value      0
          Min        0
          Max        1
    Properties:
      Property type 1 (INPUT_PROP_DIRECT)
    Testing ... (interrupt to exit)
    Event: time 1438185636.225816, type 3 (EV_ABS), code 53 (ABS_MT_POSITION_X), value 548
    Event: time 1438185636.225816, type 3 (EV_ABS), code 54 (ABS_MT_POSITION_Y), value 684
    Event: time 1438185636.225816, type 3 (EV_ABS), code 59 (ABS_MT_DISTANCE), value 0
    Event: time 1438185636.225816, type 3 (EV_ABS), code 0 (ABS_X), value 548
    Event: time 1438185636.225816, type 3 (EV_ABS), code 1 (ABS_Y), value 684
    Event: time 1438185636.225816, -------------- EV_SYN ------------
    Event: time 1438185636.231792, type 3 (EV_ABS), code 53 (ABS_MT_POSITION_X), value 546
    Event: time 1438185636.231792, type 3 (EV_ABS), code 54 (ABS_MT_POSITION_Y), value 682
    Event: time 1438185636.231792, type 3 (EV_ABS), code 0 (ABS_X), value 546
    Event: time 1438185636.231792, type 3 (EV_ABS), code 1 (ABS_Y), value 682
    Event: time 1438185636.231792, -------------- EV_SYN ------------
    Event: time 1438185636.240796, type 3 (EV_ABS), code 53 (ABS_MT_POSITION_X), value 544
    Event: time 1438185636.240796, type 3 (EV_ABS), code 54 (ABS_MT_POSITION_Y), value 680
    Event: time 1438185636.240796, type 3 (EV_ABS), code 0 (ABS_X), value 544
    Event: time 1438185636.240796, type 3 (EV_ABS), code 1 (ABS_Y), value 680
    Event: time 1438185636.240796, -------------- EV_SYN ------------
    Event: time 1438185636.246830, type 3 (EV_ABS), code 53 (ABS_MT_POSITION_X), value 542
    Event: time 1438185636.246830, type 3 (EV_ABS), code 54 (ABS_MT_POSITION_Y), value 676
    Event: time 1438185636.246830, type 3 (EV_ABS), code 0 (ABS_X), value 542
    Event: time 1438185636.246830, type 3 (EV_ABS), code 1 (ABS_Y), value 676
    Event: time 1438185636.246830, -------------- EV_SYN ------------
    Event: time 1438185636.252805, type 3 (EV_ABS), code 53 (ABS_MT_POSITION_X), value 540
    Event: time 1438185636.252805, type 3 (EV_ABS), code 54 (ABS_MT_POSITION_Y), value 674
    Event: time 1438185636.252805, type 3 (EV_ABS), code 0 (ABS_X), value 540
    Event: time 1438185636.252805, type 3 (EV_ABS), code 1 (ABS_Y), value 674
    Event: time 1438185636.252805, -------------- EV_SYN ------------
    Event: time 1438185636.270767, type 3 (EV_ABS), code 54 (ABS_MT_POSITION_Y), value 676
    Event: time 1438185636.270767, type 3 (EV_ABS), code 1 (ABS_Y), value 676
    Event: time 1438185636.270767, -------------- EV_SYN ------------
    Event: time 1438185636.285793, type 3 (EV_ABS), code 54 (ABS_MT_POSITION_Y), value 678
    Event: time 1438185636.285793, type 3 (EV_ABS), code 1 (ABS_Y), value 678
    Event: time 1438185636.285793, -------------- EV_SYN ------------
    Event: time 1438185636.342748, type 3 (EV_ABS), code 54 (ABS_MT_POSITION_Y), value 680
    Event: time 1438185636.342748, type 3 (EV_ABS), code 1 (ABS_Y), value 680
    Event: time 1438185636.342748, -------------- EV_SYN ------------
    Event: time 1438185636.393777, type 3 (EV_ABS), code 53 (ABS_MT_POSITION_X), value 538
    Event: time 1438185636.393777, type 3 (EV_ABS), code 54 (ABS_MT_POSITION_Y), value 678
    Event: time 1438185636.393777, type 3 (EV_ABS), code 0 (ABS_X), value 538
    Event: time 1438185636.393777, type 3 (EV_ABS), code 1 (ABS_Y), value 678
    Event: time 1438185636.393777, -------------- EV_SYN ------------
    Event: time 1438185636.399844, type 3 (EV_ABS), code 53 (ABS_MT_POSITION_X), value 536
    Event: time 1438185636.399844, type 3 (EV_ABS), code 54 (ABS_MT_POSITION_Y), value 676
    Event: time 1438185636.399844, type 3 (EV_ABS), code 0 (ABS_X), value 536
    Event: time 1438185636.399844, type 3 (EV_ABS), code 1 (ABS_Y), value 676
    Event: time 1438185636.399844, -------------- EV_SYN ------------
    Event: time 1438185636.408797, type 3 (EV_ABS), code 53 (ABS_MT_POSITION_X), value 532
    Event: time 1438185636.408797, type 3 (EV_ABS), code 54 (ABS_MT_POSITION_Y), value 674
    Event: time 1438185636.408797, type 3 (EV_ABS), code 0 (ABS_X), value 532
    Event: time 1438185636.408797, type 3 (EV_ABS), code 1 (ABS_Y), value 674
    Event: time 1438185636.408797, -------------- EV_SYN ------------
    Event: time 1438185636.414826, type 3 (EV_ABS), code 53 (ABS_MT_POSITION_X), value 528
    Event: time 1438185636.414826, type 3 (EV_ABS), code 54 (ABS_MT_POSITION_Y), value 670
    Event: time 1438185636.414826, type 3 (EV_ABS), code 0 (ABS_X), value 528
    Event: time 1438185636.414826, type 3 (EV_ABS), code 1 (ABS_Y), value 670
    Event: time 1438185636.414826, -------------- EV_SYN ------------
    Event: time 1438185636.420844, type 3 (EV_ABS), code 53 (ABS_MT_POSITION_X), value 526
    Event: time 1438185636.420844, type 3 (EV_ABS), code 54 (ABS_MT_POSITION_Y), value 666
    Event: time 1438185636.420844, type 3 (EV_ABS), code 0 (ABS_X), value 526
    Event: time 1438185636.420844, type 3 (EV_ABS), code 1 (ABS_Y), value 666
    Event: time 1438185636.420844, -------------- EV_SYN ------------
    Event: time 1438185636.426786, type 3 (EV_ABS), code 59 (ABS_MT_DISTANCE), value 1
    Event: time 1438185636.426786, -------------- EV_SYN ------------
    Event: time 1438185638.424816, type 3 (EV_ABS), code 53 (ABS_MT_POSITION_X), value 1700
    Event: time 1438185638.424816, type 3 (EV_ABS), code 54 (ABS_MT_POSITION_Y), value 2578
    Event: time 1438185638.424816, type 3 (EV_ABS), code 59 (ABS_MT_DISTANCE), value 0
    Event: time 1438185638.424816, type 3 (EV_ABS), code 0 (ABS_X), value 1700
    Event: time 1438185638.424816, type 3 (EV_ABS), code 1 (ABS_Y), value 2578
    Event: time 1438185638.424816, -------------- EV_SYN ------------
    

    I still have no clue what's wrong with the touch, Is there nobody who can help? Anybody?

    Regards, Ben


  • Lifetime Qt Champion

    Hi,

    Do you mean that even ts_calibrate doesn't see your device ?



  • @SGaist
    Hi, ts_calibrate does not print an error message, but "clicking" is not detected.
    It did print error messages before I corrected the environment variables.

    I have debian with kernel 3.8 running which should have built in support for the eGalax Touch screen.
    I'm still clueless.
    Regards, Ben


  • Lifetime Qt Champion

    I'd double check that support. Is the touch screen really acting as one or is it seen like a mouse ?



  • @SGaist I don't know. How to check this?
    Reagrds, Ben


  • Lifetime Qt Champion

    I've stumbled upon that repository That might help you


Log in to reply