[Mono-list] Bug in serial port on kernels 2.6.20-2.6.23

Xavi de Blas xaviblas at gmail.com
Fri Jan 25 12:39:47 EST 2008

Hello all

Linux Kernel from 2.6.20 to 2.6.23 has a serial port bug because it
doesn't implement TIOCMGET

The FT232RL devices thrown an exception when are Serial.opened by a
mono app (tested in 1.2.4,, 1.2.6). A piece of C or Python
code that opens serial port works, but in Mono fails.

This is a sample of Mono failing here:

using System;
using System.IO.Ports;

public class SerialPortTest
	public static void Main(string[] args)
		SerialPort mySerial;
        mySerial = new SerialPort();
        mySerial.PortName = "/dev/ttyUSB0";
        mySerial.BaudRate = 9600;
	mySerial.Parity = Parity.None;
	mySerial.DataBits = 8;
	mySerial.StopBits = StopBits.One;
	mySerial.Handshake = Handshake.None;

        // Set the read/write timeouts
        mySerial.ReadTimeout = 500;
        mySerial.WriteTimeout = 500;

	//-- Aqui se provoca la excepcion...

it seems Mono crash because makes some call to TIOCMGET on this kernels.

It works installing 2.6.24

I hope it helps someone

This is the crash:

Unhandled Exception: System.IO.IOException: I/O Error

y todo lo que viene a continuación:

 at System.IO.Ports.SerialPortStream.SetSignal (SerialSignal signal,
Boolean value) [0x00000]
  at (wrapper remoting-invoke-with-check)
  at System.IO.Ports.SerialPortStream..ctor (System.String portName,
Int32 baudRate, Int32 dataBits, Parity parity, StopBits stopBits,
Boolean dtrEnable, Boolean rtsEnable, Handshake handshake, Int32
readTimeout, Int32 writeTimeout, Int32 readBufferSize, Int32
writeBufferSize) [0x00000]
  at (wrapper remoting-invoke-with-check)
  at System.IO.Ports.SerialPort.Open () [0x00000]
  at (wrapper remoting-invoke-with-check)
System.IO.Ports.SerialPort:Open ()
  at SerialPortTest.Main (System.String[] args) [0x00000]

More info related:




C code working (see chronopic.c and test-saltos-c)

Python code working (use miniterm.py )


More information about the Mono-list mailing list