Hi Cory,

On Mon, Aug 20, 2018 at 05:21:38PM +1000, luv-main wrote:
> Hi Cory.
>
>
>
> I note the "-clocal" which is telling stty to honor the
> modem control signals, and I'm not sure what state "raw"
> leaves the "crtscts" and "cdsrdsr" options in.
> It couldn't be something as silly as CTS/RTS, DSR/DTR flow
> control doing its thing could it?
>
>
>
> Without knowing what signals are in use on the interface,
> I can't guess what may or may not be critical.
>
>
>
> The signals may be jumpered into a fixed state, required,
> or not even present.
>
You can set these in the Tcl "open" command you are using by e.g.

   open -handshake rtscts|none|xonxoff

in your script line

   spawn -open [open $modem w+]

See *man n open*
>
>
> An RS232 tester could also prove useful in dignosing the issue.
>
> (The ones with the dual colour LEDs for the the various pins.
>
> They are not as common as they used to be, but they should
> still be a part of the toolbox for anyone that needs to deal
> with older RS232 technologies. Amazon show a couple of options
> including one that is a USB to Serial adapter with built-in LEDs,
> but that one doesn't have the two colour LEDs, so only tells
> half the story.)
>
>
>
> Morrie.
>
>
>
> From: luv-main [mailto:[email protected]] On Behalf Of cory 
> seligman via luv-main
> Sent: Monday, 20 August 2018 10:30 AM
> To: luv-main
> Subject: expect script
>
>
>
> Hi All,
>
>
>
> I'm having some trouble making expect work.
>
>
>
> I need it to talk to some vintage equipment over usb serial, and I think I'm 
> getting hung up on opening the port.
>
>
>
> When the script runs, it just connects to the device and sits there. I can 
> drive it interactively, but it doesn't attempt to automate anything.
>
>
>
> Any ideas? Thanks.
>
>
>
> My expect script looks like this:
>
>
>
> #!/usr/bin/expect -f
>
> # device
> set modem /dev/ttyUSB0
>
> # keep it open
> exec sh -c "sleep 3 < $modem" &
>
> # serial port parameters
> exec stty -F $modem 2400 raw -clocal -echo -istrip -hup
>
> # connect
> send_user "connecting to $modem, exit with ~,\n"
> spawn -open [open $modem w+]
> interact {
>     ~, exit
>     ~~ {send "\034"}
> }
>
> set force_conservative 1 ;# set to 1 to force conservative mode even if
>               ;# script wasn't run conservatively originally
> if {$force_conservative} {
>     set send_slow {1 .1}
>     proc send {ignore arg} {
>         sleep .1
>         exp_send -s -- $arg
>     }
> }
>
> set timeout -1
> match_max 100000
> send -- "\r"
> send -- "\r"
> expect  ">"
> send -- "p 7d91\r"
> expect  ">"
> send -- "p b2ff\r"
> expect  ">"
> send -- "h\r"
> expect  ">"
> send -- "td\r"
> expect "td\r
>   18 215  12  24  33\r
> >"
> send -- "gd 215\r"
> expect eof
>
>
>
>
>

> _______________________________________________
> luv-main mailing list
> [email protected]
> https://lists.luv.asn.au/cgi-bin/mailman/listinfo/luv-main


--
 Please avoid sending me Word or PowerPoint attachments.
 See http://www.gnu.org/philosophy/no-word-attachments.html

Cheeers ... Duncan.
_______________________________________________
luv-main mailing list
[email protected]
https://lists.luv.asn.au/cgi-bin/mailman/listinfo/luv-main

Reply via email to