Migrate tslib to new plugin format

Also rename the binary and avoid crashes when tslib initialization
fails.

Change-Id: Ia7ccf7c997e1b1484bd475626ca16c9a9642466e
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
This commit is contained in:
Laszlo Agocs 2012-05-24 13:41:36 +03:00 committed by Qt by Nokia
parent dacc3f2852
commit 22ef98c0b1
4 changed files with 17 additions and 6 deletions

View File

@ -46,6 +46,9 @@ QT_BEGIN_NAMESPACE
class QTsLibPlugin : public QGenericPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QGenericPluginFactoryInterface" FILE "tslib.json")
public:
QTsLibPlugin();
@ -71,8 +74,8 @@ QObject* QTsLibPlugin::create(const QString &key,
if (!key.compare(QLatin1String("Tslib"), Qt::CaseInsensitive) || !key.compare(QLatin1String("TslibRaw"), Qt::CaseInsensitive))
return new QTsLibMouseHandler(key, specification);
return 0;
}
Q_EXPORT_PLUGIN2(qtslibplugin, QTsLibPlugin)
}
QT_END_NAMESPACE
#include "main.moc"

View File

@ -68,13 +68,16 @@ QTsLibMouseHandler::QTsLibMouseHandler(const QString &key,
if (specification.startsWith("/dev/"))
device = specification.toLocal8Bit();
m_dev = ts_open(device.constData(), 1);
m_dev = ts_open(device.constData(), 1);
if (!m_dev) {
qErrnoWarning(errno, "ts_open() failed");
return;
}
if (ts_config(m_dev)) {
perror("Error configuring\n");
}
m_rawMode = !key.compare(QLatin1String("TslibRaw"), Qt::CaseInsensitive);
int fd = ts_fd(m_dev);

View File

@ -0,0 +1,3 @@
{
"Keys": [ "Tslib", "TslibRaw" ]
}

View File

@ -1,4 +1,4 @@
TARGET = qlinuxinputplugin
TARGET = qtslibplugin
load(qt_plugin)
DESTDIR = $$QT.gui.plugins/generic
@ -11,3 +11,5 @@ SOURCES = main.cpp \
qtslib.cpp
LIBS += -lts
OTHER_FILES += tslib.json