serialControlString

Dar Scott dsc at swcp.com
Sat Nov 22 15:05:53 EST 2003


On Saturday, November 22, 2003, at 11:16 AM, Thomas J McGrath III wrote:

> I am trying to understand how to send/receive to a usb I/O board 
> (MacBrick).
> I am trying to figure out the serialControlString and driverNames 
> function.
> The device shows up in driverNames as 'usbserial-3B1' So I know REV 
> can see it.

On OS X:

I don't have 10.3 yet.

Since it shows up in driverNames, you can probably talk to it.  Use the 
name that starts out "cu".

My comments below assume you can talk to a MacBrick as if talking to a 
serial port.

Since it is not a real serial port, you probably don't need 
serialControlString.

Open with open driver for binary update and close with close driver.  
Check the result.  Display it in early code, so you get a heads-up on 
what's happening.

In between, write to driver and read from driver as needed.

If the MacBrick can handle ascii text with cr or crlf as line ending do 
it that way.  I have had trouble with writes not ending in lf.  For 
reading, just read until empty.  That will get what is in the buffer.  
Do it often with delays to collect the result.

If your interface is simply a dialog in which you write something 
small, get the small response and then later do it again, you don't 
need to worry about buffer overflow or closing while transmission is in 
progress.  Also, since this is only a virtual serial device, this is 
probably not a concern.

There has been at least one other question about MacBrick in the past 
and other questions on OS X serial; you might want to look at responses 
to those in archives.

On 9.2:

You will need to figure out a way to make it look like printer: or 
modem:.  Procedure is like above, except you don't have the bug 
workarounds; you have more freedom.  Serial I/O blocks, so you might 
need to portion out your writes.  Since the serial driver is virtual, 
this may not be a real concern.  Blocking wastes time, but it 
simplifies other things.

I have heard that MacBrick is no more.  Has somebody picked it up?  Let 
us know how this works out.

Dar Scott




More information about the use-livecode mailing list