From 1dcae43dc9431100281d168dcfbaf558974ce662 Mon Sep 17 00:00:00 2001 From: Georg Veichtlbauer Date: Fri, 18 Dec 2020 10:58:02 +0100 Subject: shinano-common: Handle clearpad and max1187x high touch sensitivity sysfs paths * Sirius has a max1187x instead of a clearpad touchscreen. Change-Id: Idb694cb85b04f20e3e90824cf48feed9ee142bb1 --- touch/GloveMode.cpp | 23 +++++++++++++++++------ touch/GloveMode.h | 1 + touch/vendor.lineage.touch@1.0-service.shinano.rc | 2 ++ 3 files changed, 20 insertions(+), 6 deletions(-) (limited to 'touch') 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 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 GloveMode::isEnabled() { Return 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 -- cgit v1.2.3