Jump to content

Screen Wakeup Hack/Workaround


mosx
 Share

18 posts in this topic

Recommended Posts

First this was tested on a Dell Latitude d820 & d620 running Kalyway 10.5.2 and iAtkos 2.0i (10.5.2) respectively. TThis also works for Latitude d620's. Both had Nvidia 120M graphics running NVInject. I haven't tested it on any other systems. This might also work with 10.4 systems. Even though this really can't break anything, I'm not responsible if this causes any damage to your system, yourself, your pets, or any other property. Use at your own risk.

 

Problem: Display goes to sleep and won't come back. Moving the mouse makes the screen brighten like it has returned but the screen is still black.

 

Solution: I noticed that changing the screen resolution and then changing it back makes the screen return. You can easily test if this hack/workaround will work for you. Here's how.

 

Open up your Display properties, click your screen resolution to highlight it. Now wait for the screen to sleep (I recommend setting it to sleep the display after 1 minute to speed this up). Now once the screen goes blank move your mouse, it should brighten but still be black. Hit the up arrow on your keyboard, it should change the screen resolution and return the screen. If that worked, this hack will work for you.

 

All we're going to do is change the screen resolution and then change it back when the wakeup command is sent. For that we need 2 packages. (link to zip below)

 

Cscreen - command line utility to change the screen resolution

 

Sleepwatcher - command line daemon to execute commands on sleep or wakeup (highly configurable)

 

The installation instructions are also included in the zip file. I've pasted them here for reference. Sorry if my instructions are hard to follow, if you can write a better set please do.

 

##################

 

OSx86 Monitor Refresh Workaround.

 

If your notebook goes to sleep and wakes up properly but the monitor doesn't come back this is for you. If your computer won't return from sleep or you have other sleep related issues this is NOT for you.

 

I found that changing the screen resolution actually wakes up the screen. This package just runs a command line app (cscreen) on wakeup to change the screen resolution back and forth to refresh the display.

 

 

1. Double click cscreen.dmg. Move the cscreen binary to /usr/bin. From the terminal

sudo -s

<enter password>

mv /Volumes/cscreen/cscreen /usr/bin

chown root:wheel /usr/bin/cscreen

chmod 755 /usr/bin/cscreen

 

2. Double click sleepwatcher_2.0.5.dmg. Install sleepwatcher.pkg and SleepWatcher StartupItem.pkg

 

3. In terminal, we need to modify the startup item for sleepwatcher.

 

sudo -s

<enter your password>

nano -w /Library/StartupItems/Sleepwatcher/Sleepwatcher

 

Scroll down to line 18, it looks like this:

/usr/local/sbin/sleepwatcher -d -V -s /etc/rc.sleep -w /etc/rc.wakeup

 

Change it to look like this:

/usr/local/sbin/sleepwatcher -d -V -s /etc/rc.sleep -W /etc/rc.wakeup

 

** NOTICE: The only change is changing the lower case 'w' to an uppercase 'W' **

 

Scroll down to line 28 (it's identical to the one above) and do the same thing.

 

Save and exit

 

4. Next we need to make the wakeup file for sleepwatcher to use

 

nano -w /Users/YOUR-USER-NAME/.wakeup

 

Substitute YOUR-USER-NAME with your home folder name.

 

In .wakeup put this:

 

#Begin wakeup script

#!/bin/bash

cscreen -d 16 -x 1680 -y 1050 && cscreen -d 32 -x 1680 -y 1050

#End wakeup script

 

cscreen is a command line utility to change screen resolutions, all we need to do is get it to refresh the screen. We can do that easily by just changing it from 32bit color (Millions of colors) to 16bit (Thousands of colors) and back to 32 bit again. Substitute your screen resolution after the -x and -y flags, leave the -d flag alone. (Mine was 1680x1050)

 

Save and exit.

 

5. the .wakeup file has to be executable.

chown root:wheel /Users/YOUR-USER-NAME/.wakeup

chmod 755 /Users/YOUR-USER-NAME/.wakeup

 

6. Thats it you're done. If everything was done right it should work. You can test this by setting the display sleep time to 1 minute and then wait for the display to turn off. If everything was done right when you move the mouse your screen should flicker a little and then come back.

 

 

Issues:

The screen flickers for a moment and then returns while it swaps resolutions, not a big deal really. It also does the flicker/refresh on boot because the daemon launches the script on boot. This is just a minor annoyance really and is hardly noticeable.

 

Final Thoughts:

If anyone cares to clean this up, improve it, turn it into a package go for it. Its not very elegant but it works. Sleepwatcher is highly configurable and can execute all sorts of commands on sleep, wake up, display wake up, display sleep, etc .. You could probably pair this with a nice clean applescript that does the same thing cscreen does. I hope someone smarter than me comes up with a more elegant solution.

 

- mOSX

mosx_displaypackage.zip

Link to comment
Share on other sites

  • 1 month later...

hey man,

thanks alot, ive been searching for similar workaround FOREVER...it works fine, but the flickering is not very nice...

 

well i tried editing .wakeup file and putting only the 16 bit part, it doesnt flicker of course, but then u dont get nice colours, also if u then put the screen back to sleep the workaround wont work coz the screen setting is same as the workaround file.

 

the thing that i dont like is that this script has to work on boot and on wake from sleep, is there a way to prevent that and only work on screen wake???

Link to comment
Share on other sites

  • 3 months later...
  • 2 weeks later...

on wake as suggested by hecker in this thread does not seem to work for the Dell blank screen problem. The reason being is the on wake program only works when the device wakes up from sleep. The Dell screen problem happens both when the screen goes blank and when returning from sleep too.

Link to comment
Share on other sites

  • 2 months later...
  • 2 months later...

First thanks for this workaround and for people, like me, who are annoyed by all the unnecessary flickers when starting the laptop, waking up "system" sleep or getting rid of screensaver, here is how i worked around it and made sure that only display wake changes the resolutions.

 

Note that I am lazy and I used the instructions but modified it with my steps.

So the idea is that, wake in sleepwatcher is reacting on any of the above events which is causing all the unnecessary flickers, however the sleep display function was acting correctly only on when the display sleep, so my solution was creating a "boolean flag" when the real sleep happens, the flag is an empty file, now when the wake execute the script, it checks the flag to make sure this is a real sleep and based if the file exists or not it changes the resolution.

 

1) follow the steps mentioned in the main post and make sure you get it working

2) In terminal, we need to modify the startup item for sleepwatcher.

 

sudo -s

<enter your password>

nano -w /Library/StartupItems/Sleepwatcher/Sleepwatcher

 

Scroll down to line 18, it looks like this:

/usr/local/sbin/sleepwatcher -d -V -s /etc/rc.sleep -W /etc/rc.wakeup

 

Change it to look like this:

/usr/local/sbin/sleepwatcher -d -V -S /etc/rc.sleep -W /etc/rc.wakeup

 

** NOTICE: The only change is changing the lower case 's' to an uppercase 'S' **

 

Scroll down to line 28 (it's identical to the one above) and do the same thing.

 

Save and exit

 

3) Next we need to make a sleep file for sleepwatcher to use

 

nano -w /Users/YOUR-USER-NAME/.sleep

 

Substitute YOUR-USER-NAME with your home folder name.

 

In .sleep put this:

 

#!/bin/bash

touch sleepdate

 

 

Save and exit.

 

4) the .sleep file has to be executable.

chown root:wheel /Users/YOUR-USER-NAME/.sleep

chmod 755 /Users/YOUR-USER-NAME/.sleep

 

 

5) change the .wakeup to look like this

 

#!/bin/bash

if [ -f ~/sleepdate ]

then

cscreen -d 16 -x 1440 -y 900 && cscreen -d 32 -x 1440 -y 900

rm -f ~/sleepdate

fi

 

6) restart and you should be gold

Link to comment
Share on other sites

  • 3 weeks later...
  • 1 month later...

I seem to have a weird problem with this. My screen comes back but when it comes back it says I need to restart the computer. So I have to hold down the power button and restart, weird. Anybody know any solution for this. I am going to try and play a bit with it.

Link to comment
Share on other sites

I seem to have a weird problem with this. My screen comes back but when it comes back it says I need to restart the computer. So I have to hold down the power button and restart, weird. Anybody know any solution for this. I am going to try and play a bit with it.

 

Anybody know anything about this.

Im on my 36th Install. Almost everything is worked out. Except

 

Wifi 3945 - Buying Dell Wireless Card to replace

Return from Sleep - Blank screen - This thread

Mouse Artifcats - Kinda annoying looking for fix but if not I will not be too said.

Link to comment
Share on other sites

Awesome....now with reinstall I get a kernel panic everytime. I mount cscreen.dmg.....wow thats odd. Well time for 40th reinstall.

EDIT: Back to square one. Fresh install....follow directions exactally. But it doesnt do anything.

 

EDIT: I don't get why it won't work it worked once before but I was using - "w" not - "W" but it then gave me kernel panic. So I was forced to restart. I am going to try now with lowercase -w's

 

EDIT: This is what I believe is happeneing. When my computer wakes from sleep mode I think it has a kernel panic but I can't see it because the screen is blank and it cannot executes any commands or something like that. Because when I press the button to awaken from sleep mode it disables my keyboard or something.

Link to comment
Share on other sites

  • 2 months later...

Another real simple solution:

 

Press power button on your computer, this will popup a screen on which you can choose shutdown, sleep etc. (not visible ofcourse because screen is still in stanby).

Press letter S (for standby). The PC will go standby

Press any key to wakeup computer

 

et voila, the screen wakes up.

 

ps> still searching for a real solution though.

It seems that the nvidia driver is putting the screen to standby whatever setting I choose in power savings.

The timeout is large, my OSX will first enable the screensaver and if I wait a lot longer it will go to standby.

Link to comment
Share on other sites

  • 8 months later...
  • 6 months later...
I confirm mosx' approach with danillll's mods working perfectly in 10.6.3 with a GeForce 7600 Go in 32 bit mode.

 

Since this is working so good (WakeFix isn't) I greatly simplified the installation and also reflected that in the instructions.

 

Improved package attached.

Hey BugsB, your perfect package works great, I had keystroke combination before but this is so much better, even screen wakeup from touchpad works, thanks a million !

 

thanks to mos'x and danilll too

cheers

s

Link to comment
Share on other sites

  • 1 year later...

Hey BugsB, your perfect package works great, I had keystroke combination before but this is so much better, even screen wakeup from touchpad works, thanks a million !

 

thanks to mos'x and danilll too

I confirm mosx' approach with danillll's mods working perfectly in 10.6.3 with a GeForce 7600 Go in 32 bit mode.

 

Since this is working so good (WakeFix isn't) I greatly simplified the installation and also reflected that in the instructions.

 

Improved package attached.

 

 

Can someone help me with this? I'm trying to run install from CSreeen and I will get an message saying that the document ".wakeup" could not be opened. You don't have permission.

Link to comment
Share on other sites

 Share

×
×
  • Create New...