sm8450-common: udfps: Inform hwmodule about press coordinates

These coordinates can be from the last press, ideally we would
get the coordinates freshly when fod_press_status changes.

Change-Id: I8c0096c96612c8ea8b612696ecf702d7945a1b84
This commit is contained in:
Arian
2024-03-14 14:09:52 +01:00
parent 43650d15a4
commit 1c5b35a3c1

View File

@@ -27,6 +27,8 @@
#define LOW_BRIGHTNESS_THRESHHOLD 100
#define COMMAND_FOD_PRESS_STATUS 1
#define COMMAND_FOD_PRESS_X 2
#define COMMAND_FOD_PRESS_Y 3
#define PARAM_FOD_PRESSED 1
#define PARAM_FOD_RELEASED 0
@@ -115,6 +117,8 @@ class XiaomiSm8450UdfpsHander : public UdfpsHandler {
}
bool pressed = readBool(fd);
mDevice->extCmd(mDevice, COMMAND_FOD_PRESS_X, pressed ? lastPressX : 0);
mDevice->extCmd(mDevice, COMMAND_FOD_PRESS_Y, pressed ? lastPressY : 0);
mDevice->extCmd(mDevice, COMMAND_FOD_PRESS_STATUS,
pressed ? PARAM_FOD_PRESSED : PARAM_FOD_RELEASED);
@@ -197,8 +201,12 @@ class XiaomiSm8450UdfpsHander : public UdfpsHandler {
}).detach();
}
void onFingerDown(uint32_t /*x*/, uint32_t /*y*/, float /*minor*/, float /*major*/) {
LOG(INFO) << __func__;
void onFingerDown(uint32_t x, uint32_t y, float /*minor*/, float /*major*/) {
LOG(INFO) << __func__ << "x: " << x << ", y: " << y;
// Track x and y coordinates
lastPressX = x;
lastPressY = y;
// Ensure touchscreen is aware of the press state, ideally this is not needed
setFingerDown(true);
}
@@ -259,6 +267,7 @@ class XiaomiSm8450UdfpsHander : public UdfpsHandler {
android::base::unique_fd touch_fd_;
android::base::unique_fd disp_fd_;
bool enrolling = false;
uint32_t lastPressX, lastPressY;
void setFodStatus(int value) {
int buf[MAX_BUF_SIZE] = {MI_DISP_PRIMARY, Touch_Fod_Enable, value};