Discussion:
How to open a COM port for a GetCommProperties call?
(too old to reply)
R.Wieser
2023-10-03 12:22:17 UTC
Permalink
Hello all,

I'm in a bit of a catch-22 : I want to know which baudrates a(n USB to
serial) COM port supports *before* opening it, but the GetCommProperties
function needs an open COM port to be able to fetch that information. :-(

... Or is there a way to "open" a COM port for inspection only, not letting
an attached serial device know the COM port is ready for business.

I /imagine/ there is (opening the "control channel" to the involved device
driver), but in all my time I've never encountered anything describing how
to do it. So, I'm stuck.

Help please ?


-- second question:

GetCommProperties returns a COMMPROP structure* for which the MSDN page
defines speeds upto 128k bps. But when I use CommConfigDialog it shows me a
few specific speeds (230400, 460800, 921600) above it. Where do those come
from ?

*
https://learn.microsoft.com/en-us/windows/win32/api/winbase/ns-winbase-commprop

Regards,
Rudy Wieser
R.Wieser
2023-10-04 11:10:30 UTC
Permalink
Post by R.Wieser
GetCommProperties returns a COMMPROP structure* for which the MSDN
page defines speeds upto 128k bps. But when I use CommConfigDialog it
shows me a few specific speeds (230400, 460800, 921600) above it.
Where do those come from ?
Odd: although ComConfigDialog shows those above three extra baudrates, when
I actually open the port (using CreateFile) and call GetCommProperties I'm
not seeing any bitflags that could indicate those baudrates, and I am
allowed to also set a 134.5 baudrate.

IOW, what the build-in ComConfigDialog shows does not seem to be what the
port can actually do. :-(

Regards,
Rudy Wieser

Loading...