diff --git a/rootdir/etc/init/hw/init.mmi.overlay.rc b/rootdir/etc/init/hw/init.mmi.overlay.rc index 8572da6..48861d5 100644 --- a/rootdir/etc/init/hw/init.mmi.overlay.rc +++ b/rootdir/etc/init/hw/init.mmi.overlay.rc @@ -10,6 +10,10 @@ on post-fs chown system system /sys/devices/platform/soc/4a80000.spi/spi_master/spi0/spi0.0/touchscreen/primary/double_tap_pressed chown system system /sys/devices/platform/soc/4a80000.spi/spi_master/spi0/spi0.0/touchscreen/primary/udfps_enabled chown system system /sys/devices/platform/soc/4a80000.spi/spi_master/spi0/spi0.0/touchscreen/primary/udfps_pressed + chown system system /sys/devices/platform/soc/4a80000.spi/spi_master/spi0/spi0.1/touchscreen/primary/double_tap_enabled + chown system system /sys/devices/platform/soc/4a80000.spi/spi_master/spi0/spi0.1/touchscreen/primary/double_tap_pressed + chown system system /sys/devices/platform/soc/4a80000.spi/spi_master/spi0/spi0.1/touchscreen/primary/udfps_enabled + chown system system /sys/devices/platform/soc/4a80000.spi/spi_master/spi0/spi0.1/touchscreen/primary/udfps_pressed on post-fs-data diff --git a/sensors/Sensor.h b/sensors/Sensor.h index f85a892..c21c37f 100644 --- a/sensors/Sensor.h +++ b/sensors/Sensor.h @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -120,7 +121,22 @@ class SysfsPollingOneShotSensor : public OneShotSensor { int mPollFd; }; -const std::string kTsPath = "/sys/devices/platform/soc/4a80000.spi/spi_master/spi0/spi0.0/touchscreen/primary/"; +inline std::string getTouchscreenBasePath() { + const std::vector possiblePaths = { + "/sys/devices/platform/soc/4a80000.spi/spi_master/spi0/spi0.1/touchscreen/primary/", + "/sys/devices/platform/soc/4a80000.spi/spi_master/spi0/spi0.0/touchscreen/primary/" + }; + + for (const auto& path : possiblePaths) { + if (access(path.c_str(), F_OK) == 0) { + return path; + } + } + + return "/sys/devices/platform/soc/4a80000.spi/spi_master/spi0/spi0.1/touchscreen/primary/"; +} + +const std::string kTsPath = getTouchscreenBasePath(); const std::string kTsDoubleTapPressedPath = kTsPath + "double_tap_pressed"; const std::string kTsDoubleTapEnabledPath = kTsPath + "double_tap_enabled";