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

[REBOL] Re: Automation, Robotics?

From: holger:rebol at: 14-Mar-2001 11:04

On Tue, Mar 13, 2001 at 10:52:37PM -0800, David Hawley wrote:
> The defaults are [ ser0 ser1 ] which will be useless in most cases.
The defaults depend on the operating systems, and are usually useful. For operating systems which provide an API to query which serial ports exist, that API is used to set the defaults. Otherwise a reasonable OS-specific default is used. Depending on the particular OS version and build (and for Linux, the package) the ports still may not match your setup though.
> Although striping the /dev prefix is somewhat handy it at first seemed limiting in QNX where a serial port on another node has a node number or name in front of /dev. ie: //4/dev/ser5 refers to serial port 5 on node 4 and can be opened accross the net just like /dev/ser1 on whatever the local node is. Fortunately, QNX allow one to symbolic link (prefix) a remote node into the local namespace. One could thus prefix //4/dev/ser5 -> /dev/ser4.5 and open ser4.5 using REBOL - so REBOL does not to be QNX net aware to benefit.
At the moment REBOL does not directly support any QNX-specific features. It accesses QNX through standard Posix functions, which is why any QNX-specific extensions to the serial mechanism (or other features) probably won't work. This is also why some users have problems setting the baud rate from REBOL in QNX. Apparently some versions of QNX have some bugs in their Posix emulation code. This is not a bug in REBOL. The same code works fine for "regular" Unix flavors.
> The crazy thing that REBOL does is make you open the port with a path name serial://port[N] where N is the index? of the port name in system/ports/serial. Thus in serial-path-to above, I find the index? or append the passed name and use the length? to get port[N]. Of course, REBOL then has to change this back into an open( "/dev/serX", ..) so to me it would make sense to use the port name instead of index.
One of the main goals of /Core is interoperability across platforms. Introducing a standardized naming scheme for serial ports means that scripts do not have to be changed when moving them across platforms. With the current scheme the only part of a script that has to change is the port number, as opposed to changing full port specs.
> and REBOL would figure out that you want 2400 baud, 7 data bits, even parity and 2 stop bits. I don't think that REBOL provides a mechanisim to change the option after an open.
It does. Just change the parameters in the port structure and call 'update on the port. -- Holger Kruse [holger--rebol--com]