sm8450-common: sensors: Close touch dev fd after usage
Change-Id: Iad20a110444e87fb6ea37147bd2dc5928ca0ec8d
This commit is contained in:
parent
66b47cfe82
commit
70f137270c
1 changed files with 8 additions and 1 deletions
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue