[Mono-dev] Make System.IO.Ports work on UNIX systems other than Linux
robert at openbsd.org
Thu Apr 22 14:52:42 EDT 2010
Basically on linux ttyS* and ttyUSB* is used for serial device names, but this
is not the case for *BSD, Solaris and probably OS X.
On these systems tty[0-9]+ or ttyU[0-9]+ is used so the current code ony works on
What my diff does is that it gets the list of all tty devices from /dev and
if it finds only one ttyS* device which is only the linux case it will remove all
the tty[0-9]+ and ttyU[0-9]+ devices from the list. If it does not find it then
we it removes everything except for tty[0-9]+ ttyU[0-9]+.
So my diff will produce this list on *BSD:
And this on a linux system:
On (2010-04-22 13:26), Miguel de Icaza wrote:
> The attached diff makes SerialPort.GetPortNames() work on
> > all Unix systems other than Linux too, because ttyS* and
> > ttyUSB* is linux specific and on *BSD the serial ports are
> > tty[0-9]+.
> > (I've tested this code on Linux and it should also support
> > ttySG0 (SGI running Linux (ia64)).
> I am not sure why you swap lnx with rem and remove items from the list on a
> second pass.
> Perhaps you can explain the rationale and the naming of the devices on each
> of the systems that you tested this on?
> I would also rather not use regexps there.
> > The other way would be to add a different platform id for
> > *BSDs.
> > Comments? (My C# is not good :))
> > _______________________________________________
> > Mono-devel-list mailing list
> > Mono-devel-list at lists.ximian.com
> > http://lists.ximian.com/mailman/listinfo/mono-devel-list
More information about the Mono-devel-list