> I have been using the cu program in an expect script to poll various
> devices. The typical script looks like this:
> ...
> ------------------------------
> #!/usr/bin/expect
> spawn /usr/bin/cu -s9600 -lttyS3
> expect "\007"
> send "\001$argv"
> expect "\003"
> send "\~."
>
> BUT, cu does not always work as expected. For some devices I can connect
> with cu from the command line and it works great, but will not work from the
> expect script. Other times the expect script will run perfectly from the
> command line, but will give no output when run from cron.
> 
> I have also tried kermit and minicom and have problems simular to cu. For
> some devices minicom works where cu will not. I have simply not spent the
> time to learn kermit scripting as it seems like massive overkill for what I
> need to do.
> 
> I am not a very experianced C programmer and the cu program is really
> overkill for my needs. I will glady pay a reasonable fee to anyone who can
> write me a simple terminal program. what I really want is a very simple
> terminal program that lets me specify simple line parameters such as baud,
> tty device, bits, parity, etc. with no other features to clutter up the
> code.
> 
Here's the Kermit equivalent of your cu script, assuming you have installed
C-Kermit 7.0:

  http://www.columbia.edu/kermit/ck70.html

in /usr/local/bin.  Give the following script +x permission:

---(cut here)---
#!/usr/local/bin/kermit +
set modem type direct
set line /dev/ttyS3
if fail exit 1 {/dev/ttyS3: \v(setlinemsg)}
set speed 9600
set flow none       ; Replace by "Xon/Xoff" or "RTS/CTS" as appropriate.
input 600 \07       ; Timeout period = 10 minutes - change as desired.
if fail exit 1 {Timed out waiting for BEL}
output {\01<xxx>}
input 60 \03        ; Timeout period = 60 sec - change as desired.
if fail exit 1 {Timed out waiting for ETX}
exit 0
---(cut here)---

And then run it as if it were a shell (or expect) script.

The only part I didn't translate was "$argv" -- I'm not sure what that's
supposed to be.  Here are some possibilities; replace <xxx> by:

  The first command-line argument:  \%1
  The second command-line arg:      \%2
  (etc)
  All command-line arguments:       \%*

Give it a try.  If you have trouble, send your questions to:

  [EMAIL PROTECTED]

- Frank

-
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to [EMAIL PROTECTED]

Reply via email to