2

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 QWSServer class reference but I did not find anything that looks like it does what I want it to.

Jason Plank
  • 2,336
  • 5
  • 31
  • 40

3 Answers3

5

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 QWSServer class 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
  • 2,336
  • 5
  • 31
  • 40
2

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

hmuelner
  • 8,093
  • 1
  • 28
  • 39
  • I agree it has nothing to do with Qt by itself, but my version of Qt was compiled with the tslib driver (see http://doc.qt.nokia.com/4.6.2/qt-embedded-pointer.html). As it says there, "The mouse driver is loaded by the server application when it starts running". My question is whether the driver can be reloaded without stopping and restarting the program. I know what ts_calibrate.c does-- in my question, I mentioned that I have reverse-engineered the program already. – Jason Plank Jan 03 '11 at 16:14
0

ts_reconfig() should do what you want.

merge
  • 36
  • 3