/* * SPDX-FileCopyrightText: 2025 The LineageOS Project * SPDX-License-Identifier: Apache-2.0 */ #include "GloveMode.h" #include namespace { const std::string kGloveModePath = "/sys/devices/common_touch/touch/glove_mode"; } // anonymous namespace namespace aidl { namespace vendor { namespace lineage { namespace touch { ndk::ScopedAStatus GloveMode::getEnabled(bool* _aidl_return) { std::ifstream file(kGloveModePath); if (file.fail()) { return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION); } bool enabled; file >> enabled; *_aidl_return = enabled; return ndk::ScopedAStatus::ok(); } ndk::ScopedAStatus GloveMode::setEnabled(bool enable) { std::ofstream file(kGloveModePath); if (file.fail()) { return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION); } file << enable << std::flush; return ndk::ScopedAStatus::ok(); } } // namespace touch } // namespace lineage } // namespace vendor } // namespace aidl