Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Detecting if a port is already open (UNIX)

Status
Not open for further replies.

dandruczyk

Technical User
Jul 7, 2003
2
US
I've written an app that talks over a serial port to an external device (Fuel injection ECU), but need to be able to find out if the serial port is in use, or already opened by some other process before doing anything with it. (Like a mouse for the X server, or some other process). So far I haven't found anything. Has anyone else had this issue, and how ddi you get around it?
I have users of this app that can't use it because they use a serial mouse with X11, and as soon as my app opens the port and changes the port settings, X11 crashes for him. (I don't have the issue, as my mouse is on USB) What function calls can be used to determine if another app has the port opened.

 
I don't have an answer for you, but would this by any chance be the MegaSquirt FI system? If not, what is it?

 
Yes this is for the MegaSquirt ECU. I'm the author of MegaTunix for Linux/Unix....
 
It's not absolutely definitive but what about checking the /dev/mouse symlink file to see where it points on the basis that if it's a link to /dev/ttyS0 or similar then the mouse is on the serial port but if it points to /dev/psaux (as an example) then the mouse is in the PS/2 port (in this case from Linux).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top