Also rename the binary and avoid crashes when tslib initialization
fails.
Change-Id: Ia7ccf7c997e1b1484bd475626ca16c9a9642466e
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
class QTsLibPlugin : public QGenericPlugin
{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QGenericPluginFactoryInterface" FILE "tslib.json")
+
public:
QTsLibPlugin();
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"
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);
--- /dev/null
+{
+ "Keys": [ "Tslib", "TslibRaw" ]
+}
-TARGET = qlinuxinputplugin
+TARGET = qtslibplugin
load(qt_plugin)
DESTDIR = $$QT.gui.plugins/generic
qtslib.cpp
LIBS += -lts
+
+OTHER_FILES += tslib.json