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

Commit 4180aa42 authored by Atif Niyaz's avatar Atif Niyaz
Browse files

Remove mUserEpollWakeup from EventHub

All devices supporting Oreo must have a linux kernel version 3.18 or
above, meaning it isn't necessary to check if the kernel version is above
3.5.

Bug: 118001226
Test: After compiling and creating a build and installing on device,
there were no crashes.

Change-Id: I74f04524199b9220d836c91f8e71e85fe75ba173
parent 30b07720
Loading
Loading
Loading
Loading
+1 −30
Original line number Diff line number Diff line
@@ -28,7 +28,6 @@
#include <sys/limits.h>
#include <sys/inotify.h>
#include <sys/ioctl.h>
#include <sys/utsname.h>
#include <unistd.h>

#define LOG_TAG "EventHub"
@@ -94,14 +93,6 @@ static std::string sha1(const std::string& in) {
    return out;
}

static void getLinuxRelease(int* major, int* minor) {
    struct utsname info;
    if (uname(&info) || sscanf(info.release, "%d.%d", major, minor) <= 0) {
        *major = 0, *minor = 0;
        ALOGE("Could not get linux version: %s", strerror(errno));
    }
}

/**
 * Return true if name matches "v4l-touch*"
 */
@@ -292,11 +283,6 @@ EventHub::EventHub(void) :
    result = epoll_ctl(mEpollFd, EPOLL_CTL_ADD, mWakeReadPipeFd, &eventItem);
    LOG_ALWAYS_FATAL_IF(result != 0, "Could not add wake read pipe to epoll instance.  errno=%d",
            errno);

    int major, minor;
    getLinuxRelease(&major, &minor);
    // EPOLLWAKEUP was introduced in kernel 3.5
    mUsingEpollWakeup = major > 3 || (major == 3 && minor >= 5);
}

EventHub::~EventHub(void) {
@@ -1487,28 +1473,13 @@ void EventHub::configureFd(Device* device) {
        }
    }

    std::string wakeMechanism = "EPOLLWAKEUP";
    if (!mUsingEpollWakeup) {
#ifndef EVIOCSSUSPENDBLOCK
        // uapi headers don't include EVIOCSSUSPENDBLOCK, and future kernels
        // will use an epoll flag instead, so as long as we want to support
        // this feature, we need to be prepared to define the ioctl ourselves.
#define EVIOCSSUSPENDBLOCK _IOW('E', 0x91, int)
#endif
        if (ioctl(device->fd, EVIOCSSUSPENDBLOCK, 1)) {
            wakeMechanism = "<none>";
        } else {
            wakeMechanism = "EVIOCSSUSPENDBLOCK";
        }
    }
    // Tell the kernel that we want to use the monotonic clock for reporting timestamps
    // associated with input events.  This is important because the input system
    // uses the timestamps extensively and assumes they were recorded using the monotonic
    // clock.
    int clockId = CLOCK_MONOTONIC;
    bool usingClockIoctl = !ioctl(device->fd, EVIOCSCLOCKID, &clockId);
    ALOGI("wakeMechanism=%s, usingClockIoctl=%s", wakeMechanism.c_str(),
          toString(usingClockIoctl));
    ALOGI("usingClockIoctl=%s", toString(usingClockIoctl));
}

void EventHub::openVideoDeviceLocked(const std::string& devicePath) {
+0 −2
Original line number Diff line number Diff line
@@ -479,8 +479,6 @@ private:
    size_t mPendingEventCount;
    size_t mPendingEventIndex;
    bool mPendingINotify;

    bool mUsingEpollWakeup;
};

}; // namespace android