diff options
author | Johannes Zellner <johannes.zellner@nokia.com> | 2012-05-14 17:04:44 -0700 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-05-15 20:44:36 +0200 |
commit | 7a304015bd57372eae1e615f0048c5b84b7c9842 (patch) | |
tree | bbe00169dcfac564bc5bea42c6dbc807bc74baf2 /src/plugins/generic/evdevtouch | |
parent | 44724508c97445e308eb86b6e193ed50da13caee (diff) |
input: Use UDev or specific device paths
Keyboard,mouse and touch plugins using evdev now either
use udev for device discovery or the plugin arguments
for fixed device paths.
Change-Id: I72606ad48c15c55a49724a82f7bc285dd3984c43
Reviewed-by: Girish Ramakrishnan <girish.1.ramakrishnan@nokia.com>
Diffstat (limited to 'src/plugins/generic/evdevtouch')
-rw-r--r-- | src/plugins/generic/evdevtouch/qevdevtouch.cpp | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/src/plugins/generic/evdevtouch/qevdevtouch.cpp b/src/plugins/generic/evdevtouch/qevdevtouch.cpp index 8d50991637..37db20a419 100644 --- a/src/plugins/generic/evdevtouch/qevdevtouch.cpp +++ b/src/plugins/generic/evdevtouch/qevdevtouch.cpp @@ -150,26 +150,32 @@ QTouchScreenHandler::QTouchScreenHandler(const QString &spec) QString dev; + // only the first device argument is used for now + QStringList args = spec.split(QLatin1Char(':')); + for (int i = 0; i < args.count(); ++i) { + if (args.at(i).startsWith(QLatin1String("/dev/"))) { + dev = args.at(i); + break; + } + } + #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) { - QStringList devices = udeviceHelper->scanConnectedDevices(); - - // only the first device found is used for now - if (devices.size() > 0) - dev = devices[0]; + if (dev.isEmpty()) { + // try to let udev scan for already connected devices + QScopedPointer<QUDeviceHelper> udeviceHelper(QUDeviceHelper::createUDeviceHelper(QUDeviceHelper::UDev_Touchpad | QUDeviceHelper::UDev_Touchscreen, this)); + if (udeviceHelper) { + QStringList devices = udeviceHelper->scanConnectedDevices(); + + // only the first device found is used for now + if (devices.size() > 0) + dev = devices[0]; + } } #endif // QT_NO_LIBUDEV if (dev.isEmpty()) dev = QLatin1String("/dev/input/event0"); - QStringList args = spec.split(QLatin1Char(':')); - for (int i = 0; i < args.count(); ++i) - if (args.at(i).startsWith(QLatin1String("/dev/"))) - dev = args.at(i); - qDebug("evdevtouch: Using device %s", qPrintable(dev)); m_fd = QT_OPEN(dev.toLocal8Bit().constData(), O_RDONLY | O_NDELAY, 0); |