summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Pelly <npelly@google.com>2010-01-20 20:43:54 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-01-20 20:43:54 -0800
commite834722f547d13eaa453464502456892c6225e42 (patch)
tree8dd08918d5866207f2c6c2b5c2380bd0ecd81c24
parent8681df902e8cc61d290808c5d78ea48920d30f3b (diff)
parente6b1bbd8acca3f6e174c24cf4eb23a66db2d08a2 (diff)
downloadframeworks_base-e834722f547d13eaa453464502456892c6225e42.zip
frameworks_base-e834722f547d13eaa453464502456892c6225e42.tar.gz
frameworks_base-e834722f547d13eaa453464502456892c6225e42.tar.bz2
Merge "Fix failure to open AVRCP input device due to EPERM." into eclair
-rw-r--r--libs/ui/EventHub.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/libs/ui/EventHub.cpp b/libs/ui/EventHub.cpp
index e39a357..4aac455 100644
--- a/libs/ui/EventHub.cpp
+++ b/libs/ui/EventHub.cpp
@@ -489,6 +489,7 @@ int EventHub::open_device(const char *deviceName)
{
int version;
int fd;
+ int attempt;
struct pollfd *new_mFDs;
device_t **new_devices;
char **new_device_names;
@@ -500,12 +501,17 @@ int EventHub::open_device(const char *deviceName)
LOGV("Opening device: %s", deviceName);
AutoMutex _l(mLock);
-
- fd = open(deviceName, O_RDWR);
+
+ for (attempt = 0; attempt < 10; attempt++) {
+ fd = open(deviceName, O_RDWR);
+ if (fd >= 0) break;
+ usleep(100);
+ }
if(fd < 0) {
LOGE("could not open %s, %s\n", deviceName, strerror(errno));
return -1;
}
+ LOGV("Opened device: %s (%d failures)", deviceName, attempt);
if(ioctl(fd, EVIOCGVERSION, &version)) {
LOGE("could not get driver version for %s, %s\n", deviceName, strerror(errno));