jcurl / RJCP.DLL.SerialPortStream

SerialPortStream is an independent implementation of System.IO.Ports.SerialPort and SerialStream for better reliability and maintainability. Default branch is 2.x and now has support for Mono with help of a C library.
Microsoft Public License
624 stars 197 forks source link

COM Port with FILE_TYPE_DISK throwing exception #64

Closed ekarcnevets closed 5 years ago

ekarcnevets commented 6 years ago

Hi, I have recently tried to use your library with a usb-serial converter I've got. I was getting an error when calling Open() 'Wrong file type: COM10'. This comes from here.

There is no problem reading the COM port in Putty, so I tried building the dll myself, with the check commented out and the data comes through fine in the library.

Is the file type being disk unusual, and just a quirk of this device?

Thanks.

jcurl commented 6 years ago

Thanks for the report. Can you please tell me the device?

Why would a COM port say it's a disk? The purpose of this code is to avoid a user trying to open a non-COM device and causing potential damage.

jcurl commented 6 years ago

Does the device show up when using the GetPortNames API?

ekarcnevets commented 6 years ago

I understand it's a little strange. The device is https://www.u-blox.com/en/product/neo-m8u-module. UBlox supplies a 'virtual com port' driver for it.

Yes, it shows up when using the GetPortNames API.

mike-ody-orica commented 5 years ago

I too am working with a u-blox GPS receiver via a virtual COM port and would like to use SerialPortStream. Is there an ETA for an official fix for this issue? Is the only workaround to recompile the library without the file type check?

jcurl commented 5 years ago

I've created a small patch. Can you please test the branch "feature/issue-64" that it solves your problem? If so, then I'll push it to the v2.x branch and prepare it for the next release.

mike-ody-orica commented 5 years ago

Many thanks @jcurl . I have tested the NET Standard 1.5 build of feature/issue-64 and it works fine with my u-blox receiver.