[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: serial port programming



On Friday 07 October 2005 04:29 am, Marc Brünink wrote:
> Hi,
>
> I've an application which uses /dev/ttyS3 to read and write some data.
> This software is kind of alpha. Sometimes it segfaults. So the serial
> port is not closed correctly. If I restart the application after a
> segfault I'm not able to open the port again. I've to reboot. Im
> wondering if it's possible to reset the serial port somehow. I mean: If
> I sent a SIGKILL it'll result in the same behavior. And I should be
> able to sent a SIGKILL to an application which uses the serial port,
> shouldn't I?

when you say can't open the port, do you mean that you can't do an open() on 
it? or open() works but can't read write anything?

if you can open() it but not read()/write(), the settings that you tcsetattr() 
is probably additive to the initial state. anyhoo.. 

a quick and dirty way is to run minicom on the port, tweak the settings (flow 
control, baud rate etc) for the port in minicom until you can see the output 
in minicom. once you do, run 

1) stty -g --file=/dev/ttySX 

2) save that string somewhere. 

3) then you can do,
	stty --file=/dev/ttySX <the saved string from #1>

may not be the cleanest way to do it but at least it saves you reboots.

anoop.

>
> regards
> Marc



Reply to: