none
Programatically discover a device path RRS feed

  • Question

  • Hi,

    I'm writing software to interface with a serial device connected as a COM device.

     

    So far I've been testing my code by hard coding the device path ("COM4"). How do I find this path programatically?

    Thanks!

    Wednesday, June 23, 2010 9:50 PM

Answers

All replies

  • I'm writing software to interface with a serial device connected as a COM device.
    So far I've been testing my code by hard coding the device path ("COM4"). How do I find this path programatically?

    What mechanism do you have to know beforehand that the device is
    connected?

    You can often only go through all possible ports trying to talk to the
    device in question to see if it's connected.

    Dave

    Wednesday, June 23, 2010 10:23 PM
  • A little searching brought up this SysInternals thread which may help in finding all the serial ports. 
    • Marked as answer by Nathanael_861 Friday, June 25, 2010 4:43 PM
    Wednesday, June 23, 2010 10:40 PM
  • A little searching brought up this SysInternals thread  which may help in finding all the serial ports. 


    Thanks - that was quite helpful.

     

    http://www.naughter.com/enumser.html

    This site in particular contained some useful code for enumerating devices in a variety of ways.

    Thursday, June 24, 2010 9:46 PM