Solved How to unlock serial port

After running a program which accesses the serial port it seems to stay locked after it finishes and I can't use it again without rebooting.

How do I unlock it or find what is using the port?
 
Are you sure it is "locking" it? I don't think you can do that with serial port devices.

I think what may be happening is that it is setting it up with a different baud rate or parity check to what you need (i.e 8N1 or 8E2). A reboot resets the interface.

Check out stty to reset back the settings you need.

Perhaps have a browse through the termios manpage termios(4) for a lot of options.
 
I ran a program called heyu which communicates via /dev/cuaU0 with an X10 device. When trying to run it a second time it says:
HEYU: Can't open tty line. Check the permissions.
My guess is it didn't tidy up after itself. Not sure how to tell what is holding the serial port...
 
You might also be able to send a HUP command to it. ATA^H from whatever terminal program you're accessing it with. Boy! been awhile since I had to remember the modem control sequences. :)

--Chris
 
You might also be able to send a HUP command to it. ATA^H from whatever terminal program you're accessing it with. Boy! been awhile since I had to remember the modem control sequences. :)
--Chris

I can't send a ATA^H if I can't access the serial port!:)

I am using heyu which provides access to X10 devices via a serial port. There is even a FreeBSD man page for itbut it probably hasn't been touched in over 10 years... I downloaded and compiled the source on both Linux and FreeBSD. It works OK on Linux.
 
probaly you know, but you may try also:
fuser /dev/cuaU0
to see if the file is in use, and by which process.

(sorry for brevity & format, typing from phone)
 
probaly you know, but you may try also:
fuser /dev/cuaU0
to see if the file is in use, and by which process.

(sorry for brevity & format, typing from phone)
I was aware of it but had forgotten the name :)

Just tried it now and got
/dev/cuaU0: 4288w
but there is no such process.

A few minutes later... discovered the '-k' option and now we're back in business without rebooting.
Many thanks for the suggestion.
 
Back
Top