Remove input plugins hard libudev dependency

libudev extends the base functionality of these plugins but should not
be mandatory as it is missing on many embedded devices that still
actually require input devices (keyboard and/or mouse and/or
touchscreen) support

Change-Id: Ieeb949f1af5e774578f689a63f47a8c48f546ac1
Reviewed-by: Girish Ramakrishnan <girish.1.ramakrishnan@nokia.com>
This commit is contained in:
Bhooshan Supe 2012-04-10 10:57:38 -07:00 committed by Qt by Nokia
parent e784245238
commit 3a4ed33140
10 changed files with 34 additions and 7 deletions

View File

@ -19,4 +19,6 @@ SOURCES = main.cpp \
OTHER_FILES += \
evdevkeyboard.json
LIBS += $$QMAKE_LIBS_LIBUDEV
contains(QT_CONFIG, libudev) {
LIBS += $$QMAKE_LIBS_LIBUDEV
}

View File

@ -56,7 +56,11 @@ QEvdevKeyboardManager::QEvdevKeyboardManager(const QString &key, const QString &
{
Q_UNUSED(key);
#ifndef QT_NO_LIBUDEV
bool useUDev = true;
#else
bool useUDev = false;
#endif // QT_NO_LIBUDEV
QStringList args = specification.split(QLatin1Char(':'));
QStringList devices;
@ -77,6 +81,7 @@ QEvdevKeyboardManager::QEvdevKeyboardManager(const QString &key, const QString &
foreach (const QString &device, devices)
addKeyboard(device);
#ifndef QT_NO_LIBUDEV
if (useUDev) {
#ifdef QT_QPA_KEYMAP_DEBUG
qWarning() << "Use UDev for device discovery";
@ -94,6 +99,7 @@ QEvdevKeyboardManager::QEvdevKeyboardManager(const QString &key, const QString &
connect(m_udeviceHelper, SIGNAL(deviceRemoved(QString,QUDeviceTypes)), this, SLOT(removeKeyboard(QString)));
}
}
#endif // QT_NO_LIBUDEV
}
QEvdevKeyboardManager::~QEvdevKeyboardManager()

View File

@ -44,7 +44,9 @@
#include "qevdevkeyboardhandler.h"
#ifndef QT_NO_LIBUDEV
#include <QtPlatformSupport/private/qudevicehelper_p.h>
#endif // QT_NO_LIBUDEV
#include <QObject>
#include <QHash>
@ -68,7 +70,9 @@ private slots:
private:
QString m_spec;
QHash<QString,QEvdevKeyboardHandler*> m_keyboards;
#ifndef QT_NO_LIBUDEV
QUDeviceHelper *m_udeviceHelper;
#endif // QT_NO_LIBUDEV
};
QT_END_HEADER

View File

@ -17,4 +17,6 @@ SOURCES = main.cpp \
OTHER_FILES += \
evdevmouse.json
LIBS += $$QMAKE_LIBS_LIBUDEV
contains(QT_CONFIG, libudev) {
LIBS += $$QMAKE_LIBS_LIBUDEV
}

View File

@ -48,7 +48,6 @@
#include <qplatformdefs.h>
#include <private/qcore_unix_p.h> // overrides QT_OPEN
#include <QtPlatformSupport/private/qudevicehelper_p.h>
#include <errno.h>

View File

@ -56,7 +56,11 @@ QEvdevMouseManager::QEvdevMouseManager(const QString &key, const QString &specif
{
Q_UNUSED(key);
#ifndef QT_NO_LIBUDEV
bool useUDev = true;
#else
bool useUDev = false;
#endif // QT_NO_LIBUDEV
QStringList args = specification.split(QLatin1Char(':'));
QStringList devices;
@ -77,6 +81,7 @@ QEvdevMouseManager::QEvdevMouseManager(const QString &key, const QString &specif
foreach (const QString &device, devices)
addMouse(device);
#ifndef QT_NO_LIBUDEV
if (useUDev) {
#ifdef QT_QPA_MOUSEMANAGER_DEBUG
qWarning() << "Use UDev for device discovery";
@ -94,6 +99,7 @@ QEvdevMouseManager::QEvdevMouseManager(const QString &key, const QString &specif
connect(m_udeviceHelper, SIGNAL(deviceRemoved(QString,QUDeviceTypes)), this, SLOT(removeMouse(QString)));
}
}
#endif // QT_NO_LIBUDEV
}
QEvdevMouseManager::~QEvdevMouseManager()

View File

@ -44,7 +44,9 @@
#include "qevdevmousehandler.h"
#ifndef QT_NO_LIBUDEV
#include <QtPlatformSupport/private/qudevicehelper_p.h>
#endif // QT_NO_LIBUDEV
#include <QObject>
#include <QHash>
@ -68,7 +70,9 @@ private slots:
private:
QString m_spec;
QHash<QString,QEvdevMouseHandler*> m_mice;
#ifndef QT_NO_LIBUDEV
QUDeviceHelper *m_udeviceHelper;
#endif // QT_NO_LIBUDEV
};
QT_END_HEADER

View File

@ -16,7 +16,9 @@ QT += core-private platformsupport-private
OTHER_FILES += \
evdevtouch.json
LIBS += $$QMAKE_LIBS_LIBUDEV
contains(QT_CONFIG, libudev) {
LIBS += $$QMAKE_LIBS_LIBUDEV
}
# DEFINES += USE_MTDEV

View File

@ -46,7 +46,9 @@
#include <QGuiApplication>
#include <QDebug>
#include <QtCore/private/qcore_unix_p.h>
#ifndef QT_NO_LIBUDEV
#include <QtPlatformSupport/private/qudevicehelper_p.h>
#endif // QT_NO_LIBUDEV
#include <linux/input.h>
#ifdef USE_MTDEV
@ -147,6 +149,7 @@ QTouchScreenHandler::QTouchScreenHandler(const QString &spec)
QString dev;
#ifndef QT_NO_LIBUDEV
// try to let udev scan for already connected devices
QScopedPointer<QUDeviceHelper> udeviceHelper(QUDeviceHelper::createUDeviceHelper(QUDeviceHelper::UDev_Touchpad | QUDeviceHelper::UDev_Touchscreen, this));
if (udeviceHelper) {
@ -156,6 +159,7 @@ QTouchScreenHandler::QTouchScreenHandler(const QString &spec)
if (devices.size() > 0)
dev = devices[0];
}
#endif // QT_NO_LIBUDEV
if (dev.isEmpty())
dev = QLatin1String("/dev/input/event0");

View File

@ -3,7 +3,5 @@ TEMPLATE = subdirs
linux-g++-maemo: SUBDIRS += meego
contains(QT_CONFIG, evdev) {
contains(QT_CONFIG, libudev) {
SUBDIRS += evdevmouse evdevtouch evdevkeyboard
}
SUBDIRS += evdevmouse evdevtouch evdevkeyboard
}