how to reload tslib touch calibration?

Reload tslib touch screen calibration

  • Background: I am working on a somewhat large Qt-based GUI which handles all user interaction with a touch screen. The program is designed such that the user should not need to access a command prompt in order to do anything, including recalibrating the touch screen. I have written an imitation of tslib's ts_calibrate utility which runs as a QWidget and can modify tslib's calibration file at /etc/pointercal. However, although I can modify the calibration file, changes to the calibration do not seem to be applied until I close and restart the program. I have written a script which can handle re-opening the program, but I would like to find a more elegant way of doing this so that the user's hassle is kept to a minimum. Simply put, is there a function available in one of Qt's classes which will reload tslib's calibration file on the fly, without restarting the application? I have looked through the http://doc.qt.nokia.com/stable/qwsserver.html but I did not find anything that looks like it does what I want it to.

  • Answer:

    It turns out that the driver can be reloaded without restarting the application. To do so, you can close and re-open the pointer device(s), using methods in the http://doc.qt.nokia.com/latest/qwsserver.html like so: #include <QWSServer> ... QWSServer::instance()->closeMouse(); QWSServer::instance()->openMouse(); This will cause a reload of tslib's calibration file. E.g., if you started the program with a faulty calibration, correct the calibration file for the touch screen while the program is running, then invoke those methods, the pointer will adjust to the new calibration.

Jason Plank at Stack Overflow Visit the source

Was this solution helpful to you?

Other answers

tslib has nothing to do with Qt. You can download the sources of https://github.com/kergoth/tslib and look what tests/ts_calibrate.c does.

hmuelner

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.