From owner-freebsd-current@FreeBSD.ORG Mon Sep 12 05:33:41 2011 Return-Path: Delivered-To: freebsd-current@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 11484106566B for ; Mon, 12 Sep 2011 05:33:41 +0000 (UTC) (envelope-from bsam@ipt.ru) Received: from services.ipt.ru (services.ipt.ru [194.62.233.110]) by mx1.freebsd.org (Postfix) with ESMTP id B7E468FC18 for ; Mon, 12 Sep 2011 05:33:39 +0000 (UTC) Received: from bb.ipt.ru ([194.62.233.89]) by services.ipt.ru with esmtps (TLSv1:AES128-SHA:128) (Exim 4.54 (FreeBSD)) id 1R2z9G-0009kX-65; Mon, 12 Sep 2011 09:33:38 +0400 From: Boris Samorodov To: Jilles Tjoelker References: <70652288@bb.ipt.ru> <20110911110258.GA51096@stack.nl> Date: Mon, 12 Sep 2011 09:33:37 +0400 In-Reply-To: <20110911110258.GA51096@stack.nl> (Jilles Tjoelker's message of "Sun, 11 Sep 2011 13:02:58 +0200") Message-ID: <77785294@bb.ipt.ru> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain Cc: freebsd-current@FreeBSD.org, ed@freebsd.org, Peter Jeremy Subject: Re: Serial Port Configuration does not work X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Sep 2011 05:33:41 -0000 On Sun, 11 Sep 2011 13:02:58 +0200 Jilles Tjoelker wrote: > On Tue, Sep 06, 2011 at 04:29:51PM +0400, Boris Samorodov wrote: > > the port does not work as expected (at least as per The Handbook, > > 26.2.5 Serial Port Configuration). Nether "init" nor "lock" > > devices can be used: > > ----- > > # uname -a > > FreeBSD host1.ipt.ru 9.0-BETA2 FreeBSD 9.0-BETA2 #14 r225395: Mon > > Sep 5 18:10:43 MSK 2011 bsam@bb.ipt.ru:/usr/obj/usr/src/sys/HOSTS > > i386 > > # ls -l /dev/ttyu5* > > crw------- 1 root wheel 0, 56 Sep 5 18:50 /dev/ttyu5 > > crw------- 1 root wheel 0, 57 Sep 5 18:50 /dev/ttyu5.init > > crw------- 1 root wheel 0, 58 Sep 5 18:50 /dev/ttyu5.lock > > # stty -f /dev/ttyu5.init 57600 > > stty: /dev/ttyu5.lock isn't a terminal > > # stty -f /dev/ttyu5.lock cs7 > > stty: /dev/ttyu5.lock isn't a terminal > > ----- > It looks like r223722, while introducing the ability to issue > device-specific ioctls on init and lock devices, broke the ability to > issue generic ioctls, with the exception of TIOCSETA. (However, stty > will not do much if it cannot do TIOCGETA.) > Try this patch and report if it works: > diff --git a/sys/kern/tty.c b/sys/kern/tty.c > index ce49f97..3721888 100644 > --- a/sys/kern/tty.c > +++ b/sys/kern/tty.c > @@ -777,6 +777,7 @@ ttyil_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag, > error = ttydevsw_cioctl(tp, dev2unit(dev), cmd, data, td); > if (error != ENOIOCTL) > goto done; > + error = 0; > > switch (cmd) { > case TIOCGETA: Thanks Jilles! That did it: ----- % sudo stty -f /dev/ttyu4 speed 9600 baud; lflags: echoe echoke echoctl oflags: tab0 cflags: cs8 -parenb % sudo stty -f /dev/ttyu4.init 1200 cs7 % sudo stty -f /dev/ttyu4 speed 1200 baud; lflags: echoe echoke echoctl oflags: tab0 cflags: cs7 -parenb ----- -- WBR, Boris Samorodov (bsam) Research Engineer, http://www.ipt.ru Telephone & Internet SP FreeBSD Committer, http://www.FreeBSD.org The Power To Serve