ttyinittab

Using different console for respawn process in inittab on embedded device


I am connected on my embedded device with the serial port and would like to start my custom binaries on boot and be able to see the output generated.

My /etc/inittab file contains:

console::respawn:/sbin/getty -L 115200 ttyAPP3 vt100
console::respawn:/usr/bin/mybinary

With this configuration, I can see the output of mybinary in the serial console but It is difficult/impossible to connect (insert login and password) to getty because of the interference of the output generated.

I tried to switch the output in inittab to another not used tty (tty10) like this:

console::respawn:/sbin/getty -L 115200 ttyAPP3 vt100
tty10::respawn:/usr/bin/mybinary

And now I can connect but how can I see the output generated to /dev/tty10 ?

I tried cat /dev/tty10 but nothing is shown.


Solution

  • I know the question is old, but it has no answers at all for crying out loud.

    Remember that a TTY is both an output device and also an input device -- by cat'ing from it you're reading input from the terminal which means the keyboard, NOT the screen.

    I don't know if there's a parallel in other *nixes, but Linux systems have /dev/vcsX and /dev/vcsaX character devices (nodes c,7,0+X and c,7,128+X respectively) for each /dev/ttyX device - these are mirrors of the data currently on the output of the TTY device (ie. the screen part of the TTY, not the keyboard part). These will give you what you're looking for. The vcsaX devices will give you a displaybyte+attributebyte pair (i.e. the foreground/background text colour -- see other references for more information on text attribute bytes) for each character on the screen, while the vcsX devices give only the displaybyte for each character. Of course it's a raw stream/dump so if the row and/or column count of your terminal doesn't match that of the the TTY you're dumping then you'll need to parse the data and reformat it to match.

    tl;dr: use "cat /dev/vcs10"

    Hope that helps.