summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorg Veichtlbauer <georg@vware.at>2020-12-18 10:58:02 +0100
committerArian <arian.kulmer@web.de>2020-12-19 15:17:43 +0100
commit1dcae43dc9431100281d168dcfbaf558974ce662 (patch)
tree7a9d8d63938907747ca65071a5aceb80ebefebc6
parent34156b064f84d4b9ba454039c6c1b5ffa651282e (diff)
shinano-common: Handle clearpad and max1187x high touch sensitivity sysfs paths
* Sirius has a max1187x instead of a clearpad touchscreen. Change-Id: Idb694cb85b04f20e3e90824cf48feed9ee142bb1
-rw-r--r--touch/GloveMode.cpp23
-rw-r--r--touch/GloveMode.h1
-rw-r--r--touch/vendor.lineage.touch@1.0-service.shinano.rc2
3 files changed, 20 insertions, 6 deletions
diff --git a/touch/GloveMode.cpp b/touch/GloveMode.cpp
index 39cee8d..5ba1bd3 100644
--- a/touch/GloveMode.cpp
+++ b/touch/GloveMode.cpp
@@ -26,10 +26,21 @@ namespace touch {
namespace V1_0 {
namespace implementation {
-constexpr const char kGlovePath[] = "/sys/devices/virtual/input/clearpad/glove";
+constexpr const char kGlovePathClearpad[] = "/sys/devices/virtual/input/clearpad/glove";
+constexpr const char kGlovePathMax1187x[] = "/sys/devices/virtual/input/max1187x/glove";
GloveMode::GloveMode() {
- mHasGloveMode = !access(kGlovePath, F_OK);
+ mHasGloveMode = false;
+
+ if (!access(kGlovePathClearpad, F_OK)) {
+ LOG(INFO) << "Detected clearpad touchscreen.";
+ mHasGloveMode = true;
+ mGloveSysfsPath = kGlovePathClearpad;
+ } else if (!access(kGlovePathMax1187x, F_OK)) {
+ LOG(INFO) << "Detected max1187x touchscreen.";
+ mHasGloveMode = true;
+ mGloveSysfsPath = kGlovePathMax1187x;
+ }
}
// Methods from ::vendor::lineage::touch::V1_0::IGloveMode follow.
@@ -38,8 +49,8 @@ Return<bool> GloveMode::isEnabled() {
if (!mHasGloveMode) return false;
- if (!android::base::ReadFileToString(kGlovePath, &buf)) {
- LOG(ERROR) << "Failed to read " << kGlovePath;
+ if (!android::base::ReadFileToString(mGloveSysfsPath, &buf)) {
+ LOG(ERROR) << "Failed to read " << mGloveSysfsPath;
return false;
}
@@ -49,8 +60,8 @@ Return<bool> GloveMode::isEnabled() {
Return<bool> GloveMode::setEnabled(bool enabled) {
if (!mHasGloveMode) return false;
- if (!android::base::WriteStringToFile((enabled ? "1" : "0"), kGlovePath)) {
- LOG(ERROR) << "Failed to write " << kGlovePath;
+ if (!android::base::WriteStringToFile((enabled ? "1" : "0"), mGloveSysfsPath)) {
+ LOG(ERROR) << "Failed to write " << mGloveSysfsPath;
return false;
}
diff --git a/touch/GloveMode.h b/touch/GloveMode.h
index ccf4ad0..7480cac 100644
--- a/touch/GloveMode.h
+++ b/touch/GloveMode.h
@@ -36,6 +36,7 @@ class GloveMode : public IGloveMode {
private:
bool mHasGloveMode;
+ std::string mGloveSysfsPath;
};
} // namespace implementation
diff --git a/touch/vendor.lineage.touch@1.0-service.shinano.rc b/touch/vendor.lineage.touch@1.0-service.shinano.rc
index 682b044..e8a783e 100644
--- a/touch/vendor.lineage.touch@1.0-service.shinano.rc
+++ b/touch/vendor.lineage.touch@1.0-service.shinano.rc
@@ -1,6 +1,8 @@
on boot
chown system system /sys/devices/virtual/input/clearpad/glove
+ chown system system /sys/devices/virtual/input/max1187x/glove
chmod 0660 /sys/devices/virtual/input/clearpad/glove
+ chmod 0660 /sys/devices/virtual/input/max1187x/glove
service vendor.touch-hal-1-0 /vendor/bin/hw/vendor.lineage.touch@1.0-service.shinano
class hal