diff --git a/udfps/UdfpsHandler.cpp b/udfps/UdfpsHandler.cpp index 16e5d9c..0a6b850 100644 --- a/udfps/UdfpsHandler.cpp +++ b/udfps/UdfpsHandler.cpp @@ -33,10 +33,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) @@ -203,60 +199,26 @@ class XiaomiSm8450UdfpsHander : public UdfpsHandler { lastPressX = x; lastPressY = y; - /* - * On fpc_fod devices, the waiting for finger message is not reliably sent... - * The finger down message is only reliably sent when the screen is turned off, so enable - * fod_status better late than never. - */ - if (isFpcFod) { - setFodStatus(FOD_STATUS_ON); - } - - // 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 for goodix_fod devices: - * 21: waiting for finger - * 22: finger down - * 23: finger up - * On fpc_fod devices, the waiting for finger message is not reliably sent... - * The finger down message is only reliably sent when the screen is turned off, so enable - * fod_status better late than never. - */ - if (!isFpcFod && vendorCode == 21) { - setFodStatus(FOD_STATUS_ON); - } else if (isFpcFod && vendorCode == 22) { - setFodStatus(FOD_STATUS_ON); + setFingerDown(false); } } void cancel() { LOG(DEBUG) << __func__; enrolling = false; - - setFodStatus(FOD_STATUS_OFF_UNTIL_SUSPEND); } void preEnroll() { @@ -272,8 +234,6 @@ class XiaomiSm8450UdfpsHander : public UdfpsHandler { void postEnroll() { LOG(DEBUG) << __func__; enrolling = false; - - setFodStatus(FOD_STATUS_OFF_UNTIL_SUSPEND); } private: @@ -284,11 +244,6 @@ class XiaomiSm8450UdfpsHander : 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);