in reply to serial console

If talking to your device involves sending a command and waiting for any of several different responses... or a timeout... I would try Expect. It is almost always easier than home-brewing your own logic for figuring out which state the wretched device has wandered into this time. Expect can talk to any program that has a conventional interactive interface. Most people spawn a telnet or ssh session, but you could use Expect to drive minicom. I think that it is also possible to use Expect->exp_init(\*FILEHANDLE) to connect directly to a Linux tty port, but I haven't had a chance to try it.

Replies are listed 'Best First'.
Re^2: serial console
by pileofrogs (Priest) on Aug 15, 2007 at 16:47 UTC

    I tried that. Apparently, Expect doesn't provide cursor control and that freaks out minicom.

    Does anyone know a way to:

    1. make Expect provide cursor control (or the illusion thereof)
    2. make minicom Ok without cursor control
    3. find an alternative to minicom that doesn't require cursor control (needs to run on linux).

      Actually, it's minicom that would be doing cursor control, by sending the escape sequences for whatever kind of terminal it thinks you are using. You might need to specify a valid terminal type in the environment, $ENV{TERM}="vt100" or "xterm" for instance. Ordinarily you can ignore the escape sequences coming back and look for printable characters that act as prompts. When you send to minicom, you would send exactly the same characters that would be sent by the keys you would press if you started minicom by hand.