Wednesday, 15 December 2010

Releasing unused COM ports

Recently, I need to work with mobile devices that attached to COM ports on the computer. My two years old computer has no COM port, actually. So I purchased a PCI-to-COM adapter. It works fine. I can see those mobile devices connected using "MobiMB Mobile Media Browser", for example. However, my console application seems requiring COM port number lower than 10. So, reassigning COM port number is necessary.

Reassigning COM port number is no hassle for any advance user. Open "Device Manager" and double click on a COM port, in the properties page, select "Port Settings" tab and click "Advanced". Open the "COM Port Number" drop list and you are freely to choose any COM number from 1 to 256. And you can see which COM port is currently in use.

For unknown reason, however, my COM2 to COM10 are all occupied "(in used)" by devices that were not found anywhere in Device Manager. Therefore, I tried to look at hidden and unattached devices for any clue. To list those no longer needed drivers, you can create a System Variable in Environment Variables.


I found a lot of no longer needed driver, such as USB storage for Nokia 6120, Mass storage of a PMP. According to the web, these may degrade the system's performance. Anyway, I removed all those that I don't need anymore. But still unable to find anything which ties to any of those COM ports.

It seems there is no way to release them, except I found that there is a way via programming. On MSDN, Microsoft shows us how to use the COM port database. So this is the stupid way M$ handles COM port...

So, do we have to write up a program and test just to reclaim our COM port? Answer is no, thanks to "petrovic". I found an executable, together with source code, at a CVS online.

You can download these files by clicking on any of these file, and then "right click - save as" on the "view text" link.

I free up and rearranged my COM port. Now, I'm assigning COM1 for motherboard (but where is the port?), COM2 & COM3 for my PCI-to-COM adapter, COM4 for a USB-to-serial cable, and COM11 for Bluetooth's serial.

Thanks to "petrovic". And thanks M$ for giving me such a memorialize time in "playing" with the COM port while I'm hurrying on a deadly project.

No comments: