Edge2 (Android): How to Enable Wake on Touch?

Hello everyone,

I’m currently using an Edge2 running Android 14 (v241101) along with a touchscreen. I’ve set a display timeout in the Android settings, which works as expected.

One feature that I absolutely rely on is “Wake on Touch” – the ability to wake the display simply by touching the screen, without pressing any hardware buttons.
This feature works flawlessly on my current Android-based SBC using the same touchscreen.

For my use case, this feature is not just nice to have – it’s essential.
Without it, I simply can’t switch to the Edge2 for my project.

So my question is:

How can I get “Wake on Touch” working on the Edge2?

Any help or suggestions would be greatly appreciated.

Thanks in advance!

Best Regards
Nellor

Hi, you can read this post, maybe it will help you

Thanks for your help. I tried the update.img and, as mentioned in the post, it is possible to wake the display using a connected USB mouse. However, it is still not possible to wake the display by touching the screen.

Hello, what type of touch screen are you using?

I am using a Hannspree HT225HPB 21.5" (VID: 2575 PID: 0401) connected via HDMI and USB for touch screen functionality.

Hello, I thought it was a MIPI screen. If it is HDMI, I have a touch screen but it has been taken away. It will take about a week to get back to me. I can only verify it and then reply to you. Is that ok?

ok no problem, thank you. I suspect this is a fundamental problem. I have another noname touchscreen (VID: 1a86 PID: e5e3) that also supports the “Wake on Touch” feature on my other Android-based SBC.
With this touchscreen, “Wake on Touch” does not work on the Edge2 either.

@Nellor
You can test it according to the two modifications below. I verified it on my touchable HDMI monitor.

Using an external USB device to wake up the device

xiong@builder:~/work/edge2-14/kernel-6.1$ git diff
diff --git a/drivers/misc/khadas-mcu.c b/drivers/misc/khadas-mcu.c
index 17fe564e4b75..2f3a9c89df3a 100644
--- a/drivers/misc/khadas-mcu.c
+++ b/drivers/misc/khadas-mcu.c
@@ -20,6 +20,7 @@
 #include <linux/slab.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
+#include <linux/wakelock.h>
 
 /* Device registers */
 #define MCU_PWR_OFF_CMD_REG             0x80
@@ -112,6 +113,7 @@ struct mcu_data {
 
 struct mcu_data *g_mcu_data;
 int ageing_test_flag = 0;
+static struct wake_lock wake_lock_always;
 
 static int i2c_master_reg8_send(const struct i2c_client *client,
                const char reg, const char *buf, int count)
@@ -761,6 +763,8 @@ static int mcu_probe(struct i2c_client *client, const struct i2c_device_id *id)
        schedule_delayed_work(&g_mcu_data->fan_data.work, MCU_FAN_LOOP_SECS);
        create_mcu_attrs();
 
+       wake_lock_init(&wake_lock_always, WAKE_LOCK_SUSPEND, "wake_lock_always");
+
        return 0;
 }
 
@@ -780,12 +784,14 @@ static int khadas_fan_suspend(struct device *dev)
 {
        cancel_delayed_work(&g_mcu_data->fan_data.work);
        mcu_fan_level_set(&g_mcu_data->fan_data, 0);
+       wake_lock(&wake_lock_always);
 
        return 0;
 }
 
 static int khadas_fan_resume(struct device *dev)
 {
+       wake_unlock(&wake_lock_always);
        khadas_fan_set(&g_mcu_data->fan_data);
 
        return 0;

Modify the touch device so that it is not turned off when the system is in sleep mode

xiong@builder:~/work/edge2-14/frameworks/native$ git diff
diff --git a/services/inputflinger/reader/mapper/TouchInputMapper.cpp b/services/inputflinger/reader/mapper/TouchInputMapper.cpp
index ca9f1ba4ae..8b9ce3f0c4 100644
--- a/services/inputflinger/reader/mapper/TouchInputMapper.cpp
+++ b/services/inputflinger/reader/mapper/TouchInputMapper.cpp
@@ -973,7 +973,7 @@ void TouchInputMapper::configureInputDevice(nsecs_t when, bool* outResetNeeded)
     } else if (!mParameters.enableForInactiveViewport && !newViewportOpt->isActive) {
         ALOGI("Disabling %s (device %i) because the associated viewport is not active",
               getDeviceName().c_str(), getDeviceId());
-        mDeviceMode = DeviceMode::DISABLED;
+        //mDeviceMode = DeviceMode::DISABLED;
     }
 
     // Raw width and height in the natural orientation.

Hi @xiong.zhang, with your two modifications, the “Wake on Touch” feature now works with the Edge2. Thank you so much! :grinning_face:

I wonder if this could be implemented in the official image? Or at least adjustable via “Khadas Settings”? Actually, I would like to avoid building images for Edge2 myself.

Our main feature is the touch wake-up of the MIPI screen. You can pull the latest code and generate your own firmware. Sorry.