how to search for valid com ports?

For issues with communication ports, protocols, etc.
more granularity
Posts: 1
Joined: Oct 25, 2012 17:19

how to search for valid com ports?

Postby more granularity » Oct 25, 2012 17:29

I want to search for a com port that an instrument has been plugged into.
So I would like to go through all possible com ports, test which ones are
valid, and then test which valid port has data on it.

If I try to open a non existent com part, is there an error I can access?

When I check ERR after trying to open an invalid com port I always get 0.

Any suggestions?

TIA
bfuller
Posts: 338
Joined: Jun 02, 2007 12:35
Location: Sydney, Australia

Re: how to search for valid com ports?

Postby bfuller » Oct 26, 2012 3:30

You might be able to make use of this code, or parts of it.

viewtopic.php?f=18&t=17452&p=153272&hilit=open#p153272

If you scan all available ports to see what is happening on each perhaps ????
Zippy
Posts: 1295
Joined: Feb 10, 2006 18:05

Re: how to search for valid com ports?

Postby Zippy » Oct 26, 2012 21:03

I want to search for a com port that an instrument has been plugged into.
So I would like to go through all possible com ports, test which ones are
valid, and then test which valid port has data on it.
<snip>

Your operating system is...?
St_W
Posts: 1496
Joined: Feb 11, 2009 14:24
Location: Austria
Contact:

Re: how to search for valid com ports?

Postby St_W » Nov 18, 2012 22:06

if you're using Windows the easiest way is to look into the registry:
HKLM\HARDWARE\DEVICEMAP\SERIALCOMM lists all ports

Sample code

Return to “Hardware Interfaces / Communication”

Who is online

Users browsing this forum: No registered users and 1 guest