hardware_xiaomi/hidl/touch/HighTouchPollingRate.cpp
luk1337 8a55af6b3c
touch: Make HIGH_TOUCH_POLLING_PATH configurable via Soong flag
Change-Id: I7649e084b2604c46f47c07c355913720935e1298
2022-05-13 18:02:35 +02:00

38 lines
758 B
C++

/*
* Copyright (C) 2022 The LineageOS Project
*
* SPDX-License-Identifier: Apache-2.0
*/
#define LOG_TAG "HighTouchPollingRateService"
#include "HighTouchPollingRate.h"
#include <fstream>
namespace vendor {
namespace lineage {
namespace touch {
namespace V1_0 {
namespace implementation {
Return<bool> HighTouchPollingRate::isEnabled() {
std::ifstream file(HIGH_TOUCH_POLLING_PATH);
int enabled;
file >> enabled;
return enabled == 1;
}
Return<bool> HighTouchPollingRate::setEnabled(bool enabled) {
std::ofstream file(HIGH_TOUCH_POLLING_PATH);
file << (enabled ? "1" : "0");
return !file.fail();
}
} // namespace implementation
} // namespace V1_0
} // namespace touch
} // namespace lineage
} // namespace vendor