C2 not turning display power off after inactivity

Post Reply
Piper64
Posts: 23
Joined: Mon Jun 27, 2016 3:32 am
languages_spoken: english
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

C2 not turning display power off after inactivity

Unread post by Piper64 » Mon Jun 27, 2016 3:46 am

My new C2 is spectacularly better with eMMC module - making a superb silent desktop. My only problem is that after a period of inactivity the screen, connected by hdmi, is blanked but its power is not turned off. I've pored over info about dpms, xset and tvservice, but I can't see how to get the C2 to power down the monitor. Surely I'm not the first to ask this? Can it be done?

phaseshifter
Posts: 3520
Joined: Fri May 08, 2015 9:12 am
languages_spoken: english
ODROIDs: U-2,U3+,,XU-3,,XU3-LITE,,XU-4
C1+,,C-2,,,
N-1,,N-2,...other odroid acc`s as well
Has thanked: 41 times
Been thanked: 43 times
Contact:

Re: C2 not turning display power off after inactivity

Unread post by phaseshifter » Mon Jun 27, 2016 4:15 am

i dont think that there is any way that can be done the screen will go into idle status..after a while..depending on your settings in power management
but as for a complete shutdown of the mains...no it will not ..you have to manually do that
Build It And They Will Come...Be Bold And Mighty Forces Will Come To Your Aid..!!!

Piper64
Posts: 23
Joined: Mon Jun 27, 2016 3:32 am
languages_spoken: english
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Re: C2 not turning display power off after inactivity

Unread post by Piper64 » Mon Jun 27, 2016 6:10 am

Thanks for your response. Sorry I wasn't clear. I don't want a complete shutdown at the mains, just for the light in the monitor to be turned off.

phaseshifter
Posts: 3520
Joined: Fri May 08, 2015 9:12 am
languages_spoken: english
ODROIDs: U-2,U3+,,XU-3,,XU3-LITE,,XU-4
C1+,,C-2,,,
N-1,,N-2,...other odroid acc`s as well
Has thanked: 41 times
Been thanked: 43 times
Contact:

Re: C2 not turning display power off after inactivity

Unread post by phaseshifter » Mon Jun 27, 2016 8:27 am

no it wont at best what i did was to put a piece of black tape over the led..
you know when it comes out of stand-by because you see the desktop on the screen..
Build It And They Will Come...Be Bold And Mighty Forces Will Come To Your Aid..!!!

endecotp
Posts: 231
Joined: Sun May 08, 2016 12:30 am
languages_spoken: english
ODROIDs: c2
Has thanked: 0
Been thanked: 0
Contact:

Re: C2 not turning display power off after inactivity

Unread post by endecotp » Mon Jun 27, 2016 9:00 am

Piper64 wrote:Surely I'm not the first to ask this? Can it be done?
You're not the first, and it can't be done as far as we know:
http://forum.odroid.com/viewtopic.php?f ... 14#p143014

User avatar
odroid
Site Admin
Posts: 33649
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean, Japanese
ODROIDs: ODROID
Has thanked: 500 times
Been thanked: 504 times
Contact:

Re: C2 not turning display power off after inactivity

Unread post by odroid » Mon Jun 27, 2016 12:05 pm

Once endecotp raised this issue, we've tried to find a solution.
But we don't have any good conclusion yet.

We could turn on/off the HDMI PHY via writing 0/1 into /sys/class/amhdmitx/amhdmitx0/phy
While OSD0 is used as a FrameBuffer and it seems to be possible to use osd_enable_hw enable parameter to toggle the hdmi_phy.
"xset dpms force off/suspend/standby" command makes it possible. But sudden FB_BLANK enable came from xorg and it made the hdmi_phy alive again.
We couldn't find what/why it happened. We need to keep looking into this issue.

Piper64
Posts: 23
Joined: Mon Jun 27, 2016 3:32 am
languages_spoken: english
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Re: C2 not turning display power off after inactivity

Unread post by Piper64 » Tue Jun 28, 2016 1:24 am

Your replies are really appreciated because if you guys with your much deeper knowledge haven't been able to solve the problem, then there's no point in me spending any more time on it. I'll just have to wait until you have your eureka moment!
I had the same problem with my Raspberry Pi 2 connected by hdmi cable and DVI adapter. I read somewhere that putting "hdmi_blanking=1" in /boot/config.txt would allow the screen to power off when the Pi was idle - and it worked! I tried putting it in the C2's /boot/boot.ini, but no joy.
phaseshifter, my issue is not with the LED; I'm trying to power down the screen when the C2 is idle.

Piper64
Posts: 23
Joined: Mon Jun 27, 2016 3:32 am
languages_spoken: english
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Re: C2 not turning display power off after inactivity

Unread post by Piper64 » Wed Jul 06, 2016 4:25 am

Hi Odroid, I have two questions.
Firstly, could you give any idea of time scale of when this issue might be addressed?
Secondly, this solution was written for Raspberry Pi (https://github.com/lealanko/vcdpmsd/blo ... README.rst). Could a similar strategy work for the C2, or would that be a complete waste of time? If it could possibly work, I'll give it a try but I don't fully understand the process.

User avatar
odroid
Site Admin
Posts: 33649
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean, Japanese
ODROIDs: ODROID
Has thanked: 500 times
Been thanked: 504 times
Contact:

Re: C2 not turning display power off after inactivity

Unread post by odroid » Wed Jul 06, 2016 11:34 am

The latest C2 Android release has a new option of suspend_hdmiphy=1/[0] in boot.ini file.
http://odroid.com/dokuwiki/doku.php?id= ... _note_v1.9

But the same approach doesn't work on Ubuntu yet.
Even we keep trying to find a solution, it is hard to tell you the time scale.

Please try the latest Android image with your display if you have spare time.
It will be very helpful to confirm a starting point.

Piper64
Posts: 23
Joined: Mon Jun 27, 2016 3:32 am
languages_spoken: english
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Re: C2 not turning display power off after inactivity

Unread post by Piper64 » Fri Jul 08, 2016 12:18 am

Thank you Odroid - progress!
I'm pleased to report that the new android release on the C2 successfully turned off the monitor after inactivity. This was after changing suspend_hdmiphy=0 to suspend_hdmiphy=1 in boot.ini AND after turning off "Daydream" which must be android's name for screensaver.
I compared the android and ubuntu boot.ini files. I even tried the android boot.ini with ubuntu OS - the blue light came on but didn't blink and the C2 didn't boot. I then just changed the last few lines of the android's boot.ini (giving boot addresses) to those of the ubuntu's boot.ini. UbuntuMATE then booted up normally, but the monitor wasn't turned off when idle.
Does the answer lie in the boot.ini file?
Thanks again for your efforts, and good luck trying to get ubuntuMATE to turn off the monitor.

User avatar
odroid
Site Admin
Posts: 33649
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean, Japanese
ODROIDs: ODROID
Has thanked: 500 times
Been thanked: 504 times
Contact:

Re: C2 not turning display power off after inactivity

Unread post by odroid » Fri Jul 08, 2016 9:14 am

Thank you for the confirmation.
The kernel parameters in the boot.ini file is tightly coupled with kernel image.
Ubuntu kernel has no option to handle "suspend_hdmiphy" yet.
We will keep trying to find a solution but we may need much longer time than your expectation.

User avatar
wrxtasy
Posts: 1298
Joined: Wed May 13, 2015 1:59 pm
languages_spoken: english
ODROIDs: C1, C1+, C2
Location: Australia
Has thanked: 3 times
Been thanked: 2 times
Contact:

Re: C2 not turning display power off after inactivity

Unread post by wrxtasy » Mon Jul 11, 2016 12:56 pm

Raybuntu would probably have the answer to this you can use HDMI-CEC to turn on and turn off a CEC compatible TV using a AML modded Pulse8 libCEC API with Kodi LibreELEC.
LibreELEC Krypton C1(+) HERE
LibreELEC Krypton C2 HERE

Raybuntu
Posts: 1388
Joined: Mon Nov 30, 2015 4:23 pm
languages_spoken: english, german
ODROIDs: C1+, C2
Has thanked: 3 times
Been thanked: 16 times
Contact:

Re: C2 not turning display power off after inactivity

Unread post by Raybuntu » Mon Jul 11, 2016 8:38 pm

wrxtasy wrote:Raybuntu would probably have the answer to this you can use HDMI-CEC to turn on and turn off a CEC compatible TV using a AML modded Pulse8 libCEC API with Kodi LibreELEC.
Yes you can do it with cec. Just use cec-client which is the easiest.

Code: Select all

echo "standby 0" | cec-client -s
and to turn it on:

Code: Select all

echo "on 0" | cec-client -s

Piper64
Posts: 23
Joined: Mon Jun 27, 2016 3:32 am
languages_spoken: english
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Re: C2 not turning display power off after inactivity

Unread post by Piper64 » Sat Jul 16, 2016 11:02 pm

Thank you Raybuntu for this encouraging reply.
I need to install cec-utils.
Noob question: To work every time, can those standby / resume commands be put in a startup script? .xsession or .xclients or something else? Thanks again.

Raybuntu
Posts: 1388
Joined: Mon Nov 30, 2015 4:23 pm
languages_spoken: english, german
ODROIDs: C1+, C2
Has thanked: 3 times
Been thanked: 16 times
Contact:

Re: C2 not turning display power off after inactivity

Unread post by Raybuntu » Sun Jul 17, 2016 1:23 am

What are you trying to do? CEC will turn on your TV automatically on boot even without libcec. But you need a CEC compatible TV. If you want to turn off the TV after some idle time you need to have some scripts that execute those commands if the screensaver is activated/deactivated.

Piper64
Posts: 23
Joined: Mon Jun 27, 2016 3:32 am
languages_spoken: english
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Re: C2 not turning display power off after inactivity

Unread post by Piper64 » Sun Jul 17, 2016 7:30 pm

I'm using the C2 as a desktop and it's connected to the monitor by hdmi. After inactivity the display is blanked, but the monitor is not put on standby, so there is no power saving. The Android image, referred to above, is able to power down the monitor after inactivity, but not the Ubuntu MATE one. I'd prefer to use the latter.

Raybuntu
Posts: 1388
Joined: Mon Nov 30, 2015 4:23 pm
languages_spoken: english, german
ODROIDs: C1+, C2
Has thanked: 3 times
Been thanked: 16 times
Contact:

Re: C2 not turning display power off after inactivity

Unread post by Raybuntu » Sun Jul 17, 2016 7:47 pm

Is your Monitor even cec capable?

That issue is really interesting. I'll have access to a hdmi monitor soon and wanted to port the latest amlogic hdmi driver for the C2. I'll look deeper inside the code.

Piper64
Posts: 23
Joined: Mon Jun 27, 2016 3:32 am
languages_spoken: english
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Re: C2 not turning display power off after inactivity

Unread post by Piper64 » Mon Jul 18, 2016 1:02 am

The monitor is an LG IPS 22MP55. The LG website doesn't state whether or not it's cec compliant. The fact that the Android image can power down the monitor when inactive suggests it should be possible from a hardware point of view.

Raybuntu
Posts: 1388
Joined: Mon Nov 30, 2015 4:23 pm
languages_spoken: english, german
ODROIDs: C1+, C2
Has thanked: 3 times
Been thanked: 16 times
Contact:

Re: C2 not turning display power off after inactivity

Unread post by Raybuntu » Mon Jul 18, 2016 1:32 am

So I'm guessing it's not supported. Android is only capable to power it off cause HK worked out a patch. Don't waste your time with CEC then. I'll have a look into the android patch see what can be done.

spyvsspy
Posts: 63
Joined: Fri May 06, 2016 5:15 am
languages_spoken: english
ODROIDs: C2 XU4
Has thanked: 0
Been thanked: 0
Contact:

Re: C2 not turning display power off after inactivity

Unread post by spyvsspy » Mon Jul 18, 2016 2:51 am

same issue here with LG W2343T, using HDMI -> DVI cable.
hopefully someone will find a workaround

phaseshifter
Posts: 3520
Joined: Fri May 08, 2015 9:12 am
languages_spoken: english
ODROIDs: U-2,U3+,,XU-3,,XU3-LITE,,XU-4
C1+,,C-2,,,
N-1,,N-2,...other odroid acc`s as well
Has thanked: 41 times
Been thanked: 43 times
Contact:

Re: C2 not turning display power off after inactivity

Unread post by phaseshifter » Mon Jul 18, 2016 3:14 pm

try this post lg...is known as simplink not cec

http://www.ehow.com/how_8474066_use-simplink-lg-tv.html
Build It And They Will Come...Be Bold And Mighty Forces Will Come To Your Aid..!!!

Raybuntu
Posts: 1388
Joined: Mon Nov 30, 2015 4:23 pm
languages_spoken: english, german
ODROIDs: C1+, C2
Has thanked: 3 times
Been thanked: 16 times
Contact:

Re: C2 not turning display power off after inactivity

Unread post by Raybuntu » Mon Jul 18, 2016 3:41 pm

phaseshifter wrote:try this post lg...is known as simplink not cec

http://www.ehow.com/how_8474066_use-simplink-lg-tv.html
They are using LG monitors not TV's. They don't have SimpLink support, but thanks for pointing it out.

Raybuntu
Posts: 1388
Joined: Mon Nov 30, 2015 4:23 pm
languages_spoken: english, german
ODROIDs: C1+, C2
Has thanked: 3 times
Been thanked: 16 times
Contact:

Re: C2 not turning display power off after inactivity

Unread post by Raybuntu » Mon Jul 18, 2016 4:41 pm

You can use that dirty workaround to make it work for now:

Code: Select all

#!/bin/bash - 

# Found here https://unix.stackexchange.com/questions/28181/run-script-on-screen-lock-unlock

dbus-monitor --session "type='signal',interface='org.mate.ScreenSaver'" |
  while read x; do
    case "$x" in 
      *"boolean true"*) echo 0 > /sys/class/amhdmitx/amhdmitx0/phy;;
      *"boolean false"*) echo 1 > /sys/class/amhdmitx/amhdmitx0/phy;;  
    esac
  done
It's a script and I tested it with my hdmi monitor and it works. You'll have to run it inside your mate session. And you also need to set the access rights for the class:

Code: Select all

sudo chown odroid /sys/class/amhdmitx/amhdmitx0/phy
There is a prettier way to set the access rights with udev on boot but I'm currently not able to test it so I won't post it here yet.

Piper64
Posts: 23
Joined: Mon Jun 27, 2016 3:32 am
languages_spoken: english
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Re: C2 not turning display power off after inactivity

Unread post by Piper64 » Wed Jul 20, 2016 6:26 pm

Fascinating, and thanks. Will be back home at the weekend, and look forward to trying this out.
I assume the script is saved as "phy" in the directory indicated. "Chmod" not needed I presume.

Raybuntu
Posts: 1388
Joined: Mon Nov 30, 2015 4:23 pm
languages_spoken: english, german
ODROIDs: C1+, C2
Has thanked: 3 times
Been thanked: 16 times
Contact:

Re: C2 not turning display power off after inactivity

Unread post by Raybuntu » Wed Jul 20, 2016 6:33 pm

Piper64 wrote:Fascinating, and thanks. Will be back home at the weekend, and look forward to trying this out.
It's just a workaround and it's not that pretty as a real fix. Once I merge the new hdmi driver I will look into dpms support.

Piper64
Posts: 23
Joined: Mon Jun 27, 2016 3:32 am
languages_spoken: english
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Re: C2 not turning display power off after inactivity

Unread post by Piper64 » Mon Jul 25, 2016 1:51 am

I tried to use your script Raybuntu. There's already a file "phy" in the folder you mentioned but it wouldn't let me open it, even though I was doing sudo and tried the chown command. I tried pluma within sudo caja and sudo pluma from the command line. I had right clicked the file and changed all the permissions to read and write.
The no-entry sign was accompanied by "Could not open the file /sys/class/amhdmitx/amhdmitx0/phy. Unexpected error: Error reading from file: Input/output error". Any further tips will be appreciated.

Raybuntu
Posts: 1388
Joined: Mon Nov 30, 2015 4:23 pm
languages_spoken: english, german
ODROIDs: C1+, C2
Has thanked: 3 times
Been thanked: 16 times
Contact:

Re: C2 not turning display power off after inactivity

Unread post by Raybuntu » Mon Jul 25, 2016 4:14 am

Have you tried that chown command? Input/Output errors always come from corrupt filesystems. Try running fsck to repair your ext4 filesystem.

hephooey
Posts: 54
Joined: Tue Mar 22, 2016 4:19 am
languages_spoken: english
ODROIDs: C1+, C2
Has thanked: 0
Been thanked: 0
Contact:

Re: C2 not turning display power off after inactivity

Unread post by hephooey » Mon Jul 25, 2016 7:55 am

Piper64 wrote:I tried to use your script Raybuntu. There's already a file "phy" in the folder you mentioned but it wouldn't let me open it, even though I was doing sudo and tried the chown command. I tried pluma within sudo caja and sudo pluma from the command line. I had right clicked the file and changed all the permissions to read and write.
The no-entry sign was accompanied by "Could not open the file /sys/class/amhdmitx/amhdmitx0/phy. Unexpected error: Error reading from file: Input/output error". Any further tips will be appreciated.
/sys/class/amhdmitx/amhdmitx0/phy is a "fake" file created by the kernel, it cannot be read, you can only write something to it with commands like echo etc.

Piper64
Posts: 23
Joined: Mon Jun 27, 2016 3:32 am
languages_spoken: english
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Re: C2 not turning display power off after inactivity

Unread post by Piper64 » Mon Jul 25, 2016 10:38 pm

Thanks both.
Unfortunately I'm still unable to put the script into the "phy" file. I've tried sudo echo and the chown command but I think I was still denied permission. I keep having to delete the phy.swap file in /var/tmp. Do I first put the script in a temporary file and then use the dd command? Sorry to ask again but I've googled around a lot.

Raybuntu
Posts: 1388
Joined: Mon Nov 30, 2015 4:23 pm
languages_spoken: english, german
ODROIDs: C1+, C2
Has thanked: 3 times
Been thanked: 16 times
Contact:

Re: C2 not turning display power off after inactivity

Unread post by Raybuntu » Mon Jul 25, 2016 10:46 pm

Wait a minute. You are not trying to write the script to the phy file???

Create a seperate new file in your home directory. Call it aml_dpms.sh

Copy paste the contents and save. Then set the execution rights:

Code: Select all

chmod +x aml_dpms.sh
Then you need to set the access right for the phy file with the chown command.

And execute it for testing like this:

Code: Select all

./aml_dpms.sh
if it's working for you we can make a permanent solution. You can set the access rights (chown command) with udev on every boot. You can automatically start the script when you login to mate.

Piper64
Posts: 23
Joined: Mon Jun 27, 2016 3:32 am
languages_spoken: english
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Re: C2 not turning display power off after inactivity

Unread post by Piper64 » Tue Jul 26, 2016 12:15 am

Thanks Raybuntu. I was able to proceed. It blanked the screen (after a test of 1 minute) but the illumination in the monitor was still on - confirmed when I disconnected the power supply. Normally I know when the screen is powered down because the LED next to the power switch symbol starts to blink. When you wrote above that it worked for you, did it definitely put your screen in standby, or just blank it? In case it makes a difference, in "Power Management" settings, I have "never" for the computer to be put to sleep and 1 minute for the display. Under "Screensaver", I have idle set at 1 minute, "Lock screen" is unclicked and I have tried it with and without the screensaver being activated. Thanks again.

Raybuntu
Posts: 1388
Joined: Mon Nov 30, 2015 4:23 pm
languages_spoken: english, german
ODROIDs: C1+, C2
Has thanked: 3 times
Been thanked: 16 times
Contact:

Re: C2 not turning display power off after inactivity

Unread post by Raybuntu » Tue Jul 26, 2016 12:37 am

It definitely turned it off. It works like this. In case mate screensaver is activated a dbus signal is send which runs the command to turn of hdmi signal. Normally a Monitor will turn of if there is no signal. Make sure you activate your screensaver not any other dpms stuff.

Currently I have no access to an hdmi monitor but my TV is giving me NO SIGNAL message.
But again this is just a dirty hack and it might not work for everyone.

Piper64
Posts: 23
Joined: Mon Jun 27, 2016 3:32 am
languages_spoken: english
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Re: C2 not turning display power off after inactivity

Unread post by Piper64 » Tue Jul 26, 2016 1:33 am

It still doesn't power off the monitor but I appreciate your efforts. For screensaver "themes" I tried Cosmos and blank. When I pull out the hdmi cable the monitor detects it and displays "no signal". I guess I'll wait until you can do something with dpms or HK works out a patch like they did for the android release. Thanks again though.

Raybuntu
Posts: 1388
Joined: Mon Nov 30, 2015 4:23 pm
languages_spoken: english, german
ODROIDs: C1+, C2
Has thanked: 3 times
Been thanked: 16 times
Contact:

Re: C2 not turning display power off after inactivity

Unread post by Raybuntu » Tue Jul 26, 2016 2:18 am

And what happens if you just execute the command:

echo 0 > /sys/class/amhdmitx/amhdmitx0/phy

Piper64
Posts: 23
Joined: Mon Jun 27, 2016 3:32 am
languages_spoken: english
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Re: C2 not turning display power off after inactivity

Unread post by Piper64 » Tue Jul 26, 2016 4:35 am

Initially I got "Permission denied", even with sudo. I then right clicked on phy using (sudo) caja and changed ownership from root to odroid in the drop down menu, and enabled running it as a program. I then executed the command, which indeed blanked the screen with "No HDMI signal"! This is encouraging. The C2 was still active, showing the blue blinking LED, but I couldn't get the screen active again with the keyboard, and had to resort to disconnecting and reconnecting the power to the C2.

endecotp
Posts: 231
Joined: Sun May 08, 2016 12:30 am
languages_spoken: english
ODROIDs: c2
Has thanked: 0
Been thanked: 0
Contact:

Re: C2 not turning display power off after inactivity

Unread post by endecotp » Tue Jul 26, 2016 5:31 am

Piper64 wrote:Initially I got "Permission denied", even with sudo.
This is the standard prpblem that

sudo foo > xyz

doesn't do what you think it does. It does, in effect, ((sudo foo) > xyz), not (sudo (foo > xyz)).
and enabled running it as a program.
No. Don't do that. (Huh?)
I then executed the command, which indeed blanked the screen with "No HDMI signal"!.
Good, that is useful progress. As for why the script didn't work - you'll need to debug that!

Raybuntu
Posts: 1388
Joined: Mon Nov 30, 2015 4:23 pm
languages_spoken: english, german
ODROIDs: C1+, C2
Has thanked: 3 times
Been thanked: 16 times
Contact:

Re: C2 not turning display power off after inactivity

Unread post by Raybuntu » Tue Jul 26, 2016 6:15 am

Piper64 wrote:Initially I got "Permission denied", even with sudo. I then right clicked on phy using (sudo) caja and changed ownership from root to odroid in the drop down menu, and enabled running it as a program. I then executed the command, which indeed blanked the screen with "No HDMI signal"! This is encouraging. The C2 was still active, showing the blue blinking LED, but I couldn't get the screen active again with the keyboard, and had to resort to disconnecting and reconnecting the power to the C2.
Because you gotta use the script. I just wanned to see if the bare command is running. Looks like neither the script nor the ownership was set before properly. Please read my posts very carefully again. I know it sounds very complicated but currently it's the only way.

Piper64
Posts: 23
Joined: Mon Jun 27, 2016 3:32 am
languages_spoken: english
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Re: C2 not turning display power off after inactivity

Unread post by Piper64 » Tue Jul 26, 2016 9:37 pm

Thanks both.
Well, blow me down. I don't know what I've done differently but it works! Thank you so much for your patience.
Today I just ran the three commands "sudo chown odroid /sys/class/amhdmitx/amhdmitx0/phy", "chmod +x aml_dpms.sh" and "./aml_dpms.sh". The monitor powered off at the appropriate time, and came on again immediately with keyboard/mouse input.

For anybody else wanting a solution to this, remember beforehand to put Raybuntu's script above in a text file named ".aml_dpms.sh" in your home directory, power management settings need to be set to "never" (yes, including for display) and screensaver needs to be activated.

I tried combining the three commands with && in an executable file but, as I'm sure you'd predict, that didn't work. Raybuntu you hinted that it may be possible to automate this with udev?

Raybuntu
Posts: 1388
Joined: Mon Nov 30, 2015 4:23 pm
languages_spoken: english, german
ODROIDs: C1+, C2
Has thanked: 3 times
Been thanked: 16 times
Contact:

Re: C2 not turning display power off after inactivity

Unread post by Raybuntu » Tue Jul 26, 2016 10:15 pm

OK follow this carefully. Not udev but I like to use systemd's tmpfiles for that kind of things:
Assuming your script is in /home/odroid/aml_dpms.sh

Create following file: /home/odroid/.config/autostart/aml_dpms.sh.desktop
With following content:

Code: Select all

[Desktop Entry]
Type=Application
Exec=/home/odroid/aml_dpms.sh &
Hidden=false
X-MATE-Autostart-enabled=true
Name[en]=aml_dpms
Name=aml_dpms
Comment[en]=
Comment=
Create following file: /etc/tmpfiles.d/hdmi.conf
with following content:

Code: Select all

z /sys/class/amhdmitx/amhdmitx0/phy 0222 - - - -
Then reboot...
Now you don't have to input any commands anymore.

Piper64
Posts: 23
Joined: Mon Jun 27, 2016 3:32 am
languages_spoken: english
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Re: C2 not turning display power off after inactivity

Unread post by Piper64 » Tue Jul 26, 2016 11:06 pm

That is magic! Many thanks indeed. As far as I'm concerned, the C2 is now the perfect silent desktop.

Raybuntu
Posts: 1388
Joined: Mon Nov 30, 2015 4:23 pm
languages_spoken: english, german
ODROIDs: C1+, C2
Has thanked: 3 times
Been thanked: 16 times
Contact:

Re: C2 not turning display power off after inactivity

Unread post by Raybuntu » Wed Jul 27, 2016 4:31 am

I'm happy you enjoy the hack. Hope we will be able to find a proper fix though.

endecotp
Posts: 231
Joined: Sun May 08, 2016 12:30 am
languages_spoken: english
ODROIDs: c2
Has thanked: 0
Been thanked: 0
Contact:

Re: C2 not turning display power off after inactivity

Unread post by endecotp » Wed Jul 27, 2016 8:03 am

Interesting question is whether monitors power down properly when the HDMI input goes away, and after what delay, compared to proper signalling.

Piper64
Posts: 23
Joined: Mon Jun 27, 2016 3:32 am
languages_spoken: english
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Re: C2 not turning display power off after inactivity

Unread post by Piper64 » Wed Jul 27, 2016 9:11 pm

I don't know if this answers your question endecotp, but 10 seconds after "No HDMI signal" is displayed the illumination behind the screen definitely shuts down and the power LED starts to blink at a low frequency. I haven't measured the drop in current but I'm quite happy that the screen power consumption is as low as it can get, short of turning it completely off. The screen is reactivated with no noticeable delay.

spyvsspy
Posts: 63
Joined: Fri May 06, 2016 5:15 am
languages_spoken: english
ODROIDs: C2 XU4
Has thanked: 0
Been thanked: 0
Contact:

Re: C2 not turning display power off after inactivity

Unread post by spyvsspy » Thu Aug 04, 2016 7:24 am

till we get a proper fix , here's how i used this method to make it automatic, (you can write it in any language u want)
just the basic logic :
set screensaver to floating gnome (or whatever u like , it doesnt matter)
read output from "ps x | grep /usr/lib/mate-screensaver" every few seconds
if u find the string, turn off the screen (and set some bool flags to remember state)
otherwise turn on , only 1 if should work at the time, i wrote my solution in c# , i guess a script will be more efficient :)

endecotp
Posts: 231
Joined: Sun May 08, 2016 12:30 am
languages_spoken: english
ODROIDs: c2
Has thanked: 0
Been thanked: 0
Contact:

Re: C2 not turning display power off after inactivity

Unread post by endecotp » Fri Aug 05, 2016 3:20 am

spyvsspy wrote:read output from "ps x | grep /usr/lib/mate-screensaver" every few seconds
if u find the string, turn off the screen (and set some bool flags to remember state)
otherwise turn on , only 1 if should work at the time, i wrote my solution in c# , i guess a script will be more efficient :)
Why do that rather than Raybuntu's dbus-monitor method shown above?

spyvsspy
Posts: 63
Joined: Fri May 06, 2016 5:15 am
languages_spoken: english
ODROIDs: C2 XU4
Has thanked: 0
Been thanked: 0
Contact:

Re: C2 not turning display power off after inactivity

Unread post by spyvsspy » Fri Aug 05, 2016 9:38 pm

i completely missed that!

Raybuntu
Posts: 1388
Joined: Mon Nov 30, 2015 4:23 pm
languages_spoken: english, german
ODROIDs: C1+, C2
Has thanked: 3 times
Been thanked: 16 times
Contact:

Re: C2 not turning display power off after inactivity

Unread post by Raybuntu » Sat Aug 06, 2016 2:53 am

Don't worry @spyvsspy. Keep up the good work. Just share your c# program.

spyvsspy
Posts: 63
Joined: Fri May 06, 2016 5:15 am
languages_spoken: english
ODROIDs: C2 XU4
Has thanked: 0
Been thanked: 0
Contact:

Re: C2 not turning display power off after inactivity

Unread post by spyvsspy » Sat Aug 06, 2016 6:40 am

@raybuntu , here's my lame solution (mono console app)

Code: Select all

	class OdroidScreenOff
	{
		static private Process process;
		static private int Timer_Interval = 7;  // in seconds
		static bool SCREEN_ON = true;
		static bool SWITCHED_STATE = false;

		public static void Main (string[] args)
		{
			while (true) {
				
				string data = RunBashProcess("-c \"ps x | grep screensaver\"",true); // sanpling process list
				bool SCREEN_SAVER = data.Contains ("/usr/lib/mate-screensaver/");	 // looking for mate-screenshot sub bin

				if (!SCREEN_SAVER && SWITCHED_STATE) {
					SCREEN_ON = true;
					SWITCHED_STATE = false;
					RunBashProcess("-c \"echo 1 > /sys/class/amhdmitx/amhdmitx0/phy\"",false);
					//Console.WriteLine (DateTime.Now+"\tturned on screen.");
					continue;
				}
				if (SCREEN_SAVER && SCREEN_ON) {
					SCREEN_ON = false;
					SWITCHED_STATE = true;
					RunBashProcess("-c \"echo 0 > /sys/class/amhdmitx/amhdmitx0/phy\"",false);
					//Console.WriteLine (DateTime.Now+"\tturned off screen.");
					continue;
				}
				//Console.WriteLine (DateTime.Now+"\tsleeping...");
				Thread.Sleep (Timer_Interval * 1000);
			}
		}
		private static string RunBashProcess(string args,bool redirectOutput)
		{
			string output = "";
			process = new Process () 
			{
				StartInfo = new ProcessStartInfo () 
				{ 	
					UseShellExecute = false,
					WindowStyle = ProcessWindowStyle.Hidden,
					RedirectStandardOutput = redirectOutput,
					FileName = "/bin/bash",
					Arguments = args						
				}
			};
			try
			{		
				process.Start();
				process.WaitForExit();
				if(redirectOutput)
				{
					while (!process.StandardOutput.EndOfStream) 
					{
						output += process.StandardOutput.ReadLine ();
					}
				}
				return output;
			}
			catch(Exception e)
			{
				Console.WriteLine ("Error: " + e.Message);
				return output;
			}
		}
	}

jhl
Posts: 1
Joined: Sun Feb 12, 2017 8:32 pm
languages_spoken: english
ODROIDs: C2
Has thanked: 0
Been thanked: 0
Contact:

Re: C2 not turning display power off after inactivity

Unread post by jhl » Sun Feb 12, 2017 8:33 pm

I believe the "monitor_onoff" setting in boot.ini is what you are looking for - set it to true. I wonder why it's not on by default?

User avatar
odroid
Site Admin
Posts: 33649
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English, Korean, Japanese
ODROIDs: ODROID
Has thanked: 500 times
Been thanked: 504 times
Contact:

Re: C2 not turning display power off after inactivity

Unread post by odroid » Mon Feb 13, 2017 10:52 am


Post Reply

Return to “Issues”

Who is online

Users browsing this forum: No registered users and 1 guest