Code drop from //branches/cupcake/...@124589
diff --git a/libs/ui/EventHub.cpp b/libs/ui/EventHub.cpp
index f0c77ba..abe7407 100644
--- a/libs/ui/EventHub.cpp
+++ b/libs/ui/EventHub.cpp
@@ -315,9 +315,8 @@
         }
 
         //printf("poll %d, returned %d\n", mFDCount, pollres);
-        if(mFDs[0].revents & POLLIN) {
-            read_notify(mFDs[0].fd);
-        }
+
+        // mFDs[0] is used for inotify, so process regular events starting at mFDs[1]
         for(i = 1; i < mFDCount; i++) {
             if(mFDs[i].revents) {
                 LOGV("revents for %d = 0x%08x", i, mFDs[i].revents);
@@ -357,6 +356,12 @@
                 }
             }
         }
+        
+        // read_notify() will modify mFDs and mFDCount, so this must be done after
+        // processing all other events.
+        if(mFDs[0].revents & POLLIN) {
+            read_notify(mFDs[0].fd);
+        }
     }
 }
 
@@ -607,7 +612,7 @@
         sprintf(propName, "hw.keyboards.%u.devname", publicID);
         property_set(propName, devname);
 
-        LOGI("New keyboard: publicID=%d device->id=%d devname='%s propName='%s' keylayout='%s'\n",
+        LOGI("New keyboard: publicID=%d device->id=%d devname='%s' propName='%s' keylayout='%s'\n",
                 publicID, device->id, devname, propName, keylayoutFilename);
     }