Re: [Mono-dev] Patch for Bug 8207: Can't set 1000000 baud with System.IO.Ports.SerialPort.BaudRate
Mono 4.0 branched a long time ago, so it is possible that this is just a side effect of that. But you can check the patch in git, if the patch is not on the mono 4.0.0 branch, and only in master, it means that it will be part of Mono 4.2 Miguel On Tue, May 12, 2015 at 4:47 AM, Ariel Rocholl wrote: > Hi there, > > > > I don’t see this included in Mono 4.0, probably misunderstood this one > would be merged into 4.0. > > > > Do you have a target release where this will be available? > > > Best Regards, > > Ariel Rocholl > > > > *From:* mono-devel-list-boun...@lists.ximian.com [mailto: > mono-devel-list-boun...@lists.ximian.com] *On Behalf Of *Miguel de Icaza > *Sent:* Wednesday, February 25, 2015 17:45 > *To:* Christian Hofstaedtler > *Cc:* mono-devel > *Subject:* Re: [Mono-dev] Patch for Bug 8207: Can't set 100 baud with > System.IO.Ports.SerialPort.BaudRate > > > > Applied, and updated also to support Mac. > > > > On Tue, Feb 24, 2015 at 3:45 PM, Christian Hofstaedtler < > ch---mono-de...@zeha.at> wrote: > > This patch (against mono-2.10.8.1 from Debian) allows setting > custom baud rates, and very likely would support a baudrate of > 100. > > I release this patch under the MIT license. > > > --- serial.c.orig 2013-01-30 12:06:52.379691461 +0100 > +++ serial.c.orig 2013-01-30 13:05:50.383390154 +0100 > @@ -17,6 +17,11 @@ > #endif > #include > > +/* This is for ASYNC_*, serial_struct on linux */ > +#if defined(__linux__) > +#include > +#endif > + > #include > > /* This is for FIONREAD on solaris */ > @@ -151,6 +156,7 @@ > set_attributes (int fd, int baud_rate, MonoParity parity, int dataBits, > MonoStopBits stopBits, MonoHandshake handshake) > { > struct termios newtio; > + gboolean custom_baud_rate = FALSE; > > if (tcgetattr (fd, &newtio) == -1) > return FALSE; > @@ -227,8 +233,10 @@ > break; > case 50: > case 0: > - default: > baud_rate = B9600; > + break; > + default: > + custom_baud_rate = TRUE; > break; > } > > @@ -319,16 +327,54 @@ > newtio.c_iflag |= IXOFF | IXON; > break; > } > - > - if (cfsetospeed (&newtio, baud_rate) < 0 || cfsetispeed (&newtio, > baud_rate) < 0 || > - tcsetattr (fd, TCSANOW, &newtio) < 0) > + > + if (custom_baud_rate == FALSE) > { > - return FALSE; > + if (cfsetospeed (&newtio, baud_rate) < 0 || cfsetispeed > (&newtio, baud_rate) < 0) > + { > + return FALSE; > + } > } > else > { > - return TRUE; > + /* On Linux, to set a custom baud rate, we must set the > "standard" baud_rate > +* to 38400. */ > + if (cfsetospeed (&newtio, B38400) < 0 || cfsetispeed > (&newtio, B38400) < 0) > + { > + return FALSE; > + } > + } > + > + if (tcsetattr (fd, TCSANOW, &newtio) < 0) > + { > + return FALSE; > + } > + > + if (custom_baud_rate == TRUE) > + { > +#if defined(__linux__) > + struct serial_struct ser; > + > + if (ioctl (fd, TIOCGSERIAL, &ser) < 0) > + { > + return FALSE; > + } > + > + ser.custom_divisor = ser.baud_base / baud_rate; > + ser.flags &= ~ASYNC_SPD_MASK; > + ser.flags |= ASYNC_SPD_CUST; > + > + if (ioctl (fd, TIOCSSERIAL, &ser) < 0) > + { > + return FALSE; > + } > +#else > + /* Don't know how to set custom baud rate on this > platform. */ > + return FALSE; > +#endif > } > + > + return TRUE; > } > > > ___ > Mono-devel-list mailing list > Mono-devel-list@lists.ximian.com > http://lists.ximian.com/mailman/listinfo/mono-devel-list > > > ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-dev] Patch for Bug 8207: Can't set 1000000 baud with System.IO.Ports.SerialPort.BaudRate
Applied, and updated also to support Mac. On Tue, Feb 24, 2015 at 3:45 PM, Christian Hofstaedtler < ch---mono-de...@zeha.at> wrote: > This patch (against mono-2.10.8.1 from Debian) allows setting > custom baud rates, and very likely would support a baudrate of > 100. > > I release this patch under the MIT license. > > > --- serial.c.orig 2013-01-30 12:06:52.379691461 +0100 > +++ serial.c.orig 2013-01-30 13:05:50.383390154 +0100 > @@ -17,6 +17,11 @@ > #endif > #include > > +/* This is for ASYNC_*, serial_struct on linux */ > +#if defined(__linux__) > +#include > +#endif > + > #include > > /* This is for FIONREAD on solaris */ > @@ -151,6 +156,7 @@ > set_attributes (int fd, int baud_rate, MonoParity parity, int dataBits, > MonoStopBits stopBits, MonoHandshake handshake) > { > struct termios newtio; > + gboolean custom_baud_rate = FALSE; > > if (tcgetattr (fd, &newtio) == -1) > return FALSE; > @@ -227,8 +233,10 @@ > break; > case 50: > case 0: > - default: > baud_rate = B9600; > + break; > + default: > + custom_baud_rate = TRUE; > break; > } > > @@ -319,16 +327,54 @@ > newtio.c_iflag |= IXOFF | IXON; > break; > } > - > - if (cfsetospeed (&newtio, baud_rate) < 0 || cfsetispeed (&newtio, > baud_rate) < 0 || > - tcsetattr (fd, TCSANOW, &newtio) < 0) > + > + if (custom_baud_rate == FALSE) > { > - return FALSE; > + if (cfsetospeed (&newtio, baud_rate) < 0 || cfsetispeed > (&newtio, baud_rate) < 0) > + { > + return FALSE; > + } > } > else > { > - return TRUE; > + /* On Linux, to set a custom baud rate, we must set the > "standard" baud_rate > +* to 38400. */ > + if (cfsetospeed (&newtio, B38400) < 0 || cfsetispeed > (&newtio, B38400) < 0) > + { > + return FALSE; > + } > + } > + > + if (tcsetattr (fd, TCSANOW, &newtio) < 0) > + { > + return FALSE; > + } > + > + if (custom_baud_rate == TRUE) > + { > +#if defined(__linux__) > + struct serial_struct ser; > + > + if (ioctl (fd, TIOCGSERIAL, &ser) < 0) > + { > + return FALSE; > + } > + > + ser.custom_divisor = ser.baud_base / baud_rate; > + ser.flags &= ~ASYNC_SPD_MASK; > + ser.flags |= ASYNC_SPD_CUST; > + > + if (ioctl (fd, TIOCSSERIAL, &ser) < 0) > + { > + return FALSE; > + } > +#else > + /* Don't know how to set custom baud rate on this > platform. */ > + return FALSE; > +#endif > } > + > + return TRUE; > } > > > ___ > Mono-devel-list mailing list > Mono-devel-list@lists.ximian.com > http://lists.ximian.com/mailman/listinfo/mono-devel-list > ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-dev] Patch for Bug 8207: Can't set 1000000 baud with System.IO.Ports.SerialPort.BaudRate
Hi Miguel, * Miguel de Icaza [150225 03:07]: > Hello Christian, > > This looks fine. Are you the original author of the patch? Yes, I'm the original author of this patch (as posted to Bugzilla in 2013). Christian > > On Tue, Feb 24, 2015 at 3:45 PM, Christian Hofstaedtler < > ch---mono-de...@zeha.at> wrote: > > > This patch (against mono-2.10.8.1 from Debian) allows setting > > custom baud rates, and very likely would support a baudrate of > > 100. > > > > I release this patch under the MIT license. > > > > > > --- serial.c.orig 2013-01-30 12:06:52.379691461 +0100 > > +++ serial.c.orig 2013-01-30 13:05:50.383390154 +0100 > > @@ -17,6 +17,11 @@ > > #endif > > #include > > > > +/* This is for ASYNC_*, serial_struct on linux */ > > +#if defined(__linux__) > > +#include > > +#endif > > + > > #include > > > > /* This is for FIONREAD on solaris */ > > @@ -151,6 +156,7 @@ > > set_attributes (int fd, int baud_rate, MonoParity parity, int dataBits, > > MonoStopBits stopBits, MonoHandshake handshake) > > { > > struct termios newtio; > > + gboolean custom_baud_rate = FALSE; > > > > if (tcgetattr (fd, &newtio) == -1) > > return FALSE; > > @@ -227,8 +233,10 @@ > > break; > > case 50: > > case 0: > > - default: > > baud_rate = B9600; > > + break; > > + default: > > + custom_baud_rate = TRUE; > > break; > > } > > > > @@ -319,16 +327,54 @@ > > newtio.c_iflag |= IXOFF | IXON; > > break; > > } > > - > > - if (cfsetospeed (&newtio, baud_rate) < 0 || cfsetispeed (&newtio, > > baud_rate) < 0 || > > - tcsetattr (fd, TCSANOW, &newtio) < 0) > > + > > + if (custom_baud_rate == FALSE) > > { > > - return FALSE; > > + if (cfsetospeed (&newtio, baud_rate) < 0 || cfsetispeed > > (&newtio, baud_rate) < 0) > > + { > > + return FALSE; > > + } > > } > > else > > { > > - return TRUE; > > + /* On Linux, to set a custom baud rate, we must set the > > "standard" baud_rate > > +* to 38400. */ > > + if (cfsetospeed (&newtio, B38400) < 0 || cfsetispeed > > (&newtio, B38400) < 0) > > + { > > + return FALSE; > > + } > > + } > > + > > + if (tcsetattr (fd, TCSANOW, &newtio) < 0) > > + { > > + return FALSE; > > + } > > + > > + if (custom_baud_rate == TRUE) > > + { > > +#if defined(__linux__) > > + struct serial_struct ser; > > + > > + if (ioctl (fd, TIOCGSERIAL, &ser) < 0) > > + { > > + return FALSE; > > + } > > + > > + ser.custom_divisor = ser.baud_base / baud_rate; > > + ser.flags &= ~ASYNC_SPD_MASK; > > + ser.flags |= ASYNC_SPD_CUST; > > + > > + if (ioctl (fd, TIOCSSERIAL, &ser) < 0) > > + { > > + return FALSE; > > + } > > +#else > > + /* Don't know how to set custom baud rate on this > > platform. */ > > + return FALSE; > > +#endif > > } > > + > > + return TRUE; > > } ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-dev] Patch for Bug 8207: Can't set 1000000 baud with System.IO.Ports.SerialPort.BaudRate
Hello Christian, This looks fine. Are you the original author of the patch? Miguel On Tue, Feb 24, 2015 at 3:45 PM, Christian Hofstaedtler < ch---mono-de...@zeha.at> wrote: > This patch (against mono-2.10.8.1 from Debian) allows setting > custom baud rates, and very likely would support a baudrate of > 100. > > I release this patch under the MIT license. > > > --- serial.c.orig 2013-01-30 12:06:52.379691461 +0100 > +++ serial.c.orig 2013-01-30 13:05:50.383390154 +0100 > @@ -17,6 +17,11 @@ > #endif > #include > > +/* This is for ASYNC_*, serial_struct on linux */ > +#if defined(__linux__) > +#include > +#endif > + > #include > > /* This is for FIONREAD on solaris */ > @@ -151,6 +156,7 @@ > set_attributes (int fd, int baud_rate, MonoParity parity, int dataBits, > MonoStopBits stopBits, MonoHandshake handshake) > { > struct termios newtio; > + gboolean custom_baud_rate = FALSE; > > if (tcgetattr (fd, &newtio) == -1) > return FALSE; > @@ -227,8 +233,10 @@ > break; > case 50: > case 0: > - default: > baud_rate = B9600; > + break; > + default: > + custom_baud_rate = TRUE; > break; > } > > @@ -319,16 +327,54 @@ > newtio.c_iflag |= IXOFF | IXON; > break; > } > - > - if (cfsetospeed (&newtio, baud_rate) < 0 || cfsetispeed (&newtio, > baud_rate) < 0 || > - tcsetattr (fd, TCSANOW, &newtio) < 0) > + > + if (custom_baud_rate == FALSE) > { > - return FALSE; > + if (cfsetospeed (&newtio, baud_rate) < 0 || cfsetispeed > (&newtio, baud_rate) < 0) > + { > + return FALSE; > + } > } > else > { > - return TRUE; > + /* On Linux, to set a custom baud rate, we must set the > "standard" baud_rate > +* to 38400. */ > + if (cfsetospeed (&newtio, B38400) < 0 || cfsetispeed > (&newtio, B38400) < 0) > + { > + return FALSE; > + } > + } > + > + if (tcsetattr (fd, TCSANOW, &newtio) < 0) > + { > + return FALSE; > + } > + > + if (custom_baud_rate == TRUE) > + { > +#if defined(__linux__) > + struct serial_struct ser; > + > + if (ioctl (fd, TIOCGSERIAL, &ser) < 0) > + { > + return FALSE; > + } > + > + ser.custom_divisor = ser.baud_base / baud_rate; > + ser.flags &= ~ASYNC_SPD_MASK; > + ser.flags |= ASYNC_SPD_CUST; > + > + if (ioctl (fd, TIOCSSERIAL, &ser) < 0) > + { > + return FALSE; > + } > +#else > + /* Don't know how to set custom baud rate on this > platform. */ > + return FALSE; > +#endif > } > + > + return TRUE; > } > > > ___ > Mono-devel-list mailing list > Mono-devel-list@lists.ximian.com > http://lists.ximian.com/mailman/listinfo/mono-devel-list > ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
[Mono-dev] Patch for Bug 8207: Can't set 1000000 baud with System.IO.Ports.SerialPort.BaudRate
This patch (against mono-2.10.8.1 from Debian) allows setting custom baud rates, and very likely would support a baudrate of 100. I release this patch under the MIT license. --- serial.c.orig 2013-01-30 12:06:52.379691461 +0100 +++ serial.c.orig 2013-01-30 13:05:50.383390154 +0100 @@ -17,6 +17,11 @@ #endif #include +/* This is for ASYNC_*, serial_struct on linux */ +#if defined(__linux__) +#include +#endif + #include /* This is for FIONREAD on solaris */ @@ -151,6 +156,7 @@ set_attributes (int fd, int baud_rate, MonoParity parity, int dataBits, MonoStopBits stopBits, MonoHandshake handshake) { struct termios newtio; + gboolean custom_baud_rate = FALSE; if (tcgetattr (fd, &newtio) == -1) return FALSE; @@ -227,8 +233,10 @@ break; case 50: case 0: - default: baud_rate = B9600; + break; + default: + custom_baud_rate = TRUE; break; } @@ -319,16 +327,54 @@ newtio.c_iflag |= IXOFF | IXON; break; } - - if (cfsetospeed (&newtio, baud_rate) < 0 || cfsetispeed (&newtio, baud_rate) < 0 || - tcsetattr (fd, TCSANOW, &newtio) < 0) + + if (custom_baud_rate == FALSE) { - return FALSE; + if (cfsetospeed (&newtio, baud_rate) < 0 || cfsetispeed (&newtio, baud_rate) < 0) + { + return FALSE; + } } else { - return TRUE; + /* On Linux, to set a custom baud rate, we must set the "standard" baud_rate +* to 38400. */ + if (cfsetospeed (&newtio, B38400) < 0 || cfsetispeed (&newtio, B38400) < 0) + { + return FALSE; + } + } + + if (tcsetattr (fd, TCSANOW, &newtio) < 0) + { + return FALSE; + } + + if (custom_baud_rate == TRUE) + { +#if defined(__linux__) + struct serial_struct ser; + + if (ioctl (fd, TIOCGSERIAL, &ser) < 0) + { + return FALSE; + } + + ser.custom_divisor = ser.baud_base / baud_rate; + ser.flags &= ~ASYNC_SPD_MASK; + ser.flags |= ASYNC_SPD_CUST; + + if (ioctl (fd, TIOCSSERIAL, &ser) < 0) + { + return FALSE; + } +#else + /* Don't know how to set custom baud rate on this platform. */ + return FALSE; +#endif } + + return TRUE; } ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list