17

Avoiding installing anything or rebooting, how can I "wake" the TTY1 display via SSH? None of the suggestions (Stopping Raspberry Pi display sleep) worked on my running Pi.

From what I have read trying to get an answer, these would work if I rebooted, which I am trying to avoid.

rob
  • 2,803
  • 2
  • 21
  • 31

5 Answers5

19

So after a lot of googling I found the codes that setterm should be sending to the tty and these two command unblank the screen every time.

sudo chmod 666 /dev/tty1
echo -ne "\033[9;0]" >/dev/tty1

The only reason I can think of all the other commands (that should have worked) failing was because the Pi is connected via svideo to a tv and not HDMI or a monitor.

rob
  • 2,803
  • 2
  • 21
  • 31
5

http://www.winds.org/pub/grdl/ANSI.txt

ESC[9;#] is to set the timeout for screen blanking. If you want to leave the timeout value alone, then use ESC[13] to unblank a screen.

So, depending on your shell (I use tcsh) a simple echo would be

echo -n "\e[13]" > /dev/tty1

Using the above example

echo -ne "\033[13]" > /dev/tty1

I saw no need to chmod 666 /dev/tty1 first. But I run as root (because I trust my abilities).

Anthony
  • 51
  • 1
2

I've probably answered this before, here or somewhere... but no worries...

Try:

setterm -blank poke

should unblank the screen from a login, BUT... usually you need to send the appropriate codes to /dev/tty1, not the /dev/pty/X you're using as an ssh user... thus:

setterm -blank poke | sudo tee /dev/tty1 > /dev/null

This sends setterm's output (magic codes!) to the proper terminal to wake it up as you desire. Since I do this often, and use other options too, I made a little script I call 'tty1'

#!/bin/bash
#
# send 'setterm' commands to /dev/tty1 (physical console)
setterm $* | sudo tee /dev/tty1 > /dev/null

Which I use like this:

tty1 -reset -cursor off

This command resets/clears the screen, returning to text mode and turns off the blinky cursor. handy when I don't want the distraction.

tty1 -blank poke

Would wake up the screen. (Well, should... works for me(tm))

(Do remember that you'll need to either set up nopasswd access to sudo, or be prepared to type the root password when you use this command)

But wait! If you call now! We'll include this gem: How to remove the need to supply a password for sudo usage! Operators are standing by!

Add this line to a file named "no-sudo-passwd-for-pi" (no dots allowed!) in /etc/sudoers.d/

pi ALL=(ALL) NOPASSWD: ALL

This will cause the user 'pi' to not require a password for ANY sudo invocation. BEWARE! This can be considered a security risk. Balance your need for this usage against the potential risks involved. (see man sudoers)

lornix
  • 1,066
  • 8
  • 13
  • Unfortunately that did not work even when run with sudo. I wonder if it matters that I am using the svideo out and not hdmi. – rob Oct 30 '13 at 20:21
2

To avoid a chmod, you can just use sudo tee to write to the console:

echo -ne "\033[9;0]" | sudo tee /dev/tty1
Will
  • 373
  • 3
  • 16
0

I had this problem after exiting XBMC and going back to console screen: everything stayed black.

I solved this by calling once /usr/bin/xinit

lauhub
  • 334
  • 3
  • 8