3

I have a raspi and it has no mouse or keyboard. But I have connected a Hardware-screen on it. And what I want is to connect via ssh or telnet to it, and see on the Hardware-screen what I am typing via ssh.

normally I use screen and attach to it with screen -x but that's not possible now because I have no keyboard attached to it.

Is there any way I can connect the tty1 to the ssh session ?

UPDATE1 , after I chmoded the tty1 for everybody writebale with

sudo chmod 666 /dev/tty1

I am able now to send messages to it like

echo "message" > /dev/tty1

There are still 2 problems. 1) I cant send "Enter", and 2) I do not see the feedback on my ssh screen.

1
  • 1
    hexdump -C /dev/vcs1 should show you the content of /dev/tty1.
    – ott--
    Commented Jun 22, 2016 at 17:09

1 Answer 1

3

You can run something like screen or tmux on the console, then connect to it. You can accomplish this by setting things (with raspi-config) to automatically log you in on the console and not start the GUI, and having the following as the last line in your .bashrc:

[[ $(/usr/bin/tty) == "/dev/tty1" ]] && exec /usr/bin/screen

You can then run screen -x from your ssh session. Several things to note:

  • you will be a lot happier if the window size of whatever you are sshing from is the same as the console screen size (which you can see by running stty -a < /dev/tty1). Exactly what it is depends on what font you are using for the console.
  • You will still not be able to see any messages printed by the kernel to the console (but you can see them with sudo cat /dev/vcs1).
  • Check the manual for screen on how to adjust sizes, etc.

If you are really ambitious, you can write your own code that continously reads from /dev/vcs1, and "types" onto the console by using TIOCSTI.

4
  • what exactly is [[ $(/usr/bin/tty) == "/dev/tty1" ]] && exec /usr/bin/screen doing?
    – Max Muster
    Commented Jun 23, 2016 at 18:30
  • 1
    You only want to run this for the shell that starts on tty1. Is there any other way to interpret it?
    – JayEye
    Commented Jun 24, 2016 at 1:46
  • I added [[ $(/usr/bin/tty) == "/dev/tty1" ]] && exec /usr/bin/screen to .bashrc and found out that your solution is almost good, the problem is nobody is pressing the final "Space Key or Return to start the screen". The second problem is after some minute or two the screen turns black and I can't wake it up any more
    – Max Muster
    Commented Jun 25, 2016 at 13:09
  • 1
    fix the power settings so that the screen never turns blank.
    – JayEye
    Commented Jun 26, 2016 at 21:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.