all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: "pelzflorian (Florian Pelz)" <pelzflorian@pelzflorian.de>
Cc: 35640@debbugs.gnu.org
Subject: bug#35640: Make USB modems just work on Guix
Date: Wed, 12 Jun 2019 23:11:16 +0200	[thread overview]
Message-ID: <87zhmmqzkb.fsf@gnu.org> (raw)
In-Reply-To: <20190612103646.yem2wtmw6w2vw7an@pelzflorian.localdomain> (pelzflorian@pelzflorian.de's message of "Wed, 12 Jun 2019 12:36:47 +0200")

"pelzflorian (Florian Pelz)" <pelzflorian@pelzflorian.de> skribis:

> I am uncertain if having paragraphs like this in
> modem-manager-service-type and usb-modeswitch-service-type is a good
> idea:
>
>      This service is part of ‘%desktop-services’ (*note Desktop
>      Services::).

I think it’s OK.

Looks like we’re almost there!  A couple of comments and suggestions:

>From db6e3a937f89811017abf06c7dffc494b71b9127 Mon Sep 17 00:00:00 2001
> From: Florian Pelz <pelzflorian@pelzflorian.de>
> Date: Tue, 11 Jun 2019 16:56:46 +0200
> Subject: [PATCH 2/3] Add usb-modeswitch-service-type.
>
> * gnu/services/networking.scm (usb-modeswitch-service-type): New variable.
> (usb-modeswitch-configuration): New variable.
> (usb-modeswitch-configuration->udev-rules): New procedure.
> * doc/guix.texi (Networking Services): Document it.

[...]

> +When plugged in, some USB modems (and other USB devices) initially present
> +themselves as a read-only storage medium and not as a modem.  They need to be
> +@dfn{modeswitched} before they are usable.  The USB_ModeSwitch service type
> +installs UDEV rules to automatically modeswitch these devices when they are

s/UDEV/udev/ (here and elsewhere).

> +(define (usb-modeswitch-configuration->udev-rules config)
> +  "Build a rules file for extending udev-service-type from the rules in the
> +usb-modeswitch package.  The rules file will invoke usb_modeswitch.sh from the
> +usb-modeswitch package, modified to pass the right config file."
> +  (define usb-modeswitch-sh
> +    (match-lambda
> +      (($ <usb-modeswitch-configuration> usb-modeswitch data config-file)
> +       (let ((orig #~(string-append #$usb-modeswitch:dispatcher
> +                                    "/lib/udev/usb_modeswitch")))
> +         (computed-file
> +          "usb_modeswitch-sh"

(computed-file …) should probably be moved to a separate procedure, to
keep the main procedure concise.

> +          (with-imported-modules '((guix build utils))
> +            #~(begin
> +                (use-modules (guix build utils))
> +                (let ((cfg-param
> +                       (case #$config-file
> +                         ((#f) "")
> +                         (else
> +                          (string-append " --config-file=" #$config-file)))))

Instead of (case …), maybe this would be slightly clearer:

  #$(if config-file
        #~(string-append … #$config-file)
        "")

> +                  (mkdir #$output)
> +                  (install-file #$orig #$output)
> +                  (substitute* (string-append #$output "/usb_modeswitch")
> +                    (("(exec usb_modeswitch_dispatcher .*)( 2>>)" _ left right)
> +                     (string-append left cfg-param right))
> +                    (("(exec usb_modeswitch_dispatcher .*)( &)" _ left right)
> +                     (string-append left cfg-param right)))

Perhaps add comments to explain what’s happening here.

> +                  ;; wrap-program needs bash in PATH:
> +                  (putenv (string-append "PATH=" #$bash "/bin"))

Why do you think so?  ‘wrap-program’ does not read $PATH, AFAICS.

>From dc50f979f77d9298e8c81e6943076c612e5f459a Mon Sep 17 00:00:00 2001
> From: Florian Pelz <pelzflorian@pelzflorian.de>
> Date: Wed, 12 Jun 2019 11:16:57 +0200
> Subject: [PATCH 3/3] services: Include USB_ModeSwitch in %desktop-services.
>
> Fixes <https://bugs.gnu.org/35640>.
>
> * gnu/services/desktop.scm (%desktop-services): Add usb-modeswitch-service-type.
> * doc/guix.texi (Networking Services): Document it.

OK!

Thank you!

Ludo’.

  parent reply	other threads:[~2019-06-12 21:12 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-08 18:26 bug#35640: Make USB modems just work on Guix pelzflorian (Florian Pelz)
2019-05-09  5:31 ` pelzflorian (Florian Pelz)
2019-05-09 12:55   ` Danny Milosavljevic
2019-05-09 13:07     ` pelzflorian (Florian Pelz)
2019-05-09 13:43       ` pelzflorian (Florian Pelz)
2019-05-09 15:24 ` Ludovic Courtès
2019-05-13 20:57   ` pelzflorian (Florian Pelz)
2019-05-13 21:04     ` pelzflorian (Florian Pelz)
2019-05-14  7:22       ` pelzflorian (Florian Pelz)
2019-05-14  8:35       ` Danny Milosavljevic
2019-05-14 20:56         ` pelzflorian (Florian Pelz)
2019-05-15 13:01           ` Ludovic Courtès
2019-05-15 14:40             ` pelzflorian (Florian Pelz)
2019-05-22 16:29             ` pelzflorian (Florian Pelz)
2019-05-22 17:58               ` pelzflorian (Florian Pelz)
2019-05-24 15:37               ` Ludovic Courtès
2019-05-24 20:12                 ` pelzflorian (Florian Pelz)
2019-05-25 11:18                   ` pelzflorian (Florian Pelz)
2019-05-25 12:43                     ` pelzflorian (Florian Pelz)
2019-05-25 17:44                     ` Ludovic Courtès
2019-05-25 19:42                       ` pelzflorian (Florian Pelz)
2019-06-12 10:36                         ` pelzflorian (Florian Pelz)
2019-06-12 10:41                           ` pelzflorian (Florian Pelz)
2019-06-12 21:00                             ` Ludovic Courtès
2019-06-12 21:11                           ` Ludovic Courtès [this message]
2019-06-13 18:04                             ` pelzflorian (Florian Pelz)
2019-06-13 18:05                               ` pelzflorian (Florian Pelz)
2019-06-15 16:39                                 ` Ludovic Courtès
2019-06-12 12:13                       ` pelzflorian (Florian Pelz)
2019-06-12 12:21                         ` Ludovic Courtès
2019-06-12 19:51                           ` pelzflorian (Florian Pelz)
2019-06-12 20:42                             ` Ludovic Courtès
2019-06-12 20:58                         ` Ludovic Courtès
2019-05-14 20:48     ` Ludovic Courtès
2019-05-15 11:17     ` pelzflorian (Florian Pelz)
2019-05-15 12:51       ` Ludovic Courtès
2019-05-16  7:50   ` pelzflorian (Florian Pelz)
2019-05-16  8:34     ` pelzflorian (Florian Pelz)
2019-05-16 11:30     ` 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

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

  git send-email \
    --in-reply-to=87zhmmqzkb.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=35640@debbugs.gnu.org \
    --cc=pelzflorian@pelzflorian.de \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.