diff options
author | Nick Pelly <npelly@google.com> | 2010-01-25 18:12:47 -0800 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2010-01-25 18:12:47 -0800 |
commit | 2b2c2e3a35287fdd9a292ab981d5708e2bbfe07c (patch) | |
tree | 69d36b0ffbfcc97ea7702c0a47e985d347caefc2 /libs/ui | |
parent | 80370aa83bce8287a761d090d37349112ee3e79f (diff) | |
parent | 7c360aaf6cd95ec8cce8f97c4a314114951c1cbb (diff) | |
download | frameworks_native-2b2c2e3a35287fdd9a292ab981d5708e2bbfe07c.zip frameworks_native-2b2c2e3a35287fdd9a292ab981d5708e2bbfe07c.tar.gz frameworks_native-2b2c2e3a35287fdd9a292ab981d5708e2bbfe07c.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.cpp | 10 |
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)); |