none
how device driver decide the serial port number? RRS feed

  • Question

  • I want to known that how device driver decide the serial port number?

    after install the driver, the device manager have generate a serial port .COM(n);the serial port number(n), what is the generation rule. when change the USB port the serial number is increase. 


    Friday, May 16, 2014 9:56 AM

Answers

  • the ports class coinstaller assigns the number. The number for a device stays as long as the device can be uniquely identified on the system. Your USB dongle does not have a serial number so when you move it from port to port it is a new device to the system

    d -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Friday, May 16, 2014 1:01 PM

All replies

  • the ports class coinstaller assigns the number. The number for a device stays as long as the device can be uniquely identified on the system. Your USB dongle does not have a serial number so when you move it from port to port it is a new device to the system

    d -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Friday, May 16, 2014 1:01 PM
  • Thanks for response.

    the Device is a composite device, after install the driver, i have a serial port for AT command, and  Modem. I have the driver source code also. i think the driver get "PortName" from HKEY_LOCAL_MACHINE\SYSTEM\Enum\USB\Vid_xxxx&PID_xxxx&MI_00\xxxxxxxxx\Device Parameters\, create Device Object, and Create SymbolicLink, at last Create registry map(HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\SERIALCOMM).

    by your response,I think the Port Class coinstaller will generate the the registry struct first.the system will assign a free serial port number for new Serial. I want to known the rule for generation. I need to test lots of devices ,the serial port number reach 200 and more. it was homely.

    HKEY_LOCAL_MACHINE\SYSTEM\Enum\USB\Vid_xxxx&PID_xxxx&MI_00\[string]\Device Parameters\

    the string may be the device instance ID, I found that the same Device will generate the same String, and load the driver with same Port Number. but somethings the same device have different serial port Number. was  same device have different [string] ? why  is it so?

    best regards

    Saturday, May 17, 2014 1:39 AM
  • I have found the answers from Microsoft website.

    the class coinstaller will assign the serial port number by COM port Database.

    the COM port Database will return the lowest and unused Serial Port Number.

    http://msdn.microsoft.com/en-us/library/windows/hardware/ff546481(v=vs.85).aspx

    Thanks!


    Saturday, May 17, 2014 2:46 AM