Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

COM Port with FILE_TYPE_DISK throwing exception #64

Closed
ekarcnevets opened this issue Jul 30, 2018 · 6 comments
Closed

COM Port with FILE_TYPE_DISK throwing exception #64

ekarcnevets opened this issue Jul 30, 2018 · 6 comments
Assignees

Comments

@ekarcnevets
Copy link

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
Copy link
Owner

jcurl commented Jul 30, 2018

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
Copy link
Owner

jcurl commented Jul 30, 2018

Does the device show up when using the GetPortNames API?

@ekarcnevets
Copy link
Author

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
Copy link

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 added a commit that referenced this issue Oct 14, 2018
Some devices, e.g. a uBlox is incorrectly registered in Windows as a file device. This prevents the port from being opened. In this case, check as a last resort that the port exists in the registry. If so, then open it anyway.

Issue: #64, DOTNET-169
@jcurl
Copy link
Owner

jcurl commented Oct 14, 2018

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.

@jcurl jcurl self-assigned this Oct 14, 2018
@mike-ody-orica
Copy link

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.

@jcurl jcurl closed this as completed Oct 15, 2018
digitalcoyote pushed a commit to digitalcoyote/SerialPortStream that referenced this issue Jul 3, 2019
Some devices, e.g. a uBlox is incorrectly registered in Windows as a file device. This prevents the port from being opened. In this case, check as a last resort that the port exists in the registry. If so, then open it anyway.

Issue: jcurl#64, DOTNET-169
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants