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

Specified port, COMX, does not exist (Windows) #84

Closed
anderwm opened this issue Dec 11, 2014 · 5 comments
Closed

Specified port, COMX, does not exist (Windows) #84

anderwm opened this issue Dec 11, 2014 · 5 comments

Comments

@anderwm
Copy link

anderwm commented Dec 11, 2014

Just an FYI. There seems to be some port number, beyond which the Serial constructor throws a IO Exception on Windows. When my device was enumerated at COM20 (with -e in test_serial), trying to connect to it throws. When I changed to COM2 it worked as expected. I have had this problem with Windows software before so I knew to try that...I can't remember the root cause.

C:\Users\AndersonM\Documents\Visual Studio 2013\Projects\wjwwood-serial-6e47bdd\
visual_studio\Debug>test_serial.exe -e
(COM20, USB Serial Port (COM20), FTDIBUS\COMPORT&VID_0403&PID_6001)

C:\Users\AndersonM\Documents\Visual Studio 2013\Projects\wjwwood-serial-6e47bdd\
visual_studio\Debug>test_serial.exe "COM20" 57600
Unhandled Exception: IO Exception: Specified port, COM20, does not exist., file
c:\users\andersonm\documents\visual studio 2013\projects\wjwwood-serial-6e47bdd\
src\impl\win.cc, line 71.
@wjwwood
Copy link
Owner

wjwwood commented Dec 11, 2014

Thanks for the report, that is definitely strange. Can other serial programs (pyserial) open it when it is COM20?

If you have any more information about how this might be resolved please let me know.

@anderwm
Copy link
Author

anderwm commented Dec 11, 2014

I had actually tried it in pyserial just before I changed the port number and it opened it without error. It works on port numbers below COM10 and fails for everything COM10 and above. This must be some common Microsoft problem because I have seen it from other vendors in the past.

Edit: For some reason for port number above 9 you must use this notation "\.\COM10". But this notation also works for ports below 9. So if you start having this problem possibly just change the constructor to append "\." to portname.

microsoft support

@bakercp
Copy link
Contributor

bakercp commented Jan 21, 2015

Just a confirmation over here: bakercp/ofxSerial#5 (comment)

@wjwwood Seems like the solution would be to take @anderwm 's approach and append "." in the win impl.

@jmarsico
Copy link

what I used:
"string port = "";
port.append("\\.");
port.append("\");
port.append(devicesInfo[deviceIndx].getPort());
success = device.setup(port), 9600);"

learned that \ removes following char. thanks @bakercp

wjwwood added a commit that referenced this issue Apr 22, 2015
fix handling of COM ports over 10 on Windows, fixes #84
@wjwwood
Copy link
Owner

wjwwood commented Apr 22, 2015

I reproduced this and fixed it in #84, thanks guys!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants