[Mono-dev] Make System.IO.Ports work on UNIX systems other than Linux
Miguel de Icaza
miguel at novell.com
Thu Apr 22 15:42:13 EDT 2010
Thanks for the explanation.
SVN now has a slightly different and more obvious approach
On Thu, Apr 22, 2010 at 2:52 PM, Robert Nagy <robert at openbsd.org> wrote:
> Hey
>
> 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
> linux.
>
> 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:
> /dev/tty00
> /dev/tty01
> /dev/tty02
> /dev/tty03
> /dev/ttyU0
> /dev/ttyU1
> /dev/ttyU2
> /dev/ttyU3
>
> And this on a linux system:
> /dev/ttyS0
> /dev/ttyS1
> /dev/ttyS2
> /dev/ttyS3
>
> On (2010-04-22 13:26), Miguel de Icaza wrote:
> > Hello,
> >
> > 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.
> >
> > Miguel.
> >
> > >
> > > 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
> > >
> > >
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20100422/87860ad3/attachment-0001.html
More information about the Mono-devel-list
mailing list