summaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2010-09-16 17:54:50 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-09-16 17:54:50 -0700
commit9e110d532ffe32d570fb5926761c0ae10b0dd2b6 (patch)
tree534f7c361ebec02d1dc508f9fc3392b07cb2b44f /libs
parentf78bc52c858300ca08c0bf5d5dc2cc1931a40a60 (diff)
parentaeda9afdba5c28d4d152e3ec3bce74be42949065 (diff)
downloadframeworks_native-9e110d532ffe32d570fb5926761c0ae10b0dd2b6.zip
frameworks_native-9e110d532ffe32d570fb5926761c0ae10b0dd2b6.tar.gz
frameworks_native-9e110d532ffe32d570fb5926761c0ae10b0dd2b6.tar.bz2
Merge "part of fix for [3004226] Cannot end the call - Proximity sensor doesn't work" into gingerbread
Diffstat (limited to 'libs')
-rw-r--r--libs/gui/SensorEventQueue.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/libs/gui/SensorEventQueue.cpp b/libs/gui/SensorEventQueue.cpp
index c3a9f22..b0d0f12 100644
--- a/libs/gui/SensorEventQueue.cpp
+++ b/libs/gui/SensorEventQueue.cpp
@@ -70,9 +70,13 @@ ssize_t SensorEventQueue::write(ASensorEvent const* events, size_t numEvents)
ssize_t SensorEventQueue::read(ASensorEvent* events, size_t numEvents)
{
ssize_t size = mSensorChannel->read(events, numEvents*sizeof(events[0]));
+ LOGE_IF(size<0 && size!=-EAGAIN,
+ "SensorChannel::read error (%s)", strerror(-size));
if (size >= 0) {
if (size % sizeof(events[0])) {
// partial read!!! should never happen.
+ LOGE("SensorEventQueue partial read (event-size=%u, read=%d)",
+ sizeof(events[0]), int(size));
return -EINVAL;
}
// returns number of events read
@@ -95,8 +99,18 @@ status_t SensorEventQueue::waitForEvent() const
{
const int fd = getFd();
sp<Looper> looper(getLooper());
- int32_t result = looper->pollOnce(-1);
- return (result == fd) ? status_t(NO_ERROR) : status_t(-1);
+
+ int32_t result;
+ do {
+ result = looper->pollOnce(-1);
+ if (result == ALOOPER_EVENT_ERROR) {
+ LOGE("SensorChannel::waitForEvent error (errno=%d)", errno);
+ result = -EPIPE; // unknown error, so we make up one
+ break;
+ }
+ } while (result != fd);
+
+ return result;
}
status_t SensorEventQueue::wake() const