Hi, On Sat, 2007-03-24 at 07:17 -0400, Mr. Bill wrote: > On Wed, 2007-03-21 at 09:22 -0500, Ted Phelps wrote: > > > > > Don't tip/cu have any way of logging output to a file? Certainly > > minicom does and I've used it in precisely the situation you describe. > > > > No, cu(1) doesn't. When I first started using cu(1), I spent quite a bit > of time looking for that elusive "serial output capture" option (manual, > internet, /usr/share/doc,..). In the end I found out that I could simply > redirect cu(1)'s output via the shell. So when it comes to cu(1), > mainatainers should really stop using terms like "logging" and > "capturing", and use "redirection" instead. That would be much clearer, > and much les intimidating to "newbies". A simple example also wouldn't > hurt: > > # cu -l /dev/tty00 -s 19200 | tee soekris.out >
I caught quite a lot of heat after posting this message, so I decided to try things out and see exactly what does and doesn't work. Here are my findings so far. Should be of interest to a few Soekris users. Bill Capturing output from the serial console ---------------------------------------- There are various ways to capture cu(1)'s output to a file. The "official" way is to set the "record" (abbreviated: rec) internal variable after starting cu(1). This holds the name of a file to write the output to. Then recording is started with the "script" (sc) variable. The "beautify" (be) variable can be used to suppress output of control characters, _to an extent_. Variables are set using the "~s" escape, which is immediately converted to a "~[set]" prompt. Entering "all" after the prompt will make cu(1) show the current state of all internal variables. # cu -l /dev/tty00 -s 19200 Connected ~s <------------ user input, converted to a prompt ~[set] all beautify baudrate=19200 dialtimeout=60 eofread= eofwrite= eol= escape=~ exceptions= force=^P framesize=1024 host=cu19200 log=/var/log/aculog phones= prompt=^J !raise raisechar= record= remote= !script !tabexpand !verbose SHELL=/bin/ksh HOME=/root !echocheck disconnect= tandem linedelay=0 chardelay=0 etimeout=0 !rawftp !halfduplex !localecho parity=none !hardwareflow linedisc=0 direct ~s[set] be ~s[set] rec=soekris.out ~s[set] sc The file is created if it doesn't already exist. If it does, it is overwritten. The output looks rather compressed, and may be difficult to read. An alternative is to use shell rdirection: # cu -l /dev/tty00 -s 19200 | tee soekris.out This will make cu(1) write to a file named "soekris.out" as well as to standard output. See tee(1). The resulting layout is more representative of the actual screen layout. It still contains end-of-line characters and a few others (shown in vi as ^M etc.), but after these have been removed it will look pretty neat. Using script(1) will result in something similar: # script soekris.out # cu -l /dev/tty00 -s 19200 In both cases, setting the "beautify" variable makes no difference. > _______________________________________________ > Soekris-tech mailing list > [email protected] > http://lists.soekris.com/mailman/listinfo/soekris-tech > _______________________________________________ Soekris-tech mailing list [email protected] http://lists.soekris.com/mailman/listinfo/soekris-tech
