Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 15 Aug 2010 01:03:45 +0100
From:      Paul Thornton <prt@prt.org>
To:        Ed Schouten <ed@80386.nl>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Problem detecting and reacting to serial break
Message-ID:  <4C672EE1.60101@prt.org>
In-Reply-To: <20100814220929.GI2978@hoeg.nl>
References:  <4C66D2CF.9040408@prt.org> <20100814220929.GI2978@hoeg.nl>

next in thread | previous in thread | raw e-mail | index | archive | help
Ed Schouten wrote:
> * Paul Thornton <prt@prt.org> wrote:
>> I'm using 8.0-RELEASE with uftdi and ucom driving the serial port.
> 
> Somewhat unrelated question: have you ever tried running the this code
> on 7.x? If so, did it work?

I've just tried this on 7.2-RELEASE (that was the only 7.x CD I could
find lurking about my desk).

Something is clearly quite different between 7 and 8 here:

On 7.2, it doesn't like my tcsetattr:

[root@test1 /usr/local/src]# ./dmxrx2
Opened /dev/cuaU0 on file handle 3
before: c_iflag=2106 c_oflag=3 c_cflag=cf00 c_lflag=400
tcsetattr: Invalid argument

No amount of fiddling with the options would make it work, so I used
stty to set the paramaters of /dev/cuaU0.init to what I wanted:

stty -f /dev/cuaU0.init speed 250000 -icanon -isig -echo cs8 clocal
  cstopb cread ignpar -ixany -ixon -ixoff -ignbrk brkint -imaxbel -icrnl

... and re-ran with some more debug ...

[root@test1 /usr/local/src]# ./dmxrx2
Opened /dev/cuaU0 on file handle 3
before: c_iflag=6 c_oflag=3 c_cflag=cf00 c_lflag=400
tcsetattr: Invalid argument
after: c_iflag=6 c_oflag=3 c_cflag=8f00 c_lflag=400
calling read with 513 bytes to go
^CCaught a signal: 2

So I now hang in a blocked read().

A quick and dirty test of "hd /dev/cuaU0" gives one line of zeros and
then hangs.  Under 8.0, this continually dumps the data coming in as you
might expect it to.

Were there any significant serial changes between 7.x and 8.0 which
might explain this?  I don't have enough understanding of how FreeBSD's
serial internals should work to debug this on my own, but am more than
happy to try all suggestions made.

Paul.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4C672EE1.60101>