This adds support for set_scan_rate SEC TSP command, which is used by devices like the S20-S22 Series (non-FE). Keeps backward compatibility for devices with a melfas touchscreen like the S20 FE (r8s/r8q), using set_game_mode TSP command. Change-Id: I643832df015220874d728b1ef54533c07e59f885 Signed-off-by: ExtremeXT <extremextdev@gmail.com>
42 lines
927 B
C++
42 lines
927 B
C++
/*
|
|
* SPDX-FileCopyrightText: 2025 The LineageOS Project
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
#include <fstream>
|
|
|
|
#include "HighTouchPollingRate.h"
|
|
|
|
namespace aidl {
|
|
namespace vendor {
|
|
namespace lineage {
|
|
namespace touch {
|
|
|
|
bool HighTouchPollingRate::isSupported() {
|
|
return !mHtprCmd.empty();
|
|
}
|
|
|
|
ndk::ScopedAStatus HighTouchPollingRate::getEnabled(bool* _aidl_return) {
|
|
std::ifstream file(TSP_CMD_RESULT_NODE);
|
|
if (file.is_open()) {
|
|
std::string line;
|
|
getline(file, line);
|
|
*_aidl_return = !line.compare(mHtprCmd + ",1:OK");
|
|
file.close();
|
|
}
|
|
|
|
return ndk::ScopedAStatus::ok();
|
|
}
|
|
|
|
ndk::ScopedAStatus HighTouchPollingRate::setEnabled(bool enabled) {
|
|
std::ofstream file(TSP_CMD_NODE);
|
|
file << (mHtprCmd + ",") << (enabled ? "1" : "0");
|
|
|
|
return ndk::ScopedAStatus::ok();
|
|
}
|
|
|
|
} // namespace touch
|
|
} // namespace lineage
|
|
} // namespace vendor
|
|
} // namespace aidl
|