Skip to content

Commit

Permalink
sm8550-common: Kill UDFPS fod_status usage
Browse files Browse the repository at this point in the history
Change-Id: I02cee1b4cb5207fed2da31302d9ecbb6b720b1d8
  • Loading branch information
ArianK16a authored and 33bca committed Jun 10, 2024
1 parent fa4a145 commit a26c386
Showing 1 changed file with 3 additions and 33 deletions.
36 changes: 3 additions & 33 deletions udfps/UdfpsHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@
#define PARAM_FOD_PRESSED 1
#define PARAM_FOD_RELEASED 0

#define FOD_STATUS_OFF 0
#define FOD_STATUS_ON 1
#define FOD_STATUS_OFF_UNTIL_SUSPEND 3

#define TOUCH_DEV_PATH "/dev/xiaomi-touch"
#define TOUCH_MAGIC 'T'
#define TOUCH_IOC_SET_CUR_VALUE _IO(TOUCH_MAGIC, SET_CUR_VALUE)
Expand Down Expand Up @@ -198,45 +194,26 @@ class XiaomiSm8550UdfpsHander : public UdfpsHandler {
lastPressX = x;
lastPressY = y;

// Ensure touchscreen is aware of the press state, ideally this is not needed
// Notify touchscreen about press status
setFingerDown(true);
}

void onFingerUp() {
LOG(DEBUG) << __func__;
// Ensure touchscreen is aware of the press state, ideally this is not needed
// Notify touchscreen about press status
setFingerDown(false);
}

void onAcquired(int32_t result, int32_t vendorCode) {
LOG(DEBUG) << __func__ << " result: " << result << " vendorCode: " << vendorCode;
if (result == FINGERPRINT_ACQUIRED_GOOD) {
// Request to disable HBM already, even if the finger is still pressed
disp_local_hbm_req req;
req.base.flag = 0;
req.base.disp_id = MI_DISP_PRIMARY;
req.local_hbm_value = LHBM_TARGET_BRIGHTNESS_OFF_FINGER_UP;
ioctl(disp_fd_.get(), MI_DISP_IOCTL_SET_LOCAL_HBM, &req);
if (!enrolling) {
setFodStatus(FOD_STATUS_OFF_UNTIL_SUSPEND);
}
}

/* vendorCode
* 21: waiting for finger
* 22: finger down
* 23: finger up
*/
if (vendorCode == 21) {
setFodStatus(FOD_STATUS_ON);
setFingerDown(false);
}
}

void cancel() {
LOG(DEBUG) << __func__;
enrolling = false;

setFodStatus(FOD_STATUS_OFF_UNTIL_SUSPEND);
}

void preEnroll() {
Expand All @@ -252,8 +229,6 @@ class XiaomiSm8550UdfpsHander : public UdfpsHandler {
void postEnroll() {
LOG(DEBUG) << __func__;
enrolling = false;

setFodStatus(FOD_STATUS_OFF_UNTIL_SUSPEND);
}

private:
Expand All @@ -263,11 +238,6 @@ class XiaomiSm8550UdfpsHander : public UdfpsHandler {
bool enrolling = false;
uint32_t lastPressX, lastPressY;

void setFodStatus(int value) {
int buf[MAX_BUF_SIZE] = {MI_DISP_PRIMARY, Touch_Fod_Enable, value};
ioctl(touch_fd_.get(), TOUCH_IOC_SET_CUR_VALUE, &buf);
}

void setFingerDown(bool pressed) {
int buf[MAX_BUF_SIZE] = {MI_DISP_PRIMARY, THP_FOD_DOWNUP_CTL, pressed ? 1 : 0};
ioctl(touch_fd_.get(), TOUCH_IOC_SET_CUR_VALUE, &buf);
Expand Down

0 comments on commit a26c386

Please sign in to comment.