unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: Danny Milosavljevic <dannym@scratchpost.org>
Cc: 30355@debbugs.gnu.org
Subject: [bug#30355] [PATCH] services: agetty: Make tty optional and add agetty instance to base services.
Date: Fri, 09 Feb 2018 14:51:12 +0100	[thread overview]
Message-ID: <87d11e1dbj.fsf@gnu.org> (raw)
In-Reply-To: <20180205081553.5930-1-dannym@scratchpost.org> (Danny Milosavljevic's message of "Mon, 5 Feb 2018 09:15:53 +0100")

Hi,

Danny Milosavljevic <dannym@scratchpost.org> skribis:

> * gnu/system/install.scm (agetty-default-service): Delete variable.
> (beaglebone-black-installation-os): Do not specify tty.
> (a20-olinuxino-lime-installation-os): Do not specify tty.
> (a20-olinuxino-lime2-emmc-installation-os): Do not specify tty.
> (a20-olinuxino-micro-installation-os): Do not specify tty.
> (banana-pi-m2-ultra-installation-os): Do not specify tty.
> (nintendo-nes-classic-edition-installation-os): Do not specify tty.
> (embedded-installation-os): Move agetty-service instantiation to...
> * gnu/services/base.scm (%base-services): ...here.
> (default-serial-port): New variable.
> (agetty-shepherd-service): Make tty optional, default to the above.
> * doc/guix.texi (agetty-configuration): Update "tty" documentation.

I would prefer the install.scm part to be a separate patch, if that’s
not too much of a burden for you.

I have a few minor comments:

>  @item @code{tty}
>  The name of the console this agetty runs on, as a string---e.g.,
> -@code{"ttyS0"}. This argument is mandatory.
> +@code{"ttyS0"}. This argument is optional, it will default to
> +a reasonable default serial port used by Linux.

s/Linux/the kernel Linux/ (to avoid ambiguities…)

> +For this, if there is a value for an option "agetty.tty" in the Linux
> +command line, agetty will extract the device name of the serial port
> +from it and use that.
> +
> +If not and if there is a value for an option "console" with a tty in
> +the Linux command line, agetty will extract the device name of the
> +serial port from it and use that.

@code{agetty.tty}, @code{console}, etc.

Write “kernel command line” instead of “Linux command line”.

> +In both cases, agetty will leave the other serial device settings
> +(baud rate etc) alone - in the hope that Linux pinned them to the
> +correct values.

s/etc/etc./
s/alone - in the hope/alone---in the hope/

(The three hyphens map to an em dash in the output.)

> +(define (default-serial-port)
> +  "Return a gexp that determines a reasonable default serial port
> +to use as the tty.  This is primarily useful for headless systems."
> +  #~(begin
> +      ;; console=device,options
> +      ;; device: can be tty0, ttyS0, lp0, ttyUSB0 (serial).
> +      ;; options: BBBBPNF. P n|o|e, N number of bits,
> +      ;; F flow control (r RTS)
> +      (use-modules (gnu build linux-boot))
> +      (let* ((not-comma (char-set-complement (char-set #\,)))
> +             (command (linux-command-line))
> +             (agetty-specs (find-long-options "agetty.tty" command))
> +             (console-specs (filter (lambda (spec)
> +                                     (not (or
> +                                            (string-prefix? "tty0" spec)
> +                                            (string-prefix? "tty1" spec)
> +                                            (string-prefix? "tty2" spec)
> +                                            (string-prefix? "tty3" spec)
> +                                            (string-prefix? "tty4" spec)
> +                                            (string-prefix? "tty5" spec)
> +                                            (string-prefix? "tty6" spec)
> +                                            (string-prefix? "tty7" spec)
> +                                            (string-prefix? "tty8" spec)
> +                                            (string-prefix? "tty9" spec))))
> +                                   (filter
> +                                     (lambda (spec)
> +                                       (string-prefix? "tty" spec))
> +                                     (find-long-options "console" command))))

Please make that a single ‘filter’ or ‘remove’ call, for clarity.

> +             (specs (append agetty-specs console-specs))
> +             (spec (if (null? specs)
> +                      #f
> +                      (car specs))))
> +        (and spec
> +             ;; Extract device name.
> +             (car (string-tokenize spec not-comma))))))

Rather:

  (match (append agetty-specs console-specs)
    (() #f)
    ((spec _ ...)
     (string-tokenize spec not-comma)))

The rest LGTM.  OK to push with these changes!

Thanks,
Ludo’.

  reply	other threads:[~2018-02-09 13:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-05  8:15 [bug#30355] [PATCH] services: agetty: Make tty optional and add agetty instance to base services Danny Milosavljevic
2018-02-09 13:51 ` Ludovic Courtès [this message]
2018-02-09 19:49   ` Danny Milosavljevic
2018-02-09 22:00     ` Ludovic Courtès
2018-02-10 22:07       ` Danny Milosavljevic
2018-02-13 22:04         ` Ludovic Courtès

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

  List information: https://guix.gnu.org/

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

  git send-email \
    --in-reply-to=87d11e1dbj.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=30355@debbugs.gnu.org \
    --cc=dannym@scratchpost.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).