Prevent evdevkeyboard file opening from failing
authorLaszlo Agocs <laszlo.p.agocs@nokia.com>
Thu, 31 May 2012 05:53:24 +0000 (08:53 +0300)
committerQt by Nokia <qt-info@nokia.com>
Thu, 31 May 2012 15:49:50 +0000 (17:49 +0200)
On many systems the device nodes will not be writable normally. There
is no reason to open for writing in any case. Also switched back to
non-blocking I/O.

Change-Id: I9290e6b1ce7e3bc6cb0e75069b3968f647ffbeee
Reviewed-by: Girish Ramakrishnan <girish.1.ramakrishnan@nokia.com>
src/plugins/generic/evdevkeyboard/qevdevkeyboardhandler.cpp

index 5574457..c963606 100644 (file)
@@ -124,7 +124,7 @@ QEvdevKeyboardHandler *QEvdevKeyboardHandler::create(const QString &device, cons
 #endif
 
     int fd;
-    fd = qt_safe_open(device.toLocal8Bit().constData(), O_RDWR, 0);
+    fd = qt_safe_open(device.toLocal8Bit().constData(), O_RDONLY | O_NDELAY, 0);
     if (fd >= 0) {
         if (repeatDelay > 0 && repeatRate > 0) {
             int kbdrep[2] = { repeatDelay, repeatRate };