diff options
author | Johannes Zellner <johannes.zellner@nokia.com> | 2012-05-21 15:41:58 -0700 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-05-24 07:15:02 +0200 |
commit | ce5c1db2d3db7d7c7af28e9053ca591f76c6101c (patch) | |
tree | 60ef0eac7ad658e9715f2a940dbf7c5a3b6787a4 /src/plugins/generic/evdevkeyboard | |
parent | 7dd64fd2bbb18a424577543307f2821ace963b8b (diff) |
udev: UDevHelper becomes DeviceDiscovery
Rename QUDeviceHelper to QDeviceDiscovery and add a static device
discovery fallback in case we dont have udev. The fallback so far only
scans /dev/input/event* and /dev/dri/card* at startup and detects device
nodes only by device path.
Change-Id: I7a423910b30ae16a10d8f1f47b86c6b4d2c2ec36
Reviewed-by: Girish Ramakrishnan <girish.1.ramakrishnan@nokia.com>
Reviewed-by: Donald Carr <donald.carr@nokia.com>
Diffstat (limited to 'src/plugins/generic/evdevkeyboard')
-rw-r--r-- | src/plugins/generic/evdevkeyboard/qevdevkeyboardmanager.cpp | 24 | ||||
-rw-r--r-- | src/plugins/generic/evdevkeyboard/qevdevkeyboardmanager.h | 8 |
2 files changed, 9 insertions, 23 deletions
diff --git a/src/plugins/generic/evdevkeyboard/qevdevkeyboardmanager.cpp b/src/plugins/generic/evdevkeyboard/qevdevkeyboardmanager.cpp index 6a891a4cb7..412695579d 100644 --- a/src/plugins/generic/evdevkeyboard/qevdevkeyboardmanager.cpp +++ b/src/plugins/generic/evdevkeyboard/qevdevkeyboardmanager.cpp @@ -56,11 +56,6 @@ 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; @@ -69,7 +64,6 @@ QEvdevKeyboardManager::QEvdevKeyboardManager(const QString &key, const QString & // if device is specified try to use it devices.append(arg); args.removeAll(arg); - useUDev = false; } } @@ -80,27 +74,23 @@ QEvdevKeyboardManager::QEvdevKeyboardManager(const QString &key, const QString & foreach (const QString &device, devices) addKeyboard(device); -#ifndef QT_NO_LIBUDEV - if (useUDev) { + if (devices.isEmpty()) { #ifdef QT_QPA_KEYMAP_DEBUG - qWarning() << "Use UDev for device discovery"; + qWarning() << "Use device discovery"; #endif - m_udeviceHelper = QUDeviceHelper::createUDeviceHelper(QUDeviceHelper::UDev_Keyboard, this); - if (m_udeviceHelper) { + m_deviceDiscovery = QDeviceDiscovery::create(QDeviceDiscovery::Device_Keyboard, this); + if (m_deviceDiscovery) { // scan and add already connected keyboards - QStringList devices = m_udeviceHelper->scanConnectedDevices(); + QStringList devices = m_deviceDiscovery->scanConnectedDevices(); foreach (QString device, devices) { addKeyboard(device); } - connect(m_udeviceHelper, SIGNAL(deviceDetected(QString,QUDeviceTypes)), this, SLOT(addKeyboard(QString))); - connect(m_udeviceHelper, SIGNAL(deviceRemoved(QString,QUDeviceTypes)), this, SLOT(removeKeyboard(QString))); + connect(m_deviceDiscovery, SIGNAL(deviceDetected(QString)), this, SLOT(addKeyboard(QString))); + connect(m_deviceDiscovery, SIGNAL(deviceRemoved(QString)), this, SLOT(removeKeyboard(QString))); } } -#else - Q_UNUSED(useUDev) -#endif // QT_NO_LIBUDEV } QEvdevKeyboardManager::~QEvdevKeyboardManager() diff --git a/src/plugins/generic/evdevkeyboard/qevdevkeyboardmanager.h b/src/plugins/generic/evdevkeyboard/qevdevkeyboardmanager.h index a505ce834e..e76814209e 100644 --- a/src/plugins/generic/evdevkeyboard/qevdevkeyboardmanager.h +++ b/src/plugins/generic/evdevkeyboard/qevdevkeyboardmanager.h @@ -44,9 +44,7 @@ #include "qevdevkeyboardhandler.h" -#ifndef QT_NO_LIBUDEV -#include <QtPlatformSupport/private/qudevicehelper_p.h> -#endif // QT_NO_LIBUDEV +#include <QtPlatformSupport/private/qdevicediscovery_p.h> #include <QObject> #include <QHash> @@ -70,9 +68,7 @@ private slots: private: QString m_spec; QHash<QString,QEvdevKeyboardHandler*> m_keyboards; -#ifndef QT_NO_LIBUDEV - QUDeviceHelper *m_udeviceHelper; -#endif // QT_NO_LIBUDEV + QDeviceDiscovery *m_deviceDiscovery; }; QT_END_HEADER |