1
votes

We are using a USB-to-Serial converter. Windows assigns a COM port number to the serial device. For testing purposes, we need to control the COM port number assigned by Windows. For example, we would like to tell Windows to assign COM 255 to a device rather than have Windows decide what the number is. Is there any way to do this?

3
Assign it programmatically ? if so, what language ? otherwise, you can do it from Device Manager in Windows.Nasreddine
This is the most odd test requirement I've seen in awhile...Brad
It is up to the driver, not Windows. Finding a converter with a driver that lets you do this is going to be hard shopping. The odds that your user will have one are even smaller.Hans Passant

3 Answers

4
votes

I do not have to do this programmatically, so Nacereddine is right. My Computer -> Manage -> Device Manager -> Ports -> Communications Port -> Port Settings -> Advanced -> COM Port Number

1
votes

This normally depends on the driver. Some drivers allow you to edit the COM port number assigned by going into the device properties in device manager and using one of the properties pages to specify the COM port number. If the model you are currently using doesn't support this I suggest finding a model that does.

1
votes

No, but if you know what device id it reports to the OS then its possible that you could find it programmatically in the device manager.

Here's a link to a code project that may give you some ideas.