sm8350-common: udfps: Notify goodix HAL on fod_press_status changes
Modern fingerprint.goodix_fod.so has moved the polling of this out of the hal and replaced it with extCmd 1. Change-Id: I7cf01bd8af2e782646195afbb276e14a9f6690cc
This commit is contained in:
parent
a61c4fe556
commit
5c97801789
@ -24,12 +24,17 @@
|
||||
#define FOD_HBM_PATH "/sys/devices/platform/soc/soc:qcom,dsi-display-primary/fod_hbm"
|
||||
#define FOD_STATUS_PATH "/sys/devices/virtual/touch/tp_dev/fod_status"
|
||||
#define FOD_UI_PATH "/sys/devices/platform/soc/soc:qcom,dsi-display-primary/fod_ui"
|
||||
#define FOD_PRESS_STATUS_PATH "/sys/class/touch/touch_dev/fod_press_status"
|
||||
|
||||
#define FOD_HBM_OFF 0
|
||||
#define FOD_HBM_ON 1
|
||||
#define FOD_STATUS_OFF 0
|
||||
#define FOD_STATUS_ON 1
|
||||
|
||||
#define COMMAND_FOD_PRESS_STATUS 1
|
||||
#define PARAM_FOD_PRESSED 1
|
||||
#define PARAM_FOD_RELEASED 0
|
||||
|
||||
template <typename T>
|
||||
static void set(const std::string& path, const T& value) {
|
||||
std::ofstream file(path);
|
||||
@ -61,26 +66,44 @@ class XiaomiUdfpsHander : public UdfpsHandler {
|
||||
mDevice = device;
|
||||
|
||||
std::thread([this]() {
|
||||
int fd = open(FOD_UI_PATH, O_RDONLY);
|
||||
if (fd < 0) {
|
||||
LOG(ERROR) << "failed to open fd, err: " << fd;
|
||||
int fodUiFd = open(FOD_UI_PATH, O_RDONLY);
|
||||
int fodPressStatusFd = open(FOD_PRESS_STATUS_PATH, O_RDONLY);
|
||||
if (fodUiFd < 0) {
|
||||
LOG(ERROR) << "failed to open fodUiFd, err: " << fodUiFd;
|
||||
return;
|
||||
}
|
||||
|
||||
struct pollfd fodUiPoll = {
|
||||
.fd = fd,
|
||||
.events = POLLERR | POLLPRI,
|
||||
.revents = 0,
|
||||
if (fodPressStatusFd < 0) {
|
||||
LOG(ERROR) << "failed to open fodPressStatusFd, err: " << fodPressStatusFd;
|
||||
return;
|
||||
}
|
||||
|
||||
struct pollfd fds[2] = {
|
||||
{fodUiFd, .events = POLLERR | POLLPRI, .revents = 0},
|
||||
{fodPressStatusFd, .events = POLLERR | POLLPRI, .revents = 0},
|
||||
};
|
||||
|
||||
while (true) {
|
||||
int rc = poll(&fodUiPoll, 1, -1);
|
||||
int rc = poll(fds, 2, -1);
|
||||
if (rc < 0) {
|
||||
LOG(ERROR) << "failed to poll fd, err: " << rc;
|
||||
if (fds[0].revents & POLLERR) {
|
||||
LOG(ERROR) << "failed to poll fodUiFd, err: " << rc;
|
||||
}
|
||||
if (fds[1].revents & POLLERR) {
|
||||
LOG(ERROR) << "failed to poll fodPressStatusFd, err: " << rc;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
mDevice->extCmd(mDevice, COMMAND_NIT, readBool(fd) ? PARAM_NIT_UDFPS : PARAM_NIT_NONE);
|
||||
if (fds[0].revents & (POLLERR | POLLPRI)) {
|
||||
bool nitState = readBool(fodUiFd);
|
||||
mDevice->extCmd(mDevice, COMMAND_NIT, nitState ? PARAM_NIT_UDFPS : PARAM_NIT_NONE);
|
||||
}
|
||||
|
||||
if (fds[1].revents & (POLLERR | POLLPRI)) {
|
||||
bool pressState = readBool(fodPressStatusFd);
|
||||
mDevice->extCmd(mDevice, COMMAND_FOD_PRESS_STATUS, pressState ? PARAM_FOD_PRESSED : PARAM_FOD_RELEASED);
|
||||
}
|
||||
}
|
||||
}).detach();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user