Wednesday, December 17, 2008

Kermit Scripting

In embedded systems development, kermit is commonly used to communicate to boards through serial port. Many of interactive dialog sessions between user and board can be automated using kermit scripts. If kscript is a file containing a kermit script it can be run by the following command "kermit -y kscript"

Here are some very useful kermit scripting commands

Basic interaction

To wait for a particular prompt and then issue a command
input 1000 bash$
lineout ls
Will wait for the prompt "bash$" to appear and then issue the "ls" command to board through serial port
minput <timeout> <s1> <s2> ...
Used to Wait for any of the given string
minput 1000 bash$ >


First, define some variables
define delay 1000
define prompt bash$
define command ls
And use it
input \m(delay) \m(prompt)
lineout \m(command)

And when finally you are finished use
exit 0 "Over and out"

To add timestamped logging to kermit

set session-log timestamped-text
log session kermit-log.txt

No comments: