summaryrefslogtreecommitdiffstats
path: root/src/platformsupport/input/evdevtouch
diff options
context:
space:
mode:
Diffstat (limited to 'src/platformsupport/input/evdevtouch')
-rw-r--r--src/platformsupport/input/evdevtouch/qevdevtouch.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/platformsupport/input/evdevtouch/qevdevtouch.cpp b/src/platformsupport/input/evdevtouch/qevdevtouch.cpp
index 6bf9ba769e..76314b3443 100644
--- a/src/platformsupport/input/evdevtouch/qevdevtouch.cpp
+++ b/src/platformsupport/input/evdevtouch/qevdevtouch.cpp
@@ -179,7 +179,7 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &spec, QObject
m_notify = new QSocketNotifier(m_fd, QSocketNotifier::Read, this);
connect(m_notify, SIGNAL(activated(int)), this, SLOT(readData()));
} else {
- qWarning("Cannot open input device '%s': %s", qPrintable(dev), strerror(errno));
+ qErrnoWarning(errno, "Cannot open input device %s", qPrintable(dev));
return;
}
@@ -220,6 +220,12 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &spec, QObject
qDebug("device name: %s", name);
}
+ bool grabSuccess = !ioctl(m_fd, EVIOCGRAB, (void *) 1);
+ if (grabSuccess)
+ ioctl(m_fd, EVIOCGRAB, (void *) 0);
+ else
+ qWarning("ERROR: The device is grabbed by another process. No events will be read.");
+
#ifdef USE_MTDEV
const char *mtdevStr = "(mtdev)";
d->m_typeB = true;