diff --git a/resource-overlay/rhodep/Frameworks/res/values/config.xml b/resource-overlay/rhodep/Frameworks/res/values/config.xml index 4eafc20..2a392a2 100644 --- a/resource-overlay/rhodep/Frameworks/res/values/config.xml +++ b/resource-overlay/rhodep/Frameworks/res/values/config.xml @@ -314,4 +314,7 @@ true + + + org.lineageos.sensor.double_tap diff --git a/rootdir/etc/init/hw/init.mmi.overlay.rc b/rootdir/etc/init/hw/init.mmi.overlay.rc index c5f0165..7ba81a9 100644 --- a/rootdir/etc/init/hw/init.mmi.overlay.rc +++ b/rootdir/etc/init/hw/init.mmi.overlay.rc @@ -1,13 +1,6 @@ # sec_nfc import /vendor/etc/init/hw/init.nfc.sec.rc -on post-fs - # "Tap to wake" gesture - chown root input /sys/class/sensors/dt-gesture/enable - chmod 0660 /sys/class/sensors/dt-gesture/enable - chown root input /sys/class/sensors/dt-gesture/poll_delay - chmod 0660 /sys/class/sensors/dt-gesture/poll_delay - on post-fs chown system system /sys/devices/platform/soc/4804000.ufshc/clkgate_enable chown system system /sys/devices/platform/soc/4804000.ufshc/devfreq/4804000.ufshc/min_freq @@ -27,6 +20,11 @@ service vendor.ident-fps-overlay-sh /vendor/bin/init.oem.fingerprint.overlay.sh oneshot disabled +on post-fs + # Sensors + chown system system /sys/devices/platform/soc/4a80000.spi/spi_master/spi0/spi0.0/touchscreen/primary/double_tap_enabled + chown system system /sys/devices/platform/soc/4a80000.spi/spi_master/spi0/spi0.0/touchscreen/primary/double_tap_pressed + on post-fs-data exec_start vendor.ident-fps-overlay-sh chown system system /dev/fpsensor diff --git a/sensors/Sensor.h b/sensors/Sensor.h index f6fe7a5..e5a5a38 100644 --- a/sensors/Sensor.h +++ b/sensors/Sensor.h @@ -120,6 +120,20 @@ class SysfsPollingOneShotSensor : public OneShotSensor { int mPollFd; }; +const std::string kTsPath = "/sys/devices/platform/soc/4a80000.spi/spi_master/spi0/spi0.0/touchscreen/primary/"; + +const std::string kTsDoubleTapPressedPath = kTsPath + "double_tap_pressed"; +const std::string kTsDoubleTapEnabledPath = kTsPath + "double_tap_enabled"; + +class DoubleTapSensor : public SysfsPollingOneShotSensor { + public: + DoubleTapSensor(int32_t sensorHandle, ISensorsEventCallback* callback) + : SysfsPollingOneShotSensor( + sensorHandle, callback, kTsDoubleTapPressedPath, kTsDoubleTapEnabledPath, + "Double Tap Sensor", "org.lineageos.sensor.double_tap", + static_cast(static_cast(SensorType::DEVICE_PRIVATE_BASE) + 1)) {} +}; + } // namespace implementation } // namespace subhal } // namespace V2_1 diff --git a/sensors/SensorsSubHal.cpp b/sensors/SensorsSubHal.cpp index 6cbcb56..9281bfa 100644 --- a/sensors/SensorsSubHal.cpp +++ b/sensors/SensorsSubHal.cpp @@ -32,7 +32,9 @@ namespace implementation { using ::android::hardware::Void; using ::android::hardware::sensors::V2_0::implementation::ScopedWakelock; -SensorsSubHal::SensorsSubHal() : mCallback(nullptr), mNextHandle(1) {} +SensorsSubHal::SensorsSubHal() : mCallback(nullptr), mNextHandle(1) { + AddSensor(); +} Return SensorsSubHal::getSensorsList_2_1(ISensors::getSensorsList_2_1_cb _hidl_cb) { std::vector sensors;