sm8450-common: sensors: Convert nonui notifier into a generalized sensor based notifier
Change-Id: I34b9861341f4f033185fdbd066b46d779dd95cfa
This commit is contained in:
30
sensors/utils/SensorNotifierUtils.cpp
Normal file
30
sensors/utils/SensorNotifierUtils.cpp
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (C) 2024 The LineageOS Project
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#define LOG_TAG "SensorNotifierUtils"
|
||||
|
||||
#include "SensorNotifierUtils.h"
|
||||
|
||||
#include <android-base/logging.h>
|
||||
|
||||
bool readBool(int fd) {
|
||||
char c;
|
||||
int rc;
|
||||
|
||||
rc = lseek(fd, 0, SEEK_SET);
|
||||
if (rc) {
|
||||
LOG(ERROR) << "failed to seek fd, err: " << rc;
|
||||
return false;
|
||||
}
|
||||
|
||||
rc = read(fd, &c, sizeof(char));
|
||||
if (rc != 1) {
|
||||
LOG(ERROR) << "failed to read bool from fd, err: " << rc;
|
||||
return false;
|
||||
}
|
||||
|
||||
return c != '0';
|
||||
}
|
Reference in New Issue
Block a user