From owner-freebsd-hackers@FreeBSD.ORG Sun Aug 15 00:03:48 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 91FB51065696 for ; Sun, 15 Aug 2010 00:03:48 +0000 (UTC) (envelope-from prt@prt.org) Received: from smtp5.uk.umis.net (smtp5.uk.umis.net [217.65.166.40]) by mx1.freebsd.org (Postfix) with ESMTP id 5B4DE8FC17 for ; Sun, 15 Aug 2010 00:03:48 +0000 (UTC) Received: from kate.prtsystems.ltd.uk ([217.65.165.35]) by smtp5.uk.umis.net with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.63 (FreeBSD)) (envelope-from ) id 1OkQhW-000Ngv-PN; Sun, 15 Aug 2010 00:03:46 +0000 Message-ID: <4C672EE1.60101@prt.org> Date: Sun, 15 Aug 2010 01:03:45 +0100 From: Paul Thornton User-Agent: Thunderbird 2.0.0.24 (Windows/20100228) MIME-Version: 1.0 To: Ed Schouten References: <4C66D2CF.9040408@prt.org> <20100814220929.GI2978@hoeg.nl> In-Reply-To: <20100814220929.GI2978@hoeg.nl> X-Enigmail-Version: 0.96.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@freebsd.org Subject: Re: Problem detecting and reacting to serial break X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Aug 2010 00:03:48 -0000 Ed Schouten wrote: > * Paul Thornton 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.