From owner-freebsd-hackers@freebsd.org Sun Oct 22 21:57:44 2017 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 09564E37484 for ; Sun, 22 Oct 2017 21:57:44 +0000 (UTC) (envelope-from zbeeble@gmail.com) Received: from mail-wm0-x231.google.com (mail-wm0-x231.google.com [IPv6:2a00:1450:400c:c09::231]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8D79F76645; Sun, 22 Oct 2017 21:57:43 +0000 (UTC) (envelope-from zbeeble@gmail.com) Received: by mail-wm0-x231.google.com with SMTP id m72so6194000wmc.1; Sun, 22 Oct 2017 14:57:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=dHuxmpyKev+x0nIKqDNnlA2BtNs0jjSyAE9rRxH9FuQ=; b=DzeL34/YsneNQqzKDXX07N7uIuN9rfHP2ut42Bcby0XdMQFp9gKxekVr2xoX1Ikd9M +/UigKCpyhVyZFGMkW4ErHajdwKwxj3CrxYhCbwKu4WzEx7XJ/QVrciLbrntiG/vOqBu vZAX2yGIJ6bqRYH2TZlYuvM8jVeHG7K6Oa/n0mjfHYDrqgBkyvNJEIU1+v04MftkiWos 5EZ3Qf6Yla0WAgKpM5Ys4BV5My9ctF1n3wfgPsTGh2AROF6sHnC7r8UzY6I5wx9vKcJI o3M9BSfnE8cV1IfxGkKTp59tbQABWs10+WjW+vi9dPdMEknxqI64zmmJuB29GI1HtH8e Am3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=dHuxmpyKev+x0nIKqDNnlA2BtNs0jjSyAE9rRxH9FuQ=; b=J/lHzzddsbFwDvmGj8v8i4xpKgAqpMz8iHAp/bCaJjn0GEZIadG9E1rImv+WrZXDJ5 O7APJfNkM1ANpB9MoERGq9BbGgDnCG+xVD0Xj7xsaUXkJZnFOZRW8P4Usitalcd2kB6M epeTcoJPXe01RxJrBIBlpVnEwrGObe++YbNCTu9M7mkp9+8DK7c2Fah6CcuvHiF4rZHy obEn69xrOSPloxEjJJG7z47pnTLVV5AyXHzqfjLScfpDxXgO5/c50+TK0Mh/LiyvJKtA osE62U2xz4SBbKJ0zZBi9k2jSbGOZqRHqURzBmdDfVRJlgNMlwKgs2QJEYPSW7mSkIPd lsUA== X-Gm-Message-State: AMCzsaX10XoL+5+Ul5f97LC6vc3CONbk9uRFtXC+6CWyUlU6sACkqd4j DTbcMBdyBO8gyWFoxOCjXRAo7N07OUoAxC53vA== X-Google-Smtp-Source: ABhQp+R2b6Scm2mQiUkOs43fM/a39KN9T+PA+qe/KWMQ8s8y70hhrIo2va468cCG/e6yXEIx1rR9IBDBOuMLvTMVUD8= X-Received: by 10.80.139.65 with SMTP id l59mr14460945edl.187.1508709461199; Sun, 22 Oct 2017 14:57:41 -0700 (PDT) MIME-Version: 1.0 Received: by 10.80.189.139 with HTTP; Sun, 22 Oct 2017 14:57:40 -0700 (PDT) In-Reply-To: <1508611656.1383.100.camel@freebsd.org> References: <1508425713.1383.6.camel@freebsd.org> <1508432312.1383.18.camel@freebsd.org> <20171019172246.GU2473@kib.kiev.ua> <1508511786.1383.50.camel@freebsd.org> <1508611656.1383.100.camel@freebsd.org> From: Zaphod Beeblebrox Date: Sun, 22 Oct 2017 17:57:40 -0400 Message-ID: Subject: Re: We do serial differently. To: Ian Lepore Cc: Kyle Evans , Konstantin Belousov , FreeBSD Hackers Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Oct 2017 21:57:44 -0000 Firstly, this is an excellent and awesome summary of behavior. Would that we could turn it into some form of change proposal. But: here's my little state diagram: linux: arduino works, pronterface works FreeBSD:arduino works, pronterface fails arduino is a big pile of java, but it successfully talks to the arduino. Maybe in a different mode? I dunno... but it works on both OSs. pronterface is a big pile of python. It works on linux and doesn't work on FreeBSD. Now... the one possible point was that cutting the arduino's DTR trace might make it work on FreeBSD (with the proviso that using arduino would require pressing the reset switch on the hardware). Can these facts be put together in a manner that makes pronterface work on FreeBSD without the hardware hack. In particular, the "driver" for the arduino's USB serial emulation is a separate driver that we can hack. On Sat, Oct 21, 2017 at 2:47 PM, Ian Lepore wrote: > > First, a word about DTR being asserted vs. de-asserted... > > RS232 signals are inverted from the corresponding UART signals. That is, > when the DTR signal is 0 at the output of a uart chip, it runs through an > RS232 line-level converter which inverts the signal to a 1 on the RS232 > output side. Often with embedded system stuff there is no RS232 > conversion, the signals remain at uart levels on both ends. In this case, > "DTR asserted" means 0v on the DTR pin of the uart chips. > > Okay, after some digging, here's what I've found about how freebsd > behaves with DTR... > > On first open(), DTR is asserted. There is no control over that, it's > just always going to happen. (Slightly buggy: multiple serial drivers > do this, and the tty layer does it too. I think only the tty layer > should do it.) > > On last close(), DTR is de-asserted unless -hupcl has been set. This > seems to be done ONLY in various drivers, and not be the tty layer, > which seems differently-buggy than the open-assertion case. Maybe > there is a reason the tty layer can't do this, I didn't dig into it. > > If you set both /dev/cuaU#.init and /dev/cuaU#.lock to -hupcl, that > will ensure that once the device is opened for the first time, DTR will > remain asserted forever after that. (setting .lock prevents any > program from changing that setting.) > > There is no way to prevent DTR from ever being asserted. > > Things I've read about linux while searching for info on this seem to > indicate it behaves the same way (but it lacks the .init and .lock > features). Apparently only on Windows is it possible to configure > serial drivers to leave the DTR line completely untouched. >