Serial (was Controlling/comunicating...)

Dar Scott dsc at swcp.com
Fri Jul 18 13:27:01 EDT 2003


On Friday, July 18, 2003, at 07:03 AM, tech at paynesparkman.com wrote:

>> If you are interested in opening a serial port on a usb device, I can
>> tell you more.

> I would be very interested in this information.  Since the new Macs  
> have eliminated the old serial port and are using internal USB modems,  
> I'm not able to access these
> modems because they don't present themselves as "MODEM:" or "PRINTER:"  
> and those are the only options I have in MC/RR.

The internal modem on my MDD is not USB and I don't think it is on my  
Blue & White.

OK, here is a short summary:


Mac OS 9.2

Only "printer:" and "modem:" can be opened.  Use open file.  I hear you  
map a USB serial port to "printer:" to be able to open it.  (This does  
not work for me, I get sysError()=-98; perhaps this is because I  
already have a phantom "printer:" port.  I may have gotten it to open  
once.)  The write blocks.


OS X

There are a few problems, some of which will be fixed in the upcoming  
release.

Internal Modem:
It takes about 3 seconds to open or close.  (I don't know if this is a  
bug or some FCC regulation.)  This works best:
open driver ... for binary update
write ... driver ... -- as needed
read ... driver  ... until /* buffer is */ empty -- as needed
close driver ...

I don't mean to imply you should close and reopen after each  
write-read; I mean use those methods.

USB-to-serial adaptor
This works best:
open driver ... for binary update
write <data-that-ends-in-LF> to driver ... -- as needed
read ... driver ... until /* buffer is */ empty  -- as needed
close driver ...

The write is non-blocking, so take care to avoid closing too soon.  You  
also need to pace output to prevent output overruns; if your  
application sends a line, waits for a response and then repeats, you  
should be OK.

The driverNames() does not include the internal modem, but will in the  
next release.

The handshake controls in serialControlString do nothing.


Window XP

You can open driver or open file to "COMx:" or "\\.\COMx", but  
serialControlString applies only to the first.  Write will block for up  
to 2 seconds, so keep it to simple dialogs.  I use only read until  
empty.  Basic handshaking control works.  (No USB testing, yet.)


Linux

I haven't tested any yet, but I understand serialControlString is now  
implemented.


Dar Scott

************************************************************************ 
****
   Dar Scott Consulting    http://www.swcp.com/dsc/    Programming  
Services
************************************************************************ 
****




More information about the metacard mailing list