Use non-blocking reads on virtual keyboard pps device.
authorSean Harmer <sean.harmer.qnx@kdab.com>
Thu, 26 Apr 2012 08:49:27 +0000 (09:49 +0100)
committerQt by Nokia <qt-info@nokia.com>
Thu, 26 Apr 2012 09:45:01 +0000 (11:45 +0200)
Change-Id: Iad350c948049128f3014a6ad6536ac9dc2ee86d5
Reviewed-by: Kevin Krammer <kevin.krammer@kdab.com>
Reviewed-by: Giuseppe D'Angelo <dangelog@gmail.com>
src/plugins/platforms/qnx/qqnxvirtualkeyboard.cpp

index 9c336ba..685e5f0 100644 (file)
@@ -58,7 +58,7 @@
 
 QT_BEGIN_NAMESPACE
 
-const char  *QQnxVirtualKeyboard::ms_PPSPath = "/pps/services/input/control?wait";
+const char  *QQnxVirtualKeyboard::ms_PPSPath = "/pps/services/input/control";
 const size_t QQnxVirtualKeyboard::ms_bufferSize = 2048;
 
 // Huge hack for keyboard shadow (see QNX PR 88400). Should be removed ASAP.
@@ -181,6 +181,11 @@ void QQnxVirtualKeyboard::ppsDataReady()
         return;
     }
 
+    // We sometimes get spurious read notifications when no data is available.
+    // Bail out early in this case
+    if (nread == 0)
+        return;
+
     // nread is the real space necessary, not the amount read.
     if (static_cast<size_t>(nread) > ms_bufferSize - 1) {
         qCritical("QQnxVirtualKeyboard: Keyboard buffer size too short; need %u.", nread + 1);