Re: [Mono-dev] Mono C# Serial Port problem

2009-08-21 Thread Shawn Schaerer
Hi Mauricio,

Are implementation was for OSX and we did not implement events.
However we did make a threaded read and write that uses select on the
port to see if there is data.
Here is the where the code can be downloaded.
http://shaneo.blogsite.org/

I hope this helps.
Shawn

> Hi Shawn:
>
> We are working heavily with serial ports on mono linux here at my Univ.
> and so far all works kind of ok doing read/write calls , but now we
> really need the incoming data event, but also be able to write to the
> serial port, so we can't do threading loops makings reads on the port
> becouse that blocks the writing, so I wonder if you are still willing to
> share your serial port re-implementation to the mono project or at least
> help me to implement the incoming data event?
>
> in advance, thank you very much...
>
> Mauricio
>
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Mono C# Serial Port problem

2009-08-21 Thread buhochil...@gmail.com
Hi Shawn:

We are working heavily with serial ports on mono linux here at my Univ. 
and so far all works kind of ok doing read/write calls , but now we 
really need the incoming data event, but also be able to write to the 
serial port, so we can't do threading loops makings reads on the port 
becouse that blocks the writing, so I wonder if you are still willing to 
share your serial port re-implementation to the mono project or at least 
help me to implement the incoming data event?

in advance, thank you very much...

Mauricio

Shawn Schaerer wrote:
> Hi,
>
> No we do not have it on the web, but we are willing to put it up and 
> or submit it to the mono-project.
>
>
>
> Shawn Schaerer
> Director of Research and Development
> Cogmation Robotics Inc
> www.cogmation.com
>
>
>
>
> On 16-May-08, at 11:00 AM, Xavi de Blas wrote:
>
>> Shwn: Do you have this reimlemenation of serial n OsX on the net? is
>> it free software?
>>
>> Thanks
>>
>> 2008/5/16, Shawn Schaerer > >:
>>> Hi,
>>>
>>> We also have problems with the serial port under OSX.  We had to re-
>>> implement most of the serial port unsing posix call.
>>>
>>> Can you actually get any data out of the port ?
>>>
>>> Shawn Schaerer
>>> Director of Research and Development
>>> Cogmation Robotics Inc
>>> www.cogmation.com
>>>
>>>
>>>
>>>
>>>
>>
>
> 
>
> ___
> 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] Mono C# Serial Port problem

2009-05-21 Thread christopher jones

Hi guys, I had som eissues with the RS232 implementation in mono. I found
that the example of using polling did not work inside linux and would like
to suggest the following code instead:

I have tried this on both Windows and under linux in a virtual Fedora
machine and it does work.



using System;
using System.Collections.Generic;
using System.IO.Ports;

public class SerialPortTest
{
public static void Main(string[] args)
{
SerialPortTest myTest = new SerialPortTest();
myTest.Test();
}

private SerialPort mySerial;

// Constructor
public SerialPortTest()
{
}

public void Test()
{
if (mySerial != null)
if (mySerial.IsOpen)
mySerial.Close();

mySerial = new SerialPort("/dev/ttyS0", 19200);
mySerial.Open();
mySerial.ReadTimeout = 400;
  
while (true)
{
Console.WriteLine(ReadData());
}
}

public string ReadData()
{
byte tmpByte;
string rxString = "";

try
{
   
tmpByte = (byte)mySerial.ReadByte();

while (true)
{
Console.WriteLine("Data Received");
try
{
rxString += ((char)tmpByte);
tmpByte = (byte)mySerial.ReadByte();
}
catch
{
rxString += "!2";   
break;
}
}

}
catch 
{
rxString+="!1";
}
return rxString;
}

public bool SendData(string Data)
{
mySerial.Write(Data);
return true;
}
}
-- 
View this message in context: 
http://www.nabble.com/Mono-C--Serial-Port-problem-tp17241892p23593597.html
Sent from the Mono - Dev mailing list archive at Nabble.com.

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Mono C# Serial Port problem

2009-01-10 Thread Shawn Schaerer

Hi,

Sorry, We have meant to release the code, but it went on the back  
burner and I actually forgot about it.  Thanks for the reminder.


I guess if the patch works, then that is great.
Our implementation relies on a new .NET class that uses Unix calls.

If this is still needed we can release it.
Let me know,



Shawn Schaerer
Director of Research and Development
Cogmation Robotics Inc
www.cogmation.com




On 8-Jan-09, at 11:10 AM, Xavi de Blas wrote:


Hello all

which is the status of the serial port in MacOSX implementation?

i think Shawn code is not released, and i wonder if patching mono with
this patch:

https://bugzilla.novell.com/show_bug.cgi?id=384227

and re-compiling Mono will work on Mac.

Worked for anyone? i have no MACs around.

Thanks.



2008/5/30 Shawn Schaerer :

Hi,
I hope to have our OSX implementation up in the next couple of  
days.  This

implementation should work under linux too!!
I am also looking at the serial.c  source and will try to get that  
to work

under OSX  as well.
I will send the link ASAP.
Shawn Schaerer
Director of Research and Development
Cogmation Robotics Inc
www.cogmation.com



On 30-May-08, at 12:03 PM, mono-devel-list-requ...@lists.ximian.com  
wrote:



Alan_Chun wrote:

HI, currently I am porting a windows app to linux using Mono. I  
have some


difficulties to get the serial port work. here is the code(based on  
mono


website):

I have also tried BytesToRead, Read, ReadByte, all of them are  
working


fine under windows using .net2.0 framwork. But once I use the mono

runtime, the nightmare begins.

Any help will be really apprecaited!

Thanks

I'm actually having the same problem. I'm using ubuntu 8.04.

--

___
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] Mono C# Serial Port problem

2009-01-08 Thread Xavi de Blas
Hello all

which is the status of the serial port in MacOSX implementation?

i think Shawn code is not released, and i wonder if patching mono with
this patch:

https://bugzilla.novell.com/show_bug.cgi?id=384227

and re-compiling Mono will work on Mac.

Worked for anyone? i have no MACs around.

Thanks.



2008/5/30 Shawn Schaerer :
> Hi,
> I hope to have our OSX implementation up in the next couple of days.  This
> implementation should work under linux too!!
> I am also looking at the serial.c  source and will try to get that to work
> under OSX  as well.
> I will send the link ASAP.
> Shawn Schaerer
> Director of Research and Development
> Cogmation Robotics Inc
> www.cogmation.com
>
>
>
> On 30-May-08, at 12:03 PM, mono-devel-list-requ...@lists.ximian.com wrote:
>
>
> Alan_Chun wrote:
>
> HI, currently I am porting a windows app to linux using Mono. I have some
>
> difficulties to get the serial port work. here is the code(based on mono
>
> website):
>
> I have also tried BytesToRead, Read, ReadByte, all of them are working
>
> fine under windows using .net2.0 framwork. But once I use the mono
>
> runtime, the nightmare begins.
>
> Any help will be really apprecaited!
>
> Thanks
>
> I'm actually having the same problem. I'm using ubuntu 8.04.
>
> --
>
> ___
> 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] Mono C# Serial Port problem

2008-06-10 Thread Leszek Ciesielski
The RecievedEvent is not implemented (check the exception...). If you
need to monitor the serial port for incoming data, create a separate
thread for handling the port and use the blocking Read methods.
Remember not to use the port outside the thread that has created it.

Please note that MSDN states that the SerialPort class is not
thread-safe, then happily ignores this and keeps tossing it between
threads in every example.

On Tue, Jun 10, 2008 at 1:42 PM, PaceyIV <[EMAIL PROTECTED]> wrote:
>
> Uhm...
>
> Now I try the code below. It works on Microsoft Visual Studio, but not in
> mono on Ubuntu.
> It compile it, but when I try to run it I get this error:
>
> Unhandled Exception: System.NotImplementedException: The requested feature
> is not implemented.
>  at System.IO.Ports.SerialPort.set_ReceivedBytesThreshold (Int32 value)
> [0x00012] in
> /build/buildd/mono-1.2.6+dfsg/mcs/class/System/System.IO.Ports/SerialPort.cs:410
>  at (wrapper remoting-invoke-with-check)
> System.IO.Ports.SerialPort:set_ReceivedBytesThreshold (int)
>  at ConsoleApplication1.Program.Main (System.String[] args) [0x0004f] in
> /home/paceyiv/programmazione/mono/Microsoft/Microsoft/Main.cs:29
>
> So I comment the line!
> I think don't work the SerialDataReceivedEventHandler. I can write code to
> read the byte from serial and the device respond, but the Serial Data
> Received Event newer works on mono.
>
> What's wrong?
>
> using System;
> using System.Collections.Generic;
> //using System.Linq;
> using System.Text;
> using System.IO;
> using System.IO.Ports;
> using System.Threading;
>
> namespace ConsoleApplication1
> {
>class Program
>{
>static System.IO.Ports.SerialPort rs232;
>
>static string dati;
>
>static void Main(string[] args)
>{
>// Setup RS-232
>rs232 = new SerialPort("/dev/ttyUSB0", 9600);
>// for Win
>//rs232 = new SerialPort("COM3", 9600);
>rs232.BaudRate = 9600;
>rs232.Parity = Parity.None;
>rs232.DataBits = 8;
>rs232.StopBits = StopBits.One;
>rs232.Handshake = Handshake.None;
>
>//rs232.ReadTimeout = 2000;
>//rs232.ReadBufferSize = 1024;
>//rs232.ReceivedBytesThreshold = 1; // This don't work in mono!
>rs232.DataReceived +=
>new SerialDataReceivedEventHandler(rs232_DataReceived); //
> This don't work in mono!
>
>// Open SerialPort
>try
>{
>rs232.Open();
>// Do I really need this?
>//rs232.DiscardInBuffer();
>//rs232.DiscardOutBuffer();
>
>// Dealy for my specific device
>Thread.Sleep(1500);
>}
>catch (System.IO.IOException ioe)
>{
>Console.Write(ioe.Message);
>Environment.Exit(1);
>}
>
>// survive to Microsoft :)
>//CheckForIllegalCrossThreadCalls = false;
>
>// Send command to read some date from the device
>rs232.WriteLine("A");
>
>string m;
>bool continua = true;
>while (continua)
>{
>m = Console.ReadLine();
>if (m=="q")
>{
>continua = false;
>}
>}
>
>}
>
>static void rs232_DataReceived(object sender,
> SerialDataReceivedEventArgs e)
>{
>dati += rs232.ReadExisting();
>if (dati.Contains("$"))
>{
>Console.WriteLine(dati);
>}
>}
>}
> }
>
>
> --
> View this message in context: 
> http://www.nabble.com/Mono-C--Serial-Port-problem-tp17241892p17753378.html
> Sent from the Mono - Dev mailing list archive at Nabble.com.
>
> ___
> Mono-devel-list mailing list
> Mono-devel-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>



-- 
MS-DOS user since 5.0
Windows user since 3.11
Linux user since kernel 2.4
Novell Netware user since 2.2
WARCRAFT user since 1.0
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Mono C# Serial Port problem

2008-06-10 Thread PaceyIV

Uhm...

Now I try the code below. It works on Microsoft Visual Studio, but not in
mono on Ubuntu.
It compile it, but when I try to run it I get this error:

Unhandled Exception: System.NotImplementedException: The requested feature
is not implemented.
  at System.IO.Ports.SerialPort.set_ReceivedBytesThreshold (Int32 value)
[0x00012] in
/build/buildd/mono-1.2.6+dfsg/mcs/class/System/System.IO.Ports/SerialPort.cs:410
 
  at (wrapper remoting-invoke-with-check)
System.IO.Ports.SerialPort:set_ReceivedBytesThreshold (int)
  at ConsoleApplication1.Program.Main (System.String[] args) [0x0004f] in
/home/paceyiv/programmazione/mono/Microsoft/Microsoft/Main.cs:29 

So I comment the line!
I think don't work the SerialDataReceivedEventHandler. I can write code to
read the byte from serial and the device respond, but the Serial Data
Received Event newer works on mono.

What's wrong?

using System;
using System.Collections.Generic;
//using System.Linq;
using System.Text;
using System.IO;
using System.IO.Ports;
using System.Threading;

namespace ConsoleApplication1
{
class Program
{
static System.IO.Ports.SerialPort rs232;

static string dati;

static void Main(string[] args)
{
// Setup RS-232
rs232 = new SerialPort("/dev/ttyUSB0", 9600);
// for Win
//rs232 = new SerialPort("COM3", 9600);
rs232.BaudRate = 9600;
rs232.Parity = Parity.None;
rs232.DataBits = 8;
rs232.StopBits = StopBits.One;
rs232.Handshake = Handshake.None;

//rs232.ReadTimeout = 2000;
//rs232.ReadBufferSize = 1024;
//rs232.ReceivedBytesThreshold = 1; // This don't work in mono!
rs232.DataReceived +=
new SerialDataReceivedEventHandler(rs232_DataReceived); //
This don't work in mono!

// Open SerialPort
try
{
rs232.Open();
// Do I really need this?
//rs232.DiscardInBuffer();
//rs232.DiscardOutBuffer();

// Dealy for my specific device
Thread.Sleep(1500);
}
catch (System.IO.IOException ioe)
{
Console.Write(ioe.Message);
Environment.Exit(1);
}

// survive to Microsoft :)
//CheckForIllegalCrossThreadCalls = false;

// Send command to read some date from the device
rs232.WriteLine("A");

string m;
bool continua = true;
while (continua)
{
m = Console.ReadLine();
if (m=="q")
{
continua = false;
}
}

}

static void rs232_DataReceived(object sender,
SerialDataReceivedEventArgs e)
{
dati += rs232.ReadExisting();
if (dati.Contains("$"))
{
Console.WriteLine(dati);
}
}
}
}


-- 
View this message in context: 
http://www.nabble.com/Mono-C--Serial-Port-problem-tp17241892p17753378.html
Sent from the Mono - Dev mailing list archive at Nabble.com.

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Mono C# Serial Port problem

2008-06-09 Thread Leszek Ciesielski
Hi,

I'm a little scared that you all want to fiddle with SerialPort
implementation. The Win32 and Linux versions work well and are
reasonably stable (there are some little fixes waiting in svn for
inclusion in next mono release - but you have very little chance of
actually bumping into the bugs they pertain to). And I can say they
ARE stable because I have code that communicates with more than 10
classes of COM-attached devices, using various transmission modes,
deployed on hundreds of machines. Believe me when I say the code is
well tested.

I cannot vouch for the OSX version, as we have not Apple machines. But
please do not needlessly throw away good, tested code because of some
anecdotal evidence.

BTW: the post that started this thread contains invalid code: it
creates the SerialPort in one thread and uses it in other. You cannot
do this.
And for the last post: it throws TimeoutException. Indicating that a
timeout occured. Do you actually have anything hooked up to the port
that should respond? Are you sure you got the connection parameters
right? Because the tomeout might just occur because nothing is there
to reply.
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Mono C# Serial Port problem

2008-06-08 Thread PaceyIV

I have the same problem.
I compile the code located at
http://www.mono-project.com/HowToSystemIOPorts.
When I run it I get this:

Unhandled Exception: System.TimeoutException: The operation has timed-out.
  at System.IO.Ports.SerialPortStream.Read (System.Byte[] buffer, Int32
offset, Int32 count) [0x0] 
  at System.IO.Ports.SerialPort.read_byte () [0x0] 
  at System.IO.Ports.SerialPort.ReadByte () [0x0] 
  at (wrapper remoting-invoke-with-check)
System.IO.Ports.SerialPort:ReadByte ()
  at SerialPortTest.ReadData () [0x6] in
/home/paceyiv/programmazione/momo/SerialPortTest/SerialPortTest/Main.cs:44 
  at SerialPortTest.Test () [0x00062] in
/home/paceyiv/programmazione/momo/SerialPortTest/SerialPortTest/Main.cs:36 
  at SerialPortTest.Main (System.String[] args) [0x6] in
/home/paceyiv/programmazione/momo/SerialPortTest/SerialPortTest/Main.cs:14 


I've got Ubuntu 8.04, Kernel Linux 2.6.25
-- 
View this message in context: 
http://www.nabble.com/Mono-C--Serial-Port-problem-tp17241892p17699462.html
Sent from the Mono - Dev mailing list archive at Nabble.com.

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Mono C# Serial Port problem

2008-05-30 Thread Carlos Alberto Cortez
Would you mind filling a bug with the precise information?

Thanks,
Carlos.


El jue, 29-05-2008 a las 02:24 -0700, Bs360 escribió:
> 
> 
> Alan_Chun wrote:
> > 
> > HI, currently I am porting a windows app to linux using Mono. I have some
> > difficulties to get the serial port work. here is the code(based on mono
> > website):
> > 
> > 
> > I have also tried BytesToRead, Read, ReadByte, all of them are working
> > fine under windows using .net2.0 framwork. But once I use the mono
> > runtime, the nightmare begins.
> > 
> > Any help will be really apprecaited!
> > 
> > Thanks  
> > 
> 
> I'm actually having the same problem. I'm using ubuntu 8.04.

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Mono C# Serial Port problem

2008-05-30 Thread Shawn Schaerer

Hi,

I hope to have our OSX implementation up in the next couple of days.   
This implementation should work under linux too!!


I am also looking at the serial.c  source and will try to get that to  
work under OSX  as well.


I will send the link ASAP.

Shawn Schaerer
Director of Research and Development
Cogmation Robotics Inc
www.cogmation.com




On 30-May-08, at 12:03 PM, [EMAIL PROTECTED]  
wrote:





Alan_Chun wrote:


HI, currently I am porting a windows app to linux using Mono. I  
have some
difficulties to get the serial port work. here is the code(based  
on mono

website):


I have also tried BytesToRead, Read, ReadByte, all of them are  
working

fine under windows using .net2.0 framwork. But once I use the mono
runtime, the nightmare begins.

Any help will be really apprecaited!

Thanks



I'm actually having the same problem. I'm using ubuntu 8.04.
--


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Mono C# Serial Port problem

2008-05-30 Thread Bs360



Alan_Chun wrote:
> 
> HI, currently I am porting a windows app to linux using Mono. I have some
> difficulties to get the serial port work. here is the code(based on mono
> website):
> 
> 
> I have also tried BytesToRead, Read, ReadByte, all of them are working
> fine under windows using .net2.0 framwork. But once I use the mono
> runtime, the nightmare begins.
> 
> Any help will be really apprecaited!
> 
> Thanks  
> 

I'm actually having the same problem. I'm using ubuntu 8.04.
-- 
View this message in context: 
http://www.nabble.com/Mono-C--Serial-Port-problem-tp17241892p17530860.html
Sent from the Mono - Dev mailing list archive at Nabble.com.

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Mono C# Serial Port problem

2008-05-21 Thread Shawn Schaerer

Thanks.,

I will look in to it and see if we can fix the osx version.  Most  
likely it is a tty setting that has not been set,  in OSX Unix there  
are a couple of settings that need to be set or the port does not work.


Shawn Schaerer
Director of Research and Development
Cogmation Robotics Inc
www.cogmation.com




On 21-May-08, at 1:43 PM, Carlos Alberto Cortez wrote:


Hello,




The issue with our code is that we call the Mono posix libraries,  
this

is not cross platform.



Our implementation uses the Win32 api in windows and posix calls  
with a C helper layer in Unix platforms.


Observe that we never tested it with Mac.

Since you are using the Mono.Posix library in Mac, it's likely  
possible

to use the same functionality using our C helper layer (it resides in
mono/support/serial.c). Probably we need to apply a pair of  
corrections

there, however.

Carlos.




___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Mono C# Serial Port problem

2008-05-21 Thread Carlos Alberto Cortez
Hello,


> 
> The issue with our code is that we call the Mono posix libraries, this
> is not cross platform.


Our implementation uses the Win32 api in windows and posix calls with a C 
helper layer in Unix platforms. 

Observe that we never tested it with Mac.

Since you are using the Mono.Posix library in Mac, it's likely possible
to use the same functionality using our C helper layer (it resides in
mono/support/serial.c). Probably we need to apply a pair of corrections
there, however.

Carlos.


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Mono C# Serial Port problem

2008-05-21 Thread Jim Redman
Shawn,

I don't know whether it's helpful, but the RXTX implementation of the 
JavaComm API is available on a huge range of platforms - and it runs 
under Mono after IKVMC'ing it.

Since the portability of the native code is your issue you may want to 
take a look at what they have.  The .NET underlying native code 
requirements can't be much different from Java's - there's not much 
imagination to be applied to serial ports.  If you could reuse it with 
or without modifications, you'd have a well tested, portable, base.

Jim

Shawn Schaerer wrote:
> Hi,
> 
> We could turn this into a new implementation.  The serial port is a 
> major component robotics.
> 
> The issue with our code is that we call the Mono posix libraries, this 
> is not cross platform.
> 
> Is this a problem ?  If not we can work on the new serial port 
> implementation.
> 
> In any case we will put it up on our site in the next couple of days
> 
> Shawn Schaerer
> Director of Research and Development
> Cogmation Robotics Inc
> http://www.cogmation.com
> 
> 
> 
> 
> On 20-May-08, at 4:04 PM, Miguel de Icaza wrote:
> 
>>
>>>
>>> No we do not have it on the web, but we are willing to put it up and
>>> or submit it to the mono-project.
>>
>> Would it be possible to turn this new implementation into something that
>> would fix the existing System.IO.Serial implementation?
>>
>> We do not really use serial devices so we barely touch this code, most
>> of the code in that namespace has been written and later fixed by people
>> that have had a particular problem that they absolutely had to have
>> fixed.
>>
>>>
>>>
>>>
>>>
>>>
>>> Shawn Schaerer
>>> Director of Research and Development
>>> Cogmation Robotics Inc
>>> www.cogmation.com
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> On 16-May-08, at 11:00 AM, Xavi de Blas wrote:
>>>
 Shwn: Do you have this reimlemenation of serial n OsX on the net? is
 it free software?


 Thanks


 2008/5/16, Shawn Schaerer <[EMAIL PROTECTED] 
 >:
> Hi,
>
>
> We also have problems with the serial port under OSX.  We had to
> re-
> implement most of the serial port unsing posix call.
>
>
> Can you actually get any data out of the port ?
>
>
> Shawn Schaerer
> Director of Research and Development
> Cogmation Robotics Inc
> www.cogmation.com
>
>
>
>
>
>
>
>
>
>


>>>
>>>
>>> ___
>>> 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

-- 
Jim Redman
(505) 662 5156 x85
http://www.ergotech.com
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Mono C# Serial Port problem

2008-05-21 Thread Shawn Schaerer

Hi,

We could turn this into a new implementation.  The serial port is a  
major component robotics.


The issue with our code is that we call the Mono posix libraries,  
this is not cross platform.


Is this a problem ?  If not we can work on the new serial port  
implementation.


In any case we will put it up on our site in the next couple of days

Shawn Schaerer
Director of Research and Development
Cogmation Robotics Inc
http://www.cogmation.com




On 20-May-08, at 4:04 PM, Miguel de Icaza wrote:





No we do not have it on the web, but we are willing to put it up and
or submit it to the mono-project.


Would it be possible to turn this new implementation into something  
that

would fix the existing System.IO.Serial implementation?

We do not really use serial devices so we barely touch this code, most
of the code in that namespace has been written and later fixed by  
people

that have had a particular problem that they absolutely had to have
fixed.







Shawn Schaerer
Director of Research and Development
Cogmation Robotics Inc
www.cogmation.com







On 16-May-08, at 11:00 AM, Xavi de Blas wrote:


Shwn: Do you have this reimlemenation of serial n OsX on the net? is
it free software?


Thanks


2008/5/16, Shawn Schaerer <[EMAIL PROTECTED]>:

Hi,


We also have problems with the serial port under OSX.  We had to
re-
implement most of the serial port unsing posix call.


Can you actually get any data out of the port ?


Shawn Schaerer
Director of Research and Development
Cogmation Robotics Inc
www.cogmation.com
















___
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] Mono C# Serial Port problem

2008-05-20 Thread Miguel de Icaza

> 
> No we do not have it on the web, but we are willing to put it up and
> or submit it to the mono-project.

Would it be possible to turn this new implementation into something that
would fix the existing System.IO.Serial implementation?

We do not really use serial devices so we barely touch this code, most
of the code in that namespace has been written and later fixed by people
that have had a particular problem that they absolutely had to have
fixed.

> 
> 
> 
> 
> 
> Shawn Schaerer
> Director of Research and Development
> Cogmation Robotics Inc
> www.cogmation.com
> 
> 
> 
> 
> 
> 
> 
> On 16-May-08, at 11:00 AM, Xavi de Blas wrote:
> 
> > Shwn: Do you have this reimlemenation of serial n OsX on the net? is
> > it free software?
> > 
> > 
> > Thanks
> > 
> > 
> > 2008/5/16, Shawn Schaerer <[EMAIL PROTECTED]>:
> > > Hi,
> > > 
> > > 
> > > We also have problems with the serial port under OSX.  We had to
> > > re-
> > > implement most of the serial port unsing posix call.
> > > 
> > > 
> > > Can you actually get any data out of the port ?
> > > 
> > > 
> > > Shawn Schaerer
> > > Director of Research and Development
> > > Cogmation Robotics Inc
> > > www.cogmation.com
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > 
> > 
> 
> 
> ___
> 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] Mono C# Serial Port problem

2008-05-17 Thread Xavi de Blas
Ok, it will be really useeful for us because we are working on porting
our program to OSX without success.

Please, let me know when you publish it

Thanks

2008/5/16 Shawn Schaerer <[EMAIL PROTECTED]>:
> Hi,
> No we do not have it on the web, but we are willing to put it up and or
> submit it to the mono-project.
>
>
> Shawn Schaerer
> Director of Research and Development
> Cogmation Robotics Inc
> www.cogmation.com
>
>
>
> On 16-May-08, at 11:00 AM, Xavi de Blas wrote:
>
> Shwn: Do you have this reimlemenation of serial n OsX on the net? is
> it free software?
> Thanks
> 2008/5/16, Shawn Schaerer <[EMAIL PROTECTED]>:
>
> Hi,
> We also have problems with the serial port under OSX.  We had to re-
> implement most of the serial port unsing posix call.
> Can you actually get any data out of the port ?
> Shawn Schaerer
> Director of Research and Development
> Cogmation Robotics Inc
> www.cogmation.com
>
>
>
>
>
>
>
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Mono C# Serial Port problem

2008-05-16 Thread Shawn Schaerer

Hi,

No we do not have it on the web, but we are willing to put it up and  
or submit it to the mono-project.




Shawn Schaerer
Director of Research and Development
Cogmation Robotics Inc
www.cogmation.com




On 16-May-08, at 11:00 AM, Xavi de Blas wrote:


Shwn: Do you have this reimlemenation of serial n OsX on the net? is
it free software?

Thanks

2008/5/16, Shawn Schaerer <[EMAIL PROTECTED]>:

Hi,

We also have problems with the serial port under OSX.  We had to re-
implement most of the serial port unsing posix call.

Can you actually get any data out of the port ?

Shawn Schaerer
Director of Research and Development
Cogmation Robotics Inc
www.cogmation.com









___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Mono C# Serial Port problem

2008-05-16 Thread Xavi de Blas
Shwn: Do you have this reimlemenation of serial n OsX on the net? is
it free software?

Thanks

2008/5/16, Shawn Schaerer <[EMAIL PROTECTED]>:
> Hi,
>
> We also have problems with the serial port under OSX.  We had to re-
> implement most of the serial port unsing posix call.
>
> Can you actually get any data out of the port ?
>
> Shawn Schaerer
> Director of Research and Development
> Cogmation Robotics Inc
> www.cogmation.com
>
>
>
>
>
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Mono C# Serial Port problem

2008-05-16 Thread Shawn Schaerer

Hi,

We also have problems with the serial port under OSX.  We had to re- 
implement most of the serial port unsing posix call.


Can you actually get any data out of the port ?

Shawn Schaerer
Director of Research and Development
Cogmation Robotics Inc
www.cogmation.com




___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Mono C# Serial Port problem

2008-05-16 Thread Panoramix

In Linux to use a device the user who requires access should have the
permission to use it. 
So you must verify that the user starts the application is registered in the
group owner of ttysN. 
To find out the group owner of the device by a shell run the command below:
 
ls-al / dev / ttyS *




Alan_Chun wrote:
> 
> HI, currently I am porting a windows app to linux using Mono. I have some
> difficulties to get the serial port work. here is the code(based on mono
> website):
> 
>  public static void Main(string[] args)
> {
> SerialPortTest myTest = new SerialPortTest();
> myTest.Test();
>
> }
> 
> private SerialPort mySerial;
> 
> // Constructor
> public SerialPortTest()
> {
> }
> 
> public void Test()
> {
> Console.WriteLine("Begin");
> if (mySerial != null)
> if (mySerial.IsOpen)
> mySerial.Close();
> 
> mySerial = new System.IO.Ports.SerialPort("COM3", 9600,
> Parity.Even, 7, StopBits.One);
> mySerial.Open();
> mySerial.DtrEnable = true;
> mySerial.RtsEnable = true;
> mySerial.Handshake = System.IO.Ports.Handshake.None;
> mySerial.ReadTimeout = 400;
> Thread t = new Thread(new ThreadStart(DataReceived));
> 
> t.Start();
>  string tmp = "5D.1";
>
>  SendData(tmp);
> 
> // Should output some information about your modem firmware
> //Console.WriteLine("Baaa");
>// Console.WriteLine(ReadData());
> }
> 
> public void DataReceived()
> {
> while (true)
> {
> byte tmpByte = 255;
> string rxString = "";
> //int tot = mySerial.BytesToRead;
> tmpByte = (byte)mySerial.ReadByte();
>  
> while (tmpByte != 255)
> {
> rxString += ((char)tmpByte);
>  mpByte = (byte)mySerial.ReadByte();
> }
>   if (!string.IsNullOrEmpty(rxString))
>   Console.WriteLine(rxString);
> }
> //return rxString;
> }
> 
> I ran this under windows using .netframwork run time, it is fine but under
> mono I always got this exception:
> 
> 
> Unhandled Exception: System.NullReferenceException: Object reference not
> set to an instance of an object
>   at (wrapper managed-to-native)
> System.IO.Ports.WinSerialStream:ClearCommError
> (int,System.IO.Ports.CommStat&)
>   at System.IO.Ports.WinSerialStream.get_BytesToRead () [0x0]
>   at System.IO.Ports.SerialPort.get_BytesToRead () [0x0]
>   at (wrapper remoting-invoke-with-check)
> System.IO.Ports.SerialPort:get_BytesToRead ()
>   at SerialPortTest.DataReceived () [0x0]
> 
> 
> 
> 
> I have also tried BytesToRead, Read, ReadByte, all of them are working
> fine under windows using .net2.0 framwork. But once I use the mono
> runtime, the nightmare begins.
> 
> Any help will be really apprecaited!
> 
> Thanks  
> 


-
:working:
-
http://freeflow.awardspace.com http://freeflow.awardspace.com 
-

-- 
View this message in context: 
http://www.nabble.com/Mono-C--Serial-Port-problem-tp17241892p17247791.html
Sent from the Mono - Dev mailing list archive at Nabble.com.

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Mono C# Serial Port problem

2008-05-15 Thread Xavi de Blas
Hello, you can take a look at chronojump code. It uses serial port on
both platforms:

http://svn.gnome.org/viewvc/chronojump/trunk/src/chronopic.cs?revision=383&view=markup
http://svn.gnome.org/viewvc/chronojump/trunk/src/chronojump_mini.cs?revision=364&view=markup

It's a pity this two parts are not written/commented in english

Luck


2008/5/15 Alan_Chun <[EMAIL PROTECTED]>:
>
> HI, currently I am porting a windows app to linux using Mono. I have some
> difficulties to get the serial port work. here is the code(based on mono
> website):
>
>  public static void Main(string[] args)
>{
>SerialPortTest myTest = new SerialPortTest();
>myTest.Test();
>
>}
>
>private SerialPort mySerial;
>
>// Constructor
>public SerialPortTest()
>{
>}
>
>public void Test()
>{
>Console.WriteLine("Begin");
>if (mySerial != null)
>if (mySerial.IsOpen)
>mySerial.Close();
>
>mySerial = new System.IO.Ports.SerialPort("COM3", 9600, Parity.Even,
> 7, StopBits.One);
>mySerial.Open();
>mySerial.DtrEnable = true;
>mySerial.RtsEnable = true;
>mySerial.Handshake = System.IO.Ports.Handshake.None;
>mySerial.ReadTimeout = 400;
>Thread t = new Thread(new ThreadStart(DataReceived));
>
>t.Start();
> string tmp = "5D.1";
>
> SendData(tmp);
>
>// Should output some information about your modem firmware
>//Console.WriteLine("Baaa");
>   // Console.WriteLine(ReadData());
>}
>
>public void DataReceived()
>{
>while (true)
>{
>byte tmpByte = 255;
>string rxString = "";
>//int tot = mySerial.BytesToRead;
>tmpByte = (byte)mySerial.ReadByte();
>
>while (tmpByte != 255)
>{
>rxString += ((char)tmpByte);
> mpByte = (byte)mySerial.ReadByte();
>}
>  if (!string.IsNullOrEmpty(rxString))
>  Console.WriteLine(rxString);
>}
>//return rxString;
>}
>
> I ran this under windows using .netframwork run time, it is fine but under
> mono I always got this exception:
>
>
> Unhandled Exception: System.NullReferenceException: Object reference not set
> to an instance of an object
>  at (wrapper managed-to-native)
> System.IO.Ports.WinSerialStream:ClearCommError
> (int,System.IO.Ports.CommStat&)
>  at System.IO.Ports.WinSerialStream.get_BytesToRead () [0x0]
>  at System.IO.Ports.SerialPort.get_BytesToRead () [0x0]
>  at (wrapper remoting-invoke-with-check)
> System.IO.Ports.SerialPort:get_BytesToRead ()
>  at SerialPortTest.DataReceived () [0x0]
>
>
>
>
> I have also tried BytesToRead, Read, ReadByte, all of them are working fine
> under windows using .net2.0 framwork. But once I use the mono runtime, the
> nightmare begins.
>
> Any help will be really apprecaited!
>
> Thanks
> --
> View this message in context: 
> http://www.nabble.com/Mono-C--Serial-Port-problem-tp17241892p17241892.html
> Sent from the Mono - Dev mailing list archive at Nabble.com.
>
> ___
> 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] Mono C# Serial Port problem

2008-05-15 Thread Carlos Alberto Cortez
That's likely because 'mono test.exe' actually uses mono, and
'test.exe' runs .net instead.

This appears to be a bug.

Please fill a bug report with the attached repro.

Thanks!
Carlos


El jue, 15-05-2008 a las 12:01 -0700, Alan_Chun escribió:
> 
> 
> Panoramix wrote:
> > 
> > In Linux to use a device the user who requires access should have the
> > permission to use it. 
> > So you must verify that the user starts the application is registered in
> > the group owner of ttysN. 
> > To find out the group owner of the device by a shell run the command
> > below:
> >  
> > ls-al / dev / ttyS *
> > 
> > 
> 
> I haven't tried it under linux yet. What I meant is when I ran the
> exeutable, if I use "mono test.exe" through windows xp's command line, it
> will generate this error. However, if ran this exe directly (use "test.exe"
> only on the command line without mono), it worked fine.
> 
> Any ideas?
> 
> Thanks 
> 

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Mono C# Serial Port problem

2008-05-15 Thread Alan_Chun



Panoramix wrote:
> 
> In Linux to use a device the user who requires access should have the
> permission to use it. 
> So you must verify that the user starts the application is registered in
> the group owner of ttysN. 
> To find out the group owner of the device by a shell run the command
> below:
>  
> ls-al / dev / ttyS *
> 
> 

I haven't tried it under linux yet. What I meant is when I ran the
exeutable, if I use "mono test.exe" through windows xp's command line, it
will generate this error. However, if ran this exe directly (use "test.exe"
only on the command line without mono), it worked fine.

Any ideas?

Thanks 

-- 
View this message in context: 
http://www.nabble.com/Mono-C--Serial-Port-problem-tp17241892p17253076.html
Sent from the Mono - Dev mailing list archive at Nabble.com.

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Mono C# Serial Port problem

2008-05-15 Thread Leszek Ciesielski
Try creating the SerialPort in the same Thread that uses it afterwards.
On Thu, May 15, 2008 at 4:49 PM, Alan_Chun <[EMAIL PROTECTED]> wrote:
>
> Hi Arek,
> That's the whole .cs file I have.
> I know it looks strange but under mono, the data received event is not
> working. That's why I create another thread to do data polling. Maybe you
> have better ways to do that?
>
> Thanks
>
> Arek Waliszewski wrote:
>>
>> Alan_Chun pisze:
>>> HI, currently I am porting a windows app to linux using Mono. I have some
>>> difficulties to get the serial port work. here is the code(based on mono
>>> website):
>>>
>> Could you post whole of your program.
>> It looks like you are trying to open serial port in the main thread,
>> then create additional thread that reads something from the serial port,
>> while your main thread is sending something... It looks at least
>> weird... It looks bad.
>>
>> Regards,
>> Arek
>>
>>
>> ___
>> Mono-devel-list mailing list
>> Mono-devel-list@lists.ximian.com
>> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>>
>>
>
> --
> View this message in context: 
> http://www.nabble.com/Mono-C--Serial-Port-problem-tp17241892p17255001.html
> Sent from the Mono - Dev mailing list archive at Nabble.com.
>
> ___
> Mono-devel-list mailing list
> Mono-devel-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>



-- 
MS-DOS user since 5.0
Windows user since 3.11
Linux user since kernel 2.4
Novell Netware user since 2.2
WARCRAFT user since 1.0
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Mono C# Serial Port problem

2008-05-15 Thread Alan_Chun

Hi Arek, 
That's the whole .cs file I have.
I know it looks strange but under mono, the data received event is not
working. That's why I create another thread to do data polling. Maybe you
have better ways to do that?

Thanks 

Arek Waliszewski wrote:
> 
> Alan_Chun pisze:
>> HI, currently I am porting a windows app to linux using Mono. I have some
>> difficulties to get the serial port work. here is the code(based on mono
>> website):
>>   
> Could you post whole of your program.
> It looks like you are trying to open serial port in the main thread, 
> then create additional thread that reads something from the serial port, 
> while your main thread is sending something... It looks at least 
> weird... It looks bad.
> 
> Regards,
> Arek
> 
> 
> ___
> Mono-devel-list mailing list
> Mono-devel-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Mono-C--Serial-Port-problem-tp17241892p17255001.html
Sent from the Mono - Dev mailing list archive at Nabble.com.

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Mono C# Serial Port problem

2008-05-15 Thread Arek Waliszewski
Alan_Chun pisze:
> HI, currently I am porting a windows app to linux using Mono. I have some
> difficulties to get the serial port work. here is the code(based on mono
> website):
>   
Could you post whole of your program.
It looks like you are trying to open serial port in the main thread, 
then create additional thread that reads something from the serial port, 
while your main thread is sending something... It looks at least 
weird... It looks bad.

Regards,
Arek


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Mono C# Serial Port problem

2008-05-15 Thread [EMAIL PROTECTED]
Alan_Chun wrote:
> HI, currently I am porting a windows app to linux using Mono. I have some
> difficulties to get the serial port work. here is the code(based on mono
> website):
>
>   
Hi Alan, cna you test this code in linux? (using of course /dev/ttyS0 or 
the correct serial device), I use lot of serial communications with mono 
inlinux and work ok, I don't know the current status of mono serialport 
in windows...also be sure to use kernel 2.6.24 or up in linux..

>  public static void Main(string[] args)
> {
> SerialPortTest myTest = new SerialPortTest();
> myTest.Test();
>
> }
>
> private SerialPort mySerial;
>
> // Constructor
> public SerialPortTest()
> {
> }
>
> public void Test()
> {
> Console.WriteLine("Begin");
> if (mySerial != null)
> if (mySerial.IsOpen)
> mySerial.Close();
>
> mySerial = new System.IO.Ports.SerialPort("COM3", 9600, Parity.Even,
> 7, StopBits.One);
> mySerial.Open();
> mySerial.DtrEnable = true;
> mySerial.RtsEnable = true;
> mySerial.Handshake = System.IO.Ports.Handshake.None;
> mySerial.ReadTimeout = 400;
> Thread t = new Thread(new ThreadStart(DataReceived));
>
> t.Start();
>  string tmp = "5D.1";
>
>  SendData(tmp);
>
> // Should output some information about your modem firmware
> //Console.WriteLine("Baaa");
>// Console.WriteLine(ReadData());
> }
>
> public void DataReceived()
> {
> while (true)
> {
> byte tmpByte = 255;
> string rxString = "";
> //int tot = mySerial.BytesToRead;
> tmpByte = (byte)mySerial.ReadByte();
>  
> while (tmpByte != 255)
> {
> rxString += ((char)tmpByte);
>  mpByte = (byte)mySerial.ReadByte();
> }
>   if (!string.IsNullOrEmpty(rxString))
>   Console.WriteLine(rxString);
> }
> //return rxString;
> }
>
> I ran this under windows using .netframwork run time, it is fine but under
> mono I always got this exception:
>
>
> Unhandled Exception: System.NullReferenceException: Object reference not set
> to an instance of an object
>   at (wrapper managed-to-native)
> System.IO.Ports.WinSerialStream:ClearCommError
> (int,System.IO.Ports.CommStat&)
>   at System.IO.Ports.WinSerialStream.get_BytesToRead () [0x0]
>   at System.IO.Ports.SerialPort.get_BytesToRead () [0x0]
>   at (wrapper remoting-invoke-with-check)
> System.IO.Ports.SerialPort:get_BytesToRead ()
>   at SerialPortTest.DataReceived () [0x0]
>
>
>
>
> I have also tried BytesToRead, Read, ReadByte, all of them are working fine
> under windows using .net2.0 framwork. But once I use the mono runtime, the
> nightmare begins.
>
> Any help will be really apprecaited!
>
> Thanks  
>   

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] Mono C# Serial Port problem

2008-05-15 Thread Alan_Chun

HI, currently I am porting a windows app to linux using Mono. I have some
difficulties to get the serial port work. here is the code(based on mono
website):

 public static void Main(string[] args)
{
SerialPortTest myTest = new SerialPortTest();
myTest.Test();
   
}

private SerialPort mySerial;

// Constructor
public SerialPortTest()
{
}

public void Test()
{
Console.WriteLine("Begin");
if (mySerial != null)
if (mySerial.IsOpen)
mySerial.Close();

mySerial = new System.IO.Ports.SerialPort("COM3", 9600, Parity.Even,
7, StopBits.One);
mySerial.Open();
mySerial.DtrEnable = true;
mySerial.RtsEnable = true;
mySerial.Handshake = System.IO.Ports.Handshake.None;
mySerial.ReadTimeout = 400;
Thread t = new Thread(new ThreadStart(DataReceived));

t.Start();
 string tmp = "5D.1";
   
 SendData(tmp);

// Should output some information about your modem firmware
//Console.WriteLine("Baaa");
   // Console.WriteLine(ReadData());
}

public void DataReceived()
{
while (true)
{
byte tmpByte = 255;
string rxString = "";
//int tot = mySerial.BytesToRead;
tmpByte = (byte)mySerial.ReadByte();
 
while (tmpByte != 255)
{
rxString += ((char)tmpByte);
 mpByte = (byte)mySerial.ReadByte();
}
  if (!string.IsNullOrEmpty(rxString))
  Console.WriteLine(rxString);
}
//return rxString;
}

I ran this under windows using .netframwork run time, it is fine but under
mono I always got this exception:


Unhandled Exception: System.NullReferenceException: Object reference not set
to an instance of an object
  at (wrapper managed-to-native)
System.IO.Ports.WinSerialStream:ClearCommError
(int,System.IO.Ports.CommStat&)
  at System.IO.Ports.WinSerialStream.get_BytesToRead () [0x0]
  at System.IO.Ports.SerialPort.get_BytesToRead () [0x0]
  at (wrapper remoting-invoke-with-check)
System.IO.Ports.SerialPort:get_BytesToRead ()
  at SerialPortTest.DataReceived () [0x0]




I have also tried BytesToRead, Read, ReadByte, all of them are working fine
under windows using .net2.0 framwork. But once I use the mono runtime, the
nightmare begins.

Any help will be really apprecaited!

Thanks  
-- 
View this message in context: 
http://www.nabble.com/Mono-C--Serial-Port-problem-tp17241892p17241892.html
Sent from the Mono - Dev mailing list archive at Nabble.com.

___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list