9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Bakul Shah <bakul@bitblocks.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: Re: [9fans] usb/serial control open
Date: Sun, 23 Mar 2014 14:32:08 -0700	[thread overview]
Message-ID: <20140323213208.A38E8B827@mail.bitblocks.com> (raw)
In-Reply-To: Your message of "Sun, 23 Mar 2014 16:32:12 EDT." <590d4ca16a9d61afc0bdc6b4d16862af@brasstown.quanstro.net>

On Sun, 23 Mar 2014 16:32:12 EDT erik quanstrom <quanstro@quanstro.net> wrote:
> On Sun Mar 23 15:56:52 EDT 2014, paurea@gmail.com wrote:
> > On Sun, Mar 23, 2014 at 8:47 PM, Gorka Guardiola <paurea@gmail.com> wrote:
> >
> > >
> > > if(!setonce){
> > >       setonce = 1;
> > >       serialctl(p, "l8 i1");  /* default line parameters */
> > > }
> >
> > And setonce needs to live in the interface, and it needs to be locked, etc.
>
> another idea: since this is only needed by some hardware.  and then only in i
> nit.
> why not make it the responsibility of such hardware to do this in the init
> fn.  then the problem can be addressed without any special cases like
> !setonce.

On FreeBSD:

     The sio driver also supports an initial-state and a lock-state control
     device for each of the callin and the callout "data" devices.  The
     termios settings of a data device are copied from those of the corre-
     sponding initial-state device on first opens and are not inherited from
     previous opens.  Use stty(1) in the normal way on the initial-state
     devices to program initial termios states suitable for your setup.

A similar idea here would be to have a "default" command to
for default settings. When a device is opened, it is
initialized with these settings. The reason I like this is
because then I don't need to teach every serial IO program
what setting to use (often the other end is a dumb device
requiring its own fixed and peculiar settings).



  parent reply	other threads:[~2014-03-23 21:32 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-23 18:09 erik quanstrom
2014-03-23 18:34 ` Gorka Guardiola
2014-03-23 18:55   ` erik quanstrom
2014-03-23 19:47     ` Gorka Guardiola
2014-03-23 19:55       ` Gorka Guardiola
2014-03-23 20:32         ` erik quanstrom
2014-03-23 21:08           ` Gorka Guardiola
2014-03-24  1:49             ` erik quanstrom
2014-03-23 21:32           ` Bakul Shah [this message]
2014-03-23 21:53             ` erik quanstrom
2014-03-23 22:02               ` Bakul Shah
2014-03-24  0:32                 ` erik quanstrom
2014-03-24  0:41                   ` Bakul Shah
2014-03-23  5:04                     ` lucio
2014-03-23 19:53   ` Gorka Guardiola

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140323213208.A38E8B827@mail.bitblocks.com \
    --to=bakul@bitblocks.com \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).