sm8450-common: udfps: Kill fod_status
Change-Id: I02cee1b4cb5207fed2da31302d9ecbb6b720b1d8
This commit is contained in:
parent
ec8a98e97f
commit
0ffea87896
1 changed files with 3 additions and 48 deletions
|
@ -33,10 +33,6 @@
|
||||||
#define PARAM_FOD_PRESSED 1
|
#define PARAM_FOD_PRESSED 1
|
||||||
#define PARAM_FOD_RELEASED 0
|
#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_DEV_PATH "/dev/xiaomi-touch"
|
||||||
#define TOUCH_MAGIC 'T'
|
#define TOUCH_MAGIC 'T'
|
||||||
#define TOUCH_IOC_SET_CUR_VALUE _IO(TOUCH_MAGIC, SET_CUR_VALUE)
|
#define TOUCH_IOC_SET_CUR_VALUE _IO(TOUCH_MAGIC, SET_CUR_VALUE)
|
||||||
|
@ -203,60 +199,26 @@ class XiaomiSm8450UdfpsHander : public UdfpsHandler {
|
||||||
lastPressX = x;
|
lastPressX = x;
|
||||||
lastPressY = y;
|
lastPressY = y;
|
||||||
|
|
||||||
/*
|
// Notify touchscreen about press status
|
||||||
* 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
|
|
||||||
setFingerDown(true);
|
setFingerDown(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void onFingerUp() {
|
void onFingerUp() {
|
||||||
LOG(DEBUG) << __func__;
|
LOG(DEBUG) << __func__;
|
||||||
// Ensure touchscreen is aware of the press state, ideally this is not needed
|
// Notify touchscreen about press status
|
||||||
setFingerDown(false);
|
setFingerDown(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void onAcquired(int32_t result, int32_t vendorCode) {
|
void onAcquired(int32_t result, int32_t vendorCode) {
|
||||||
LOG(DEBUG) << __func__ << " result: " << result << " vendorCode: " << vendorCode;
|
LOG(DEBUG) << __func__ << " result: " << result << " vendorCode: " << vendorCode;
|
||||||
if (result == FINGERPRINT_ACQUIRED_GOOD) {
|
if (result == FINGERPRINT_ACQUIRED_GOOD) {
|
||||||
// Request to disable HBM already, even if the finger is still pressed
|
setFingerDown(false);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void cancel() {
|
void cancel() {
|
||||||
LOG(DEBUG) << __func__;
|
LOG(DEBUG) << __func__;
|
||||||
enrolling = false;
|
enrolling = false;
|
||||||
|
|
||||||
setFodStatus(FOD_STATUS_OFF_UNTIL_SUSPEND);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void preEnroll() {
|
void preEnroll() {
|
||||||
|
@ -272,8 +234,6 @@ class XiaomiSm8450UdfpsHander : public UdfpsHandler {
|
||||||
void postEnroll() {
|
void postEnroll() {
|
||||||
LOG(DEBUG) << __func__;
|
LOG(DEBUG) << __func__;
|
||||||
enrolling = false;
|
enrolling = false;
|
||||||
|
|
||||||
setFodStatus(FOD_STATUS_OFF_UNTIL_SUSPEND);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -284,11 +244,6 @@ class XiaomiSm8450UdfpsHander : public UdfpsHandler {
|
||||||
bool enrolling = false;
|
bool enrolling = false;
|
||||||
uint32_t lastPressX, lastPressY;
|
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) {
|
void setFingerDown(bool pressed) {
|
||||||
int buf[MAX_BUF_SIZE] = {MI_DISP_PRIMARY, THP_FOD_DOWNUP_CTL, pressed ? 1 : 0};
|
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);
|
ioctl(touch_fd_.get(), TOUCH_IOC_SET_CUR_VALUE, &buf);
|
||||||
|
|
Loading…
Reference in a new issue