[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.5.1., 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...
	mySerial.Open();
		
    }
}	


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)
System.IO.Ports.SerialPortStream:SetSignal
(System.IO.Ports.SerialSignal,bool)
  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)
System.IO.Ports.SerialPortStream:.ctor
(string,int,int,System.IO.Ports.Parity,System.IO.Ports.StopBits,bool,bool,System.IO.Ports.Handshake,int,int,int,int)
  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:

http://kerneltrap.org/mailarchive/linux-usb-devel/2007/10/6/342318

http://kerneltrap.org/mailarchive/linux-usb-devel/2007/10/9/342411

http://www.kernel.org/pub/linux/kernel/v2.6/ChangeLog-2.6.24

C code working (see chronopic.c and test-saltos-c)
http://svn.gnome.org/viewvc/chronojump/trunk/chronopic-tests/

Python code working (use miniterm.py )
http://www.iearobotics.com/proyectos/cuadernos/ct11/ct11.html


Cheers


More information about the Mono-list mailing list