This repository has been archived by the owner on Apr 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sm8250-common: Implement HighTouchPollingRate for supported devices
Signed-off-by: electimon <[email protected]> Change-Id: I2c6623f18e0b5dbbe165c699b826fce68f9050eb
- Loading branch information
Showing
8 changed files
with
99 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ soong_config_module_type { | |
name: "moto_kona_touch_hal", | ||
module_type: "cc_defaults", | ||
config_namespace: "MOTO_KONA_TOUCH", | ||
bool_variables: ["USE_TOUCH_POLLING_RATE"], | ||
value_variables: ["SINGLE_TAP_PATH"], | ||
properties: [ | ||
"cppflags", | ||
|
@@ -27,6 +28,10 @@ soong_config_module_type { | |
moto_kona_touch_hal { | ||
name: "moto_kona_touch_hal_cc_defaults", | ||
soong_config_variables: { | ||
USE_TOUCH_POLLING_RATE: { | ||
cppflags: ["-DUSE_TOUCH_POLLING_RATE"], | ||
srcs: ["HighTouchPollingRate.cpp"], | ||
}, | ||
SINGLE_TAP_PATH: { | ||
cppflags: ["-DSINGLE_TAP_PATH=\"%s\""], | ||
srcs: ["TouchscreenGesture.cpp"], | ||
|
@@ -41,7 +46,6 @@ cc_binary { | |
"hidl_defaults", | ||
"moto_kona_touch_hal_cc_defaults" | ||
], | ||
vintf_fragments: ["[email protected]_kona.xml"], | ||
relative_install_path: "hw", | ||
vendor: true, | ||
srcs: [ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* Copyright (C) 2022 The LineageOS Project | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#define LOG_TAG "HighTouchPollingRateService" | ||
|
||
#include "HighTouchPollingRate.h" | ||
|
||
#include <android-base/file.h> | ||
#include <android-base/logging.h> | ||
#include <android-base/strings.h> | ||
|
||
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::string buf; | ||
if (!android::base::ReadFileToString(kInterpolationPath, &buf)) { | ||
LOG(ERROR) << "Failed to read " << kInterpolationPath; | ||
return false; | ||
} | ||
return std::stoi(android::base::Trim(buf)) == 1; | ||
} | ||
|
||
Return<bool> HighTouchPollingRate::setEnabled(bool enabled) { | ||
if (!android::base::WriteStringToFile(std::to_string(enabled), kInterpolationPath)) { | ||
LOG(ERROR) << "Failed to write " << kInterpolationPath; | ||
return false; | ||
} | ||
return true; | ||
} | ||
|
||
} // namespace implementation | ||
} // namespace V1_0 | ||
} // namespace touch | ||
} // namespace lineage | ||
} // namespace vendor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Copyright (C) 2022 The LineageOS Project | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <vendor/lineage/touch/1.0/IHighTouchPollingRate.h> | ||
|
||
namespace vendor { | ||
namespace lineage { | ||
namespace touch { | ||
namespace V1_0 { | ||
namespace implementation { | ||
|
||
using ::android::hardware::Return; | ||
|
||
class HighTouchPollingRate : public IHighTouchPollingRate { | ||
public: | ||
// Methods from ::vendor::lineage::touch::V1_0::IHighTouchPollingRate follow. | ||
Return<bool> isEnabled() override; | ||
Return<bool> setEnabled(bool enabled) override; | ||
}; | ||
|
||
} // namespace implementation | ||
} // namespace V1_0 | ||
} // namespace touch | ||
} // namespace lineage | ||
} // namespace vendor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
on early-boot | ||
chown system system /sys/class/touchscreen/primary/interpolation | ||
|
||
service touch-hal-1-0 /vendor/bin/hw/[email protected]_kona | ||
class hal | ||
user system | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters