[REBOL] Re: serial port observation ... the last call ...
From: amicom:sonic at: 1-Jul-2002 12:40
Gordon and Petr,
Here is a function I wrote that does the trick for me. I hope it helps you
(beware of line-wrapping):
connect-mpps: has [err ports tmp][
err: true
foreach port ports: [port1 port2 port3 port4 port5 port6][
if not error? try [
mpps: open/direct/no-wait rejoin [serial:// port "/19200/8/none/1"]
][err: false break]
]
if err [
view/new tmp: layout [
text "Unable to open any serial connections"
button "OK" [quit]
]
wait 30
unview/only tmp
return false
]
mpps/rts-cts: off
update mpps
true
]
I had the same behavior as Petr with REBOL not returning until I defined the
ports for each machine individually using system/ports/serial. I normally
put this in the user.r file.
I suppose you could access the system via libraries (if you are using View/Pro)
to determine which COM ports are installed on the system.
An idea if you need the hardware handshaking: Perhaps you could scan with
handshaking off and once you find your device, turn handshaking back on.
-Bo