device_motorola_berlin/touch/HighTouchPollingRate.cpp
Michael Bestas 45f5cfcf6e berlin: Switch to SPDX copyright & update dates
Change-Id: I1adc8afc557a0d8a7379ec24589ea68b2391d147
2025-01-21 11:14:41 -05:00

42 lines
884 B
C++

/*
* SPDX-FileCopyrightText: 2022-2024 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 {
const std::string kInterpolationPath = "/sys/class/touchscreen/primary/interpolation";
Return<bool> HighTouchPollingRate::isEnabled() {
std::ifstream file(kInterpolationPath);
int enabled;
file >> enabled;
if(enabled == 1)
return true;
return false;
}
Return<bool> HighTouchPollingRate::setEnabled(bool enabled) {
std::ofstream file(kInterpolationPath);
file << (enabled ? "1" : "0");
return !file.fail();
}
} // namespace implementation
} // namespace V1_0
} // namespace touch
} // namespace lineage
} // namespace vendor