summaryrefslogtreecommitdiffstats
path: root/libs/ui
diff options
context:
space:
mode:
authorNick Pelly <npelly@google.com>2010-01-25 18:12:47 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2010-01-25 18:12:47 -0800
commita667fda9f54f4fd44e3eb53e159b3129e0aa36fa (patch)
tree35ec05626d342546d6826e1560304981d5efc43f /libs/ui
parent5dffc6bb2ac918e7d101fd2f14cf0d4fdbd32e05 (diff)
parent425324e97bba75cd69bb6c81de6248529540e6fe (diff)
downloadframeworks_base-a667fda9f54f4fd44e3eb53e159b3129e0aa36fa.zip
frameworks_base-a667fda9f54f4fd44e3eb53e159b3129e0aa36fa.tar.gz
frameworks_base-a667fda9f54f4fd44e3eb53e159b3129e0aa36fa.tar.bz2
am 425324e9: am e834722f: Merge "Fix failure to open AVRCP input device due to EPERM." into eclair
Merge commit '425324e97bba75cd69bb6c81de6248529540e6fe' * commit '425324e97bba75cd69bb6c81de6248529540e6fe': Fix failure to open AVRCP input device due to EPERM.
Diffstat (limited to 'libs/ui')
-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));