diff options
author | Jeff Brown <jeffbrown@google.com> | 2010-10-14 12:03:36 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2010-10-14 12:03:36 -0700 |
commit | 567db07702f851f2e7fb1fb0021ce2871469183e (patch) | |
tree | a89e2a2e1b23a114bfa1055335de2492def68d09 /libs | |
parent | d23cc4b814c01675f6503c4dcab21655c56d0256 (diff) | |
parent | 2d441e148502bb492816ef84837510397f77a039 (diff) | |
download | frameworks_base-567db07702f851f2e7fb1fb0021ce2871469183e.zip frameworks_base-567db07702f851f2e7fb1fb0021ce2871469183e.tar.gz frameworks_base-567db07702f851f2e7fb1fb0021ce2871469183e.tar.bz2 |
am 2d441e14: Merge "Make sure EventHub reports added/removed devices immediately." into gingerbread
Merge commit '2d441e148502bb492816ef84837510397f77a039' into gingerbread-plus-aosp
* commit '2d441e148502bb492816ef84837510397f77a039':
Make sure EventHub reports added/removed devices immediately.
Diffstat (limited to 'libs')
-rw-r--r-- | libs/ui/EventHub.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/libs/ui/EventHub.cpp b/libs/ui/EventHub.cpp index c0be3a0..944731d 100644 --- a/libs/ui/EventHub.cpp +++ b/libs/ui/EventHub.cpp @@ -439,11 +439,10 @@ bool EventHub::getEvent(RawEvent* outEvent) // Since mFDs[0] is used for inotify, we process regular events starting at index 1. mInputDeviceIndex += 1; if (mInputDeviceIndex >= mFDCount) { - mInputDeviceIndex = 0; break; } - const struct pollfd &pfd = mFDs[mInputDeviceIndex]; + const struct pollfd& pfd = mFDs[mInputDeviceIndex]; if (pfd.revents & POLLIN) { int32_t readSize = read(pfd.fd, mInputBufferData, sizeof(struct input_event) * INPUT_BUFFER_SIZE); @@ -460,11 +459,17 @@ bool EventHub::getEvent(RawEvent* outEvent) } } +#if HAVE_INOTIFY // readNotify() will modify mFDs and mFDCount, so this must be done after // processing all other events. if(mFDs[0].revents & POLLIN) { readNotify(mFDs[0].fd); + mFDs[0].revents = 0; + continue; // report added or removed devices immediately } +#endif + + mInputDeviceIndex = 0; // Poll for events. Mind the wake lock dance! // We hold a wake lock at all times except during poll(). This works due to some @@ -482,7 +487,7 @@ bool EventHub::getEvent(RawEvent* outEvent) if (pollResult <= 0) { if (errno != EINTR) { - LOGW("select failed (errno=%d)\n", errno); + LOGW("poll failed (errno=%d)\n", errno); usleep(100000); } } |