Serial ports (Newbies)

Dar Scott dsc at swcp.com
Sun Sep 14 16:50:00 EDT 2003


On Sunday, September 14, 2003, at 02:49 PM, Hershel wrote:

> In general the serial command includes USB ports ?

On Windows and OS X this is so, but only for serial-to-USB adaptors and 
USB devices that present themselves as serialports.  For Mac OS 9, I 
hear this will work only if the name is printer or modem.  I don't know 
about Linux.

> How can I query all my ports ?

On OS X you get a list from driverNames().  On other platforms use the 
standard names.  To keep from generating file names, open for read and 
if that works open for update and make your query.  You might want to 
keep some ports off the list.  On OS X the query will hang for 3 
seconds each open for the internal modem.  It is currently not on 
driverNames(), but it will probably be in the near future, so be sure 
and skip that.

> I'm am creating a POS , Can I send a ASCII code to the USB  port with 
> the serial command to open a cash drawer ?

If the cash drawer has an ASCII serial interface, yes.  For the time 
being, on OS X you are limited to lines ending with LF, only--and you 
must open for binary.

> And also to a pole display ?

The considerations are the same.

There are some differences among platforms.  For example, I/O is 
non-blocking on OS X but blocking on Windows and Mac OS.

You might want to get some devices and start tinkering.

Dar Scott






More information about the use-livecode mailing list