Question

I want to work with a modem interfaced on a serial port on an embedded platform.
Here are some solutions I have rejected so far :

  • Expect plus a terminal program :
    My (cross)build system does not have any package rules for expect, and according to the installation instructions from the expect sources, the configure script needs to be interactive because it does some test with the terminale it is invoked in. Thid does not look like something you want to do when cross compiling.

  • Python plus pyserial : I would love to use this, but the size of the whole thing won't fit on my limited flash space.

  • Chat (from the pppd package): Well, I may give it a try but it is very, very limited

So I am looking for some sort of lightweight, embeddable expect replacement. I have no knwoledge of lua. Would it be a good candidate for expect like scipting ?

Was it helpful?

Solution

Well, Expect is just Tcl plus extensions to drive other programs via pseudo-terminals and do pattern-matching on the results. If you just want to drive a serial port you can drop the external terminal program and have Tcl drive the serial port directly - see sample code. See also the Tcl Wiki page on cross-compiling.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top