sm8450-common: sensors: Close touch dev fd after usage

Change-Id: Iad20a110444e87fb6ea37147bd2dc5928ca0ec8d
This commit is contained in:
Arian 2024-07-25 10:10:22 +02:00
parent 66b47cfe82
commit 70f137270c

View file

@ -54,8 +54,15 @@ static bool readBool(int fd) {
struct NonUiSensorCallback : IEventQueueCallback {
Return<void> onEvent(const Event& e) {
int touchFd = open(TOUCH_DEV_PATH, O_RDWR);
if (touchFd == -1) {
LOG(ERROR) << "failed to open " << TOUCH_DEV_PATH;
return Void();
}
int buf[MAX_BUF_SIZE] = {0, Touch_Nonui_Mode, static_cast<int>(e.u.scalar)};
ioctl(open(TOUCH_DEV_PATH, O_RDWR), TOUCH_IOC_SET_CUR_VALUE, &buf);
ioctl(touchFd, TOUCH_IOC_SET_CUR_VALUE, &buf);
close(touchFd);
return Void();
}