Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] insert blocking only on serial port?

From: petr::krenzelok::trz::cz at: 10-Jun-2002 20:21

Hi, I am trying to write small util for our device. I am trying to figure out what port is our device connected to in an automatic way .... foreach [port port-number] our-ports [ print ["Opening port: " port] either error? try [p: open/no-wait join serial://port reduce [port-number "/19200/8/none/1"]][ print ["Error opening port ..." port "."] ][ p/timeout: 2 update p print ["Port " port " opened successfully ..."] print "Talking to device ..." insert p "1" either found? find copy p "somestring" [ print ["Device found on " port "port."] ][ print ["Different device on port " port] print ["Closing port " port "."] close p ] ] ] ; end foreach the problem is however with the 'insert part. While copy, first, pick works like it should work - e.g. timeouts if no data available, or just returns immediatelly if /no-wait is used, 'insert hangs port forever ... I know there can be problem sending some string to unknown device being connected to serial port, as we can't know what the device will/can do to our request, but shouldn't it at least time-out? Or is that just correct, assuming that device waits for more data? If so - how to do automatic device look-up then? Thanks a lot, -pekr-