Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I determine which process is using a serial port?

The company I work for makes hardware that communicates to the computer though a serial port. Third party companies write software that communicates with our hardware.

There are times when I need to diagnose our hardware. However, a third party software app connects to the serial port when Windows starts up, blocking any other connection. I don't know the name of this application/service and it's not always the same one.

Is there any way to either:

  • Find the name/pid of the app/service that is currently using a given serial port or
  • Steal the serial port connection from another app.

vb.net preferably, but I'll take a language agnostic answer as well.

like image 941
Grant Avatar asked Sep 03 '08 17:09

Grant


People also ask

How can I tell which process is using a serial port?

Simply open the Process Explorer application and search for the term " serial" by using ctrl-f. In the above example the user had left open putty on COM1. This would stop Zetafax from being able to open COM1. We now know to kill putty.exe (PID:3024)using Task Manager to end the process and unlock the port.

What uses a serial port?

Serial ports are also used to connect equipment together, e.g. modems of one type or another (PSTN, 3G, satellite), GPS units, telescopes, sensors, power inverters, and many type of industrial control equipment.


1 Answers

You can use the process explorer tool also from SysInternals to search for open handles. In this case you would want to search for 'Serial' since it uses device names that may not map to com port numbers. (e.g. COM1 is \Device\Serial0 on my system).

If you want to take control of the serial port from another app I think you would need co-operation of the driver.

like image 99
Rob Walker Avatar answered Oct 06 '22 10:10

Rob Walker