Re: Advice on automated text processing script
On Fri, Nov 09, 2007 at 10:05:49AM -0800, Amit Uttamchandani wrote:
> > Yes there is a package for python that will access a serial port. No I
> > haven't tried it.
> Thanks I will try and search for it.
> > You you need to both script and interact? I'm not sure what you mean by
> > scrpt. Do you just want to log whatever comes in on the serial port?
> I guess interacting would be great. But yeah I pretty much want to log
> whatever that comes in and process it. What I mean by this is look at
> the values obtained and compare it to expected values.
> I am pretty much trying to automate the testing of this device.
I do this sort of thing all the time, and there are lots of approaches.
Check out "expect", which aims to automate interactive things. I'm using
perl's Expect module for this, and either cu or nc (netcat) to handle the
serial port itself. Expect (either flavor) wraps itself around some process,
then allows you (your script) to send stuff to the session and to "expect"
certain things from it, fixed strings or regular expressions, and to take
actions depending on the result.
Ken Irving, firstname.lastname@example.org