COM port occupied by unknown application
I’m working on an application that uses COM port for communication with external controller. When I reboot the PC with communication cable connected, Windows opens the port, without any application running, so I can’t access it any more. I was banging my head, searching and asking around for an answer, but, until recently, I couldn’t find where’s the problem.
Finally I managed to find where the problem was:
Windows identifies devices with constant data stream connected to serial port as serial mouse (in this case it was Microsoft Serial Ballpoint), and tries to install them, taking over the control over the port without any process using it. The solution is to wait for Windows to install the device (check Device Manager under Mouses And Other Pointing Devices) and then DISABLING it. If you uninstall the device it will be installed again, and the problem is back.
I hope others will find this solution useful.