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


           Summary: On Mac OS X, System.IO.Ports.SerialPort cannot read data
                    using any Read* method.
           Product: Mono: Class Libraries
           Version: 1.9.0
          Platform: Macintosh
        OS/Version: Mac OS X 10.4
            Status: NEW
          Severity: Blocker
          Priority: P5 - None
         Component: System
        AssignedTo: [email protected]
        ReportedBy: [EMAIL PROTECTED]
         QAContact: [email protected]
          Found By: Third Party Developer/Partner



Chris Walker <[EMAIL PROTECTED]> changed:

           What    |Removed                                         |Added
----------------------------------------------------------------------------
               Flag|                                                
|SHIP_STOPPER?, CCB_Review?


Scenario:
Under Mac OS X, a simple Mono application is created to open a serial port,
watch for available data, and then read that data.

Problem:
Whenever the .Read(...), .ReadByte(), or even .SerialBase.Read(...) methods are
called, Mono throws a TimeoutException.  It is impossible to read data from the
serial port.

More details:
If the .ReadTimeout property is set to 1, 400, 4000, 40000, or Infinite, the
TimeoutException is still thrown.  It is thrown pretty much immediately.  This
happens even when .BytesToRead is showing hundreds of bytes available.
This has been tested with both a USB adapter (Socket Bluetooth Serial Adapter)
and a Serial adapter (Socket USB Serial Adapter).

Expected behavior:
At least one of the .Read* function calls should read data.

Sample code:
---8<------8<--- Sample code --->8--->8---
using System.IO.Ports;
..
SerialPort serialPort = new SerialPort("/dev/tty.usbserial-SC51BZ99", 115200);
serialPort.Open();

// NOTE: it doesn't matter what this value is set to or if it set...
serialPort.ReadTimeout = SerialPort.InfiniteTimeout;

while (true)
{
    int bytesToRead = m_SerialPort.BytesToRead;
    if (bytesToRead > 0)
    {
        try
        {
            int value = serialPort.ReadByte();
            Console.WriteLine("value: " + value.ToString()); // we never get
here.
        }
        catch (TimeoutException ex)
        {
            // our Read call _always_ throws a TimeoutException
            Console.Write("Impossible!  We just timed out with
InfiniteTimeout!");
        }
    }
    System.Threading.Thread.Sleep(1);
}
---8<------8<--- End sample --->8--->8---


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
_______________________________________________
mono-bugs maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-bugs

Reply via email to