Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2b2c2e3a authored by Nick Pelly's avatar Nick Pelly Committed by Android Git Automerger
Browse files

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.
parents 80370aa8 7c360aaf
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -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;
@@ -501,11 +502,16 @@ int EventHub::open_device(const char *deviceName)

    AutoMutex _l(mLock);

    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));