From owner-freebsd-hackers@FreeBSD.ORG Sun Aug 15 00:09:51 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 203BE1065679 for ; Sun, 15 Aug 2010 00:09:51 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-bw0-f54.google.com (mail-bw0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id 9F5418FC08 for ; Sun, 15 Aug 2010 00:09:50 +0000 (UTC) Received: by bwz20 with SMTP id 20so1005330bwz.13 for ; Sat, 14 Aug 2010 17:09:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=RUR5eFWDfZ6b9H8GE7Nd8huZTusI3169fTDJNfsEvtU=; b=N0jlVfxCKL1TROH3sa9yO/aMRG3cYGsZr3Mna9bbBP5x7YLSIqNaFG5GUzar6qGbQn Se0L+GwAJxIYHvBPbskUUbZuEnMcgrEY4uff6U9js8G216t3QXo21BG2AdyB4DMrocg9 RuyykRYwVAydJaMduQZLf+BU4h6+CJz02BYGM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=vhphtfZvfexrCR1bdo/oOYIgz6/5mNax4C589IX/+je8cwioQ8C8fiOY1k5ut7zSpd i3cAIptMem4bMWAUI89epwaZbsMRtf8IWoLa58hXIyh8LGDCGdMz6Q0koUzCBt6FDdOU wbIc/3wcdSbPiHuRuxXAeHsWnYvjTbA3Ir768= MIME-Version: 1.0 Received: by 10.204.47.193 with SMTP id o1mr2060603bkf.134.1281830989412; Sat, 14 Aug 2010 17:09:49 -0700 (PDT) Sender: yanegomi@gmail.com Received: by 10.204.82.6 with HTTP; Sat, 14 Aug 2010 17:09:49 -0700 (PDT) In-Reply-To: <4C672EE1.60101@prt.org> References: <4C66D2CF.9040408@prt.org> <20100814220929.GI2978@hoeg.nl> <4C672EE1.60101@prt.org> Date: Sat, 14 Aug 2010 17:09:49 -0700 X-Google-Sender-Auth: SSVEkEFP2TVnwCjdwWEFWVDj1wo Message-ID: From: Garrett Cooper To: Paul Thornton Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: Ed Schouten , 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:09:51 -0000 On Sat, Aug 14, 2010 at 5:03 PM, Paul Thornton wrote: > 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=3D2106 c_oflag=3D3 c_cflag=3Dcf00 c_lflag=3D400 > 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 > =A0cstopb 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=3D6 c_oflag=3D3 c_cflag=3Dcf00 c_lflag=3D400 > tcsetattr: Invalid argument > after: c_iflag=3D6 c_oflag=3D3 c_cflag=3D8f00 c_lflag=3D400 > 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. =A0Under 8.0, this continually dumps the data coming in as yo= u > might expect it to. > > Were there any significant serial changes between 7.x and 8.0 which > might explain this? =A0I 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. Bits of syscons were largely rewritten between 7.x and 8.x. That's the reason why Ed ask the question :) (he did the rewriting). -Garrett