eqs: disable aod

dt2w doesnt work reliably on it, disable it till we have
kernel sources available
This commit is contained in:
SGCMarkus
2022-10-29 18:58:02 +02:00
parent 19f1c1d6f0
commit 373ed4b1b7
3 changed files with 6 additions and 44 deletions

View File

@@ -20,6 +20,7 @@
#include <log/log.h>
#include <utils/SystemClock.h>
#include <chrono>
#include <cmath>
#include <linux/input.h>
@@ -266,12 +267,8 @@ InputEventDT2WSensor::InputEventDT2WSensor(
if (mPollFds[0] < 0) {
ALOGE("failed to open poll fd: %d", mPollFds[0]);
}
mPollFds[1] = open(INPUT_TOUCHSCREEN_PATH, O_RDONLY | O_NONBLOCK);
if (mPollFds[1] < 0) {
ALOGE("failed to open poll fd: %d", mPollFds[1]);
}
if (mWaitPipeFd[0] < 0 || mWaitPipeFd[1] < 0 || mPollFds[0] < 0 || mPollFds[1] < 0) {
if (mWaitPipeFd[0] < 0 || mWaitPipeFd[1] < 0 || mPollFds[0] < 0) {
mStopThread = true;
return;
}
@@ -285,11 +282,6 @@ InputEventDT2WSensor::InputEventDT2WSensor(
.fd = mPollFds[0],
.events = POLLIN,
};
mPolls[2] = {
.fd = mPollFds[1],
.events = POLLIN,
};
}
InputEventDT2WSensor::~InputEventDT2WSensor() {
@@ -301,7 +293,6 @@ void InputEventDT2WSensor::activate(bool enable) {
if (mIsEnabled != enable) {
mIsEnabled = enable;
interruptPoll();
mWaitCV.notify_all();
}
@@ -315,14 +306,6 @@ void InputEventDT2WSensor::setOperationMode(OperationMode mode) {
void InputEventDT2WSensor::run() {
std::unique_lock<std::mutex> runLock(mRunMutex);
long old_time = 0;
long new_time = 0;
int old_x = 0;
int new_x = 0;
int old_y = 0;
int new_y = 0;
while (!mStopThread) {
if (!mIsEnabled || mMode == OperationMode::DATA_INJECTION) {
mWaitCV.wait(runLock, [&] {
@@ -331,7 +314,7 @@ void InputEventDT2WSensor::run() {
} else {
// Cannot hold lock while polling.
runLock.unlock();
int rc = poll(mPolls, 3, -1);
int rc = poll(mPolls, 2, -1);
runLock.lock();
struct input_event event;
@@ -347,24 +330,6 @@ void InputEventDT2WSensor::run() {
mIsEnabled = false;
mCallback->postEvents(readEvents(), isWakeUpSensor());
}
} else if((mPolls[2].revents == mPolls[2].events) && readEvent(mPolls[2].fd, &event)) {
if(event.type == EV_KEY && event.value == 1) { // Touchscreen down/up
old_time = new_time;
new_time = event.time.tv_sec * 1000000 + event.time.tv_usec;
if((new_time - old_time < 200000) && // 200ms
(abs(sqrt(pow(old_x, 2) + pow(old_y, 2)) - sqrt(pow(new_x, 2) + pow(new_y, 2))) < 500)) {
mIsEnabled = false;
mCallback->postEvents(readEvents(), isWakeUpSensor());
}
} else if(event.type == EV_ABS) { // send order: touch pos x -> touch y -> down/up
if(event.code == ABS_MT_POSITION_X) {
old_x = new_x;
new_x = event.value;
} else if (event.code == ABS_MT_POSITION_Y) {
old_y = new_y;
new_y = event.value;
}
}
} else if (mPolls[0].revents == mPolls[0].events) {
readBool(mWaitPipeFd[0], false /* seek */);
}

View File

@@ -98,11 +98,8 @@ class InputEventDT2WSensor : public OneShotSensor {
virtual ~InputEventDT2WSensor() override;
virtual void activate(bool enable) override;
virtual void activate(bool enable, bool notify, bool lock);
virtual void writeEnable(bool enable);
virtual void setOperationMode(OperationMode mode) override;
virtual std::vector<Event> readEvents() override;
virtual void fillEventData(Event& event);
protected:
virtual void run() override;
@@ -112,9 +109,9 @@ class InputEventDT2WSensor : public OneShotSensor {
private:
void interruptPoll();
struct pollfd mPolls[3];
struct pollfd mPolls[2];
int mWaitPipeFd[2];
int mPollFds[2];
int mPollFds[1];
};
} // namespace implementation