TinkerBoard / android-7.1.2_kernel

Android Kernel source for Tinker Board
Other
13 stars 10 forks source link

Display don't wake up after sleeping #2

Open sobrinho opened 5 years ago

sobrinho commented 5 years ago

Hi there!

When I set the display to sleep like after 1 minute I can only make it wake up by pressing a keyboard key or the "secret power button" of TB.

Using Android 6 when the display sleeps, I just touch the screen and it wakes up.

This feature is not possible anymore?

jamess-huang commented 5 years ago

We will check and feedback to you.

sobrinho commented 5 years ago

@jamess-huang before releasing a new version for #4, can you try to fix this one together? 😬

jamess-huang commented 5 years ago

Yes, We can duplicate this issue and we are trying to fix it.

sobrinho commented 5 years ago

Apparently the fix for #4 fixed that problem too, closing!

sobrinho commented 5 years ago

Reopening because now the display sleeps but after a few seconds the device turns off for whatever reason.

Keeping the configuration as never sleep, the device does not shut down.

So, there is still a problem with that :sob:

sobrinho commented 5 years ago

Searching around I figured out that you have to enable developer options and enable "Stay awake" option.

That way the device never sleeps so the problem of not waking up never happens.

But I'm sure that is a workaround since the device won't sleep at all which may drain a battery if that's the case.

sobrinho commented 5 years ago

One more information, when the display sleeps but we have the "Stay awake" enabled, wherever you touch on the screen will wake up the screen but also touch at this position.

This may be a bit annoying because you may touch somewhere you don't want like enabling/disabling a toggle if the display slept in a settings screen, or even open an app if it slept on launcher page.

The trick right now is to perform a slide from top to bottom, to open the status bar because that doesn't trigger any action.

jamess-huang commented 5 years ago

Dear, sobrinho I have some confusion. The below is my understanding. If something wrong, please correct me

  1. The option "never sleep" is not work. You need use Stay awake to keep device running.
  2. Why you said that "when the display sleeps but we have the "Stay awake" enabled" ? When the "Stay awake" option is enabled, how does the device go to suspend ?
sobrinho commented 5 years ago

Sorry about the confusion.

The behavior is like that:

  1. Stay awake disabled + Sleep display after 15 seconds: The display sleeps and the device shut down after 15 seconds
  2. Stay awake enabled + Sleep display after 15 seconds: The display sleeps and the device does not shut down after 15 seconds but

In the first case, the device may be in an idle state, I don't know, because I can't make it wake up again at all.

In the second case, the device is kept running, just the display that sleeps and I can touch the screen to wake it up.

Although, when I touch the display to wake up the touch is really performed, as it would with the display on.

This is a problem because the display is sleeping and the touch will always perform some action (like clicking in a button or something like that) that I can't predict.

I will make a video showing that.

sobrinho commented 5 years ago

https://youtu.be/x18uT8mN4KU

jamess-huang commented 5 years ago

Dear, sobrinho Thanks for your video. I got your point.

  1. Stay awake disabled + Sleep display after 15 seconds : from your video, there are 2 stage of this suspend process

    • the screen is off, but the red led is on : this is because there are still some processes hold the wakelock, the CPU can't go to sleep until all the wakelock are released
      • the screen is off and the red led is off : all the processes are into suspend state, including the CPU. This stage is a real suspend stage and you can press the power button to wake up the device, just like the android phone.
  2. Stay awake enabled + Sleep display after 15 seconds: In this case, the system does not go to sleep, it just turn off the backlilght. So when you touch the screen, it always performs an action to the system.

May I know which scenario do you need ? case 1 or case 2 ?

NOTE : how to press the power button : You can short the the 2 pads which are circled by a red rectangle as shown in the below picture https://drive.google.com/open?id=1qT_9jzTvYmiGbyLnrcDjhRxyvH5Aqgjj

jamess-huang commented 5 years ago

Dear, sobrinho For M, we default set the stay awake on, so it will be the case 2. In other words, this DSI panel can't wake up the system when the device goes into suspend. It just turns on the back light, when it receives the touch event.

Since we use the AC adaptor as the power source (not use battery), for most scenario, we need not to consider the power consumption. So how about always keeping the device awake for your application ?

sobrinho commented 5 years ago

I can't leave it always awake because I'm going to install the device in my car and it will flat the battery in a couple of days if I don't turn on the engine every day.

And you have to keep in mind that a car battery takes around 5 to 10 minutes to fully recharge from an engine start, just a couple minutes won't be enough, and I don't want to care about that when I'm traveling or on vacation or something like that.

Also, I can't leave the screen always on because it may drag too much attention when the car is parked (increasing the attention of a thief).

Although, I'm developing another device using an ATtiny85 to communicate with the car to power on the TB and send a shutdown signal when the engine goes on and off (and I can't hard shutdown the device because it may corrupt the eMMC/SD).

So, the power issue won't be a problem after all but waking the device may still be.

When we are driving at the night I don't plan to keep the screen on because it obfuscates the driver's vision of the road (at least mine, and yes, I use glasses), so my plan is to keep the display off in that situation.

But turning the screen back can't perform the touch as you saw in the video, it may trigger some undesired action in the device that I don't want it to.

I have no idea how to fix that but I would say something like to work on display's driver to not perform the touch when the bright is zero (or any other way to detect that the display is "off").

Makes sense?

jamess-huang commented 5 years ago

I think it makes sense that touch should not perform action when panel is off. We will implement this function. So your scenario will be the case 2 but we need to fix the touch issue when panel brightness is zero. Is it correct ?

sobrinho commented 5 years ago

Yes, it is correct.

jamess-huang commented 5 years ago

Hi, sobrinho We have do some tests about not perform touch action when panel is off. Below is our flow, we will keep monitor the current back light and once we find the back light is off, we will block the touch event and turn on the back light. But here comes the problems,

  1. Because we implement this workaround at kernel, the framework will think the panel is still off. When the next touch event comes in, the framework will turn on the panel again. It may cause the display blinking.

    1. When user touches the screen to wakeup the display, the time that user touches the screen is not fixed, we don't know we should skip how many touch event at this situation. So it may still perform the touch event sometimes.

    Below is our patch, please have a look at and maybe you can adjust the parameter (40, 3) at line39, line40 respectively to mitigate the above two problems. touch_wake_up.zip

sobrinho commented 5 years ago

Almost there!

  1. When the display sleep and wake up, it wakes in 40% of bright (as hard-defined in code) instead of the previous bright
  2. Touching a second time, it recovers the previous bright but the display blinks (probably it is going to bright 0 and then the previous bright)
  3. If we don't touch a second time, it won't sleep again
  4. Sometimes the touch is performed when the display is sleeping (in that case the previous bright returns and the display sleeps again as expected, the second bug doesn't happen here)

The random touching may be fixed by changing if (count1++ >= 3) to if (count1++ >= 2) or another value (why is it 3 right now?).

Although, the blinking may require some work on the framework (noob here!) to detect that the display has waked by other means, maybe?