SerialPort cross-platform question...

Ned Konz ned at bike-nomad.com
Mon Feb 11 16:42:33 UTC 2002


On Monday 11 February 2002 03:05 am, Bergel Alexandre wrote:
> > Actually, the peculiar enumeration of the ports is a Mac-ism. On the
> > Windoze and Unix platforms, it would make more sense to supply a name.
>
> Why to supply a name ? 'COMx' belong to windows world...

How would you know, portably, what the name of the serial port is in a Unix 
system? Could be anything (including a symlink to an entry in /dev 
somewhere). There are _no_ reliable standard names for serial ports in Unix. 
I picked /dev/ttyS0 etc. because that worked on my system and common PC Linux 
systems. But it's not going to work if (for instance) you have an intelligent 
multiport serial card installed also and want to use one of those ports.

For instance, /dev/ttyH0, /dev/ttyC0, /dev/ttyD0, /dev/ttyE0, /dev/ttySR0, 
etc. are all typical names for a serial device. But these are only the 
traditional names. And if someone linked /wherever/mySerialPort to one of 
these (or made a node with that name), we should be able to use it as well. 
This is why I said that names would help.

On the Windows machines, there is no guarantee that there is any consecutive 
number of the COMx ports. I have a Windows box whose COM ports start at COM4.

> > And it's not clear how the ports are numbered on the Mac when you hang
> > USB serial ports on one (per Dan Ingalls).
>
> I use on my linux a usb->serial adaptor, and it is the same then a real
> port. I guess it should be the same for mac.

So did we, but Dan hasn't been able to find a number that worked reliably.

-- 
Ned Konz
currently: Stanwood, WA
email:     ned at bike-nomad.com
homepage:  http://bike-nomad.com



More information about the Squeak-dev mailing list