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>bb10
parent
44724508c9
commit
7a304015bd
|
|
@ -65,12 +65,11 @@ QEvdevKeyboardManager::QEvdevKeyboardManager(const QString &key, const QString &
|
|||
QStringList devices;
|
||||
|
||||
foreach (const QString &arg, args) {
|
||||
if (arg.startsWith(QLatin1String("udev")) && arg.contains(QLatin1String("no"))) {
|
||||
useUDev = false;
|
||||
} else if (arg.startsWith(QLatin1String("/dev/"))) {
|
||||
if (arg.startsWith(QLatin1String("/dev/"))) {
|
||||
// if device is specified try to use it
|
||||
devices.append(arg);
|
||||
args.removeAll(arg);
|
||||
useUDev = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -65,12 +65,11 @@ QEvdevMouseManager::QEvdevMouseManager(const QString &key, const QString &specif
|
|||
QStringList devices;
|
||||
|
||||
foreach (const QString &arg, args) {
|
||||
if (arg.startsWith("udev") && arg.contains("no")) {
|
||||
useUDev = false;
|
||||
} else if (arg.startsWith("/dev/")) {
|
||||
if (arg.startsWith("/dev/")) {
|
||||
// if device is specified try to use it
|
||||
devices.append(arg);
|
||||
args.removeAll(arg);
|
||||
useUDev = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -150,26 +150,32 @@ 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) {
|
||||
QStringList devices = udeviceHelper->scanConnectedDevices();
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
|
||||
// only the first device found is used for now
|
||||
if (devices.size() > 0)
|
||||
dev = devices[0];
|
||||
#ifndef QT_NO_LIBUDEV
|
||||
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);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue