Can't read from USB device in C# on Mono

Mono 2.6.3 MonoDevelop 2.2 openSUSE 11.2

I'm trying to read from a CP2102 USB device.  The program works when running in Windows but not when on Linux.  The comport.DataReceived event does not fire.  

I'm using /dev/ttyUSB0 as the comport.portName value which is the only ttyUSB value that shows up in my dir list.  Is that the correct value to be using?

crw-rw----  1 root dialout 188,   0 2010-04-10 11:45 ttyUSB0

lsusb shows:
Bus 004 Device 003: ID 10c4:ea60 Cygnal Integrated Products, Inc. CP210x Composite Device

I looked in yast's hardware information and under USB it shows the CP2102 (/dev/ttyUSB0), Drivers Active:Yes so I assume the drivers are in place.  Here's the code I'm using:


            comport = new SerialPort();
            comport.DataReceived += new SerialDataReceivedEventHandler(port_DataReceived);
            comport.BaudRate = 128000;
            comport.DataBits = 8;
            comport.StopBits = StopBits.One;
            comport.Parity = Parity.None;
            comport.Handshake = Handshake.None;
            comport.ReadTimeout = 500;
            comport.WriteTimeout = 500;
            comport.PortName = "/dev/ttyUSB0";
            comport.Open();
            comport.DtrEnable = true;


...

        private void port_DataReceived(object sender, SerialDataReceivedEventArgs e)
        {
            getPortData();  // Never gets fired
        }

Can anyone tell me what might be stopping the DataReceived event from firing?

Thanks,

sr
StarDusterIIAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

StarDusterIIAuthor Commented:
As I said in my first post, the program is working in WIndows so I don't really need the reference for writing to a USB device.  What I was looking for was why it wan't working in Mono on Linux... which I found myself.

Apparently, the DataReceived event hasn't been implemented in the Mono .Net runtime.  So, I had to set up a thread to continually check BytesToRead.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux Distributions

From novice to tech pro — start learning today.