GNU bug report logs - #35640
Make USB modems just work on Guix

Previous Next

Package: guix;

Reported by: "pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de>

Date: Wed, 8 May 2019 18:27:02 UTC

Severity: normal

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 35640 in the body.
You can then email your comments to 35640 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guix <at> gnu.org:
bug#35640; Package guix. (Wed, 08 May 2019 18:27:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to "pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Wed, 08 May 2019 18:27:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de>
To: bug-guix <at> gnu.org
Subject: Make USB modems just work on Guix
Date: Wed, 8 May 2019 20:26:07 +0200
[Message part 1 (text/plain, inline)]
When plugging in a USB modem, i.e. a “surf stick” / internet stick
with a SIM card for mobile broadband, setup should be as simple as
WiFi.  However, a few things are missing in Guix.

First, the manual claims:

 -- Scheme Variable: modem-manager-service-type
     […]
     This service is part of ‘%desktop-services’ (*note Desktop
     Services::).

But it is not part of %desktop-services.  The first attached patch
fixes this oversight.

Now I can type this to get an internet connection:

sudo nmcli connection add type gsm ifname ttyUSB1 apn internet


However, I want to be able to do this setup graphically.  I made a
second patch to propagate iso-codes (for mobile broadband country
selection) and mobile-broadband-provider-selection (for selecting
defaults for providers) in nm-connection-editor
(network-manager-applet) and gnome-control-center.

Propagation is ugly though.  Should I try patching
network-manager-applet instead?  I assume there are other packages
doing such patching that I can imitate.


Now I can configure the modem as Mobile Broadband in a graphical
interface.  I cannot do so in nmtui; I believe this modem setup
feature is not included in nmtui.


However, this is not the whole truth.  Before I can configure
anything, I have to run

sudo ~/usr/sbin/usb_modeswitch -c ~/Downloads/usb-modeswitch-data-20170806/usb_modeswitch.d/12d1:14fe -v 0x12d1 -p 0x14fe

because my modem by default presents itself as a CD containing Windows
drivers and not as a USB modem.  Preferrably, usb-modeswitch and
usb-modeswitch-data would be packaged (as a single package).  I can
try that later this week.

Lastly, there are udev rules in usb-modeswitch, I believe, because on
Debian I do not need to run any command; mode switching happens
automatically when plugging in the USB modem.  I suppose that means
there should also be a usb-modeswitch-service-type extending udev?

Regards,
Florian
[0001-services-Include-ModemManager-in-desktop-services.patch (text/plain, attachment)]
[0002-gnu-network-manager-applet-Propagate-packages-requir.patch (text/plain, attachment)]

Information forwarded to bug-guix <at> gnu.org:
bug#35640; Package guix. (Thu, 09 May 2019 05:33:01 GMT) Full text and rfc822 format available.

Message #8 received at 35640 <at> debbugs.gnu.org (full text, mbox):

From: "pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de>
To: 35640 <at> debbugs.gnu.org
Subject: Re: bug#35640: Make USB modems just work on Guix
Date: Thu, 9 May 2019 07:31:58 +0200
On Wed, May 08, 2019 at 08:26:07PM +0200, pelzflorian (Florian Pelz) wrote:
> However, I want to be able to do this setup graphically.  I made a
> second patch to propagate iso-codes (for mobile broadband country
> selection) and mobile-broadband-provider-selection (for selecting
> defaults for providers) in nm-connection-editor
> (network-manager-applet) and gnome-control-center.
>

I meant mobile-broadband-provider-info.


> Propagation is ugly though.  Should I try patching
> network-manager-applet instead?  I assume there are other packages
> doing such patching that I can imitate.
> 
>

There is a branch wip-gnome3.30.  Should I base the patch on
wip-gnome3.30 or on master?


> Preferrably, usb-modeswitch and
> usb-modeswitch-data would be packaged (as a single package).

There are two source URLs, so these two must be two packages, right?

Regards,
Florian




Information forwarded to bug-guix <at> gnu.org:
bug#35640; Package guix. (Thu, 09 May 2019 12:56:02 GMT) Full text and rfc822 format available.

Message #11 received at 35640 <at> debbugs.gnu.org (full text, mbox):

From: Danny Milosavljevic <dannym <at> scratchpost.org>
To: "pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de>
Cc: 35640 <at> debbugs.gnu.org
Subject: Re: bug#35640: Make USB modems just work on Guix
Date: Thu, 9 May 2019 14:55:04 +0200
[Message part 1 (text/plain, inline)]
I think back then we thought it would be too big for the installation medium.
How big is it after that?
[Message part 2 (application/pgp-signature, inline)]

Information forwarded to bug-guix <at> gnu.org:
bug#35640; Package guix. (Thu, 09 May 2019 13:08:01 GMT) Full text and rfc822 format available.

Message #14 received at 35640 <at> debbugs.gnu.org (full text, mbox):

From: "pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de>
To: Danny Milosavljevic <dannym <at> scratchpost.org>
Cc: 35640 <at> debbugs.gnu.org
Subject: Re: bug#35640: Make USB modems just work on Guix
Date: Thu, 9 May 2019 15:07:12 +0200
On Thu, May 09, 2019 at 02:55:04PM +0200, Danny Milosavljevic wrote:
> I think back then we thought it would be too big for the installation medium.
> How big is it after that?


The installation medium uses %desktop-services?  I will check, but my
proposal does not concern the installation medium.

Regards,
Florian




Information forwarded to bug-guix <at> gnu.org:
bug#35640; Package guix. (Thu, 09 May 2019 13:45:02 GMT) Full text and rfc822 format available.

Message #17 received at 35640 <at> debbugs.gnu.org (full text, mbox):

From: "pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de>
To: Danny Milosavljevic <dannym <at> scratchpost.org>
Cc: 35640 <at> debbugs.gnu.org
Subject: Re: bug#35640: Make USB modems just work on Guix
Date: Thu, 9 May 2019 15:43:56 +0200
OBOn Thu, May 09, 2019 at 03:07:12PM +0200, pelzflorian (Florian Pelz) wrote:
> On Thu, May 09, 2019 at 02:55:04PM +0200, Danny Milosavljevic wrote:
> > I think back then we thought it would be too big for the installation medium.
> > How big is it after that?
> 
> 
> The installation medium uses %desktop-services?  I will check, but my
> proposal does not concern the installation medium.
> 

There is no size difference.  The patches only affect installed systems.

Regards,
Florian




Information forwarded to bug-guix <at> gnu.org:
bug#35640; Package guix. (Thu, 09 May 2019 15:25:01 GMT) Full text and rfc822 format available.

Message #20 received at 35640 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: "pelzflorian \(Florian Pelz\)" <pelzflorian <at> pelzflorian.de>
Cc: 35640 <at> debbugs.gnu.org
Subject: Re: bug#35640: Make USB modems just work on Guix
Date: Thu, 09 May 2019 17:24:39 +0200
Hi Florian,

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

>>From 5e9b45fe785dee52da2a67fbecbabc4741f85e54 Mon Sep 17 00:00:00 2001
> From: Florian Pelz <pelzflorian <at> pelzflorian.de>
> Date: Tue, 7 May 2019 11:51:43 +0200
> Subject: [PATCH 1/2] services: Include ModemManager in %desktop-services.
>
> * gnu/services/desktop.scm (%desktop-services): Add modem-manager-service-type.
> ---
>  gnu/services/desktop.scm | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/gnu/services/desktop.scm b/gnu/services/desktop.scm
> index 5e0bd102a2..c0300c0ddc 100644
> --- a/gnu/services/desktop.scm
> +++ b/gnu/services/desktop.scm
> @@ -1062,6 +1062,9 @@ dispatches events from it.")))
>  
>           ;; The D-Bus clique.
>           (service network-manager-service-type)
> +         (service modem-manager-service-type) ;the manual claims this were
> +                                              ;part of %desktop-services, but
> +                                              ;it wasn’t

The comment is unnecessary, but otherwise LGTM!

I’ve confirmed that there is no size increase:

--8<---------------cut here---------------start------------->8---
$ guix size network-manager | tail -1
total: 534.9 MiB
$ guix size network-manager modem-manager | tail -1
total: 534.9 MiB
--8<---------------cut here---------------end--------------->8---

>>From d489f805599ea63e2e06727a3201572ee0480a60 Mon Sep 17 00:00:00 2001
> From: Florian Pelz <pelzflorian <at> pelzflorian.de>
> Date: Wed, 8 May 2019 20:02:00 +0200
> Subject: [PATCH 2/2] gnu: network-manager-applet: Propagate packages required
>  for USB modem setup.
>
> * gnu/packages/gnome.scm (network-manager-applet): Propagate iso-codes and
>   mobile-broadband-provider-info.
>   (gnome-control-center): Ditto.

Would it be an option to avoid propagation by instead substituting
references to these two things in the code of network-manager-applet and
gnome-control-center?  WDYT?

Thanks!

Ludo’.




Information forwarded to bug-guix <at> gnu.org:
bug#35640; Package guix. (Mon, 13 May 2019 20:58:02 GMT) Full text and rfc822 format available.

Message #23 received at 35640 <at> debbugs.gnu.org (full text, mbox):

From: "pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 35640 <at> debbugs.gnu.org
Subject: Re: bug#35640: Make USB modems just work on Guix
Date: Mon, 13 May 2019 22:57:20 +0200
[Message part 1 (text/plain, inline)]
On Thu, May 09, 2019 at 05:24:39PM +0200, Ludovic Courtès wrote:
> The comment is unnecessary, but otherwise LGTM!
> 

:) I have attached the patch without the command.

Also attached is my current work-in-progress package for
USB_ModeSwitch.  It does *not* work because I cannot figure out how to
use tcl in the package’s inputs field.

#:use-module gives me errors; only (@ (gnu packages tcl) tcl) appears
to work.

> Would it be an option to avoid propagation by instead substituting
> references to these two things in the code of network-manager-applet and
> gnome-control-center?  WDYT?
> 

I will try finding and imitating an example for such substitutions
tomorrow.

Regards,
Florian
[0001-services-Include-ModemManager-in-desktop-services.patch (text/plain, attachment)]
[0001-Add-USB_ModeSwitch.patch (text/plain, attachment)]

Information forwarded to bug-guix <at> gnu.org:
bug#35640; Package guix. (Mon, 13 May 2019 21:06:02 GMT) Full text and rfc822 format available.

Message #26 received at 35640 <at> debbugs.gnu.org (full text, mbox):

From: "pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 35640 <at> debbugs.gnu.org
Subject: Re: bug#35640: Make USB modems just work on Guix
Date: Mon, 13 May 2019 23:04:43 +0200
On Mon, May 13, 2019 at 10:57:20PM +0200, pelzflorian (Florian Pelz) wrote:
> Also attached is my current work-in-progress package for
> USB_ModeSwitch.  It does *not* work because I cannot figure out how to
> use tcl in the package’s inputs field.
> 
> #:use-module gives me errors; only (@ (gnu packages tcl) tcl) appears
> to work.
> 

I uploaded

+    (inputs `(("libusb" ,libusb)
+              ("tcl" ,(error tcl:tcl))))

This was a mistake, I mean

+    (inputs `(("libusb" ,libusb)
+              ("tcl" tcl:tcl)))

It still gives me errors when used:

florian <at> florianmacbook ~/git/guix [env]$ ./pre-inst-env guix install usb-modeswitch:dispatcher usb-modeswitch 
Backtrace:
          18 (apply-smob/1 #<catch-closure 7aa0a0>)
In ice-9/boot-9.scm:
    705:2 17 (call-with-prompt _ _ #<procedure default-prompt-handler (k proc)>)
In ice-9/eval.scm:
    619:8 16 (_ #(#(#<directory (guile-user) 893140>)))
In guix/ui.scm:
  1747:12 15 (run-guix-command _ . _)
In ice-9/boot-9.scm:
    829:9 14 (catch _ _ #<procedure 7fd151e1a910 at guix/ui.scm:703:2 (key c)> _)
    829:9 13 (catch _ _ #<procedure 7fd151e1a928 at guix/ui.scm:826:6 (key proc format-string format-args . rest)> _)
In guix/scripts/package.scm:
   915:10 12 (_)
In guix/status.scm:
    768:4 11 (call-with-status-report _ _)
In guix/scripts/package.scm:
   923:14 10 (_)
    882:6  9 (process-actions #<store-connection 256.99 cfeea0> _)
In guix/ui.scm:
   1096:4  8 (show-manifest-transaction #<store-connection 256.99 cfeea0> _ _ #:dry-run? _)
In srfi/srfi-1.scm:
   628:19  7 (mapn ("usb-modeswitch" "usb-modeswitch") (("2.5.2" "2.5.2") ("dispatcher" "out") (#<package usb-modeswitch <at> 2.5.2 gnu/packages/libusb.scm:642 174c8f0> #<package usb-modeswitch <at> 2.5.2 gnu/packages/libusb.scm:642 174c8f0>)) 2)
In guix/ui.scm:
  1101:23  6 (_ "usb-modeswitch" "2.5.2" "dispatcher" #<package usb-modeswitch <at> 2.5.2 gnu/packages/libusb.scm:642 174c8f0>)
In guix/packages.scm:
  1296:13  5 (package-output #<store-connection 256.99 cfeea0> #<package usb-modeswitch <at> 2.5.2 gnu/packages/libusb.scm:642 174c8f0> _ _)
   936:16  4 (cache! #<weak-table 178/223> #<package usb-modeswitch <at> 2.5.2 gnu/packages/libusb.scm:642 174c8f0> ("x86_64-linux" . #t) _)
  1254:22  3 (thunk)
   936:16  2 (cache! #<weak-table 178/223> #<package usb-modeswitch <at> 2.5.2 gnu/packages/libusb.scm:642 174c8f0> ("x86_64-linux" #f #t) _)
  1042:46  1 (thunk)
In gnu/packages/libusb.scm:
   655:12  0 (inputs _)

gnu/packages/libusb.scm:655:12: In procedure inputs:
error: tcl:tcl: unbound variable

Regards,
Florian




Information forwarded to bug-guix <at> gnu.org:
bug#35640; Package guix. (Tue, 14 May 2019 07:24:02 GMT) Full text and rfc822 format available.

Message #29 received at 35640 <at> debbugs.gnu.org (full text, mbox):

From: "pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 35640 <at> debbugs.gnu.org
Subject: Re: bug#35640: Make USB modems just work on Guix
Date: Tue, 14 May 2019 09:22:39 +0200
On Mon, May 13, 2019 at 11:04:43PM +0200, pelzflorian (Florian Pelz) wrote:
> gnu/packages/libusb.scm:655:12: In procedure inputs:
> error: tcl:tcl: unbound variable
> 

This tcl:tcl gets resolved all right elsewhere in the libusb.scm file.
There must be something special about <package> definitions or their
inputs.

Regards,
Florian




Information forwarded to bug-guix <at> gnu.org:
bug#35640; Package guix. (Tue, 14 May 2019 08:37:02 GMT) Full text and rfc822 format available.

Message #32 received at 35640 <at> debbugs.gnu.org (full text, mbox):

From: Danny Milosavljevic <dannym <at> scratchpost.org>
To: "pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de>
Cc: 35640 <at> debbugs.gnu.org, Ludovic Courtès <ludo <at> gnu.org>
Subject: Re: bug#35640: Make USB modems just work on Guix
Date: Tue, 14 May 2019 10:35:55 +0200
[Message part 1 (text/plain, inline)]
Hi Florian,

On Mon, 13 May 2019 23:04:43 +0200
"pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de> wrote:

> On Mon, May 13, 2019 at 10:57:20PM +0200, pelzflorian (Florian Pelz) wrote:
> > Also attached is my current work-in-progress package for
> > USB_ModeSwitch.  It does *not* work because I cannot figure out how to
> > use tcl in the package’s inputs field.
> > 
> > #:use-module gives me errors; only (@ (gnu packages tcl) tcl) appears
> > to work.

The problem is there's a use-modules cycle somewhere.

> I uploaded
> 
> +    (inputs `(("libusb" ,libusb)
> +              ("tcl" ,(error tcl:tcl))))
> 
> This was a mistake, I mean
> 
> +    (inputs `(("libusb" ,libusb)
> +              ("tcl" tcl:tcl)))

Should be

   (inputs `(("libusb" ,libusb)
             ("tcl" ,tcl:tcl)))

But I guess you meant that anyway.

The problem is there's a use-modules cycle somewhere.
Try putting usb-modeswitch in another module (a new one if necessary).

Also, does it really require tcl?  Sounds kinda weird to me.
[Message part 2 (application/pgp-signature, inline)]

Information forwarded to bug-guix <at> gnu.org:
bug#35640; Package guix. (Tue, 14 May 2019 20:49:02 GMT) Full text and rfc822 format available.

Message #35 received at 35640 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: "pelzflorian \(Florian Pelz\)" <pelzflorian <at> pelzflorian.de>
Cc: 35640 <at> debbugs.gnu.org
Subject: Re: bug#35640: Make USB modems just work on Guix
Date: Tue, 14 May 2019 22:48:19 +0200
"pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de> skribis:

> +  #:use-module ((gnu packages tcl) #:prefix tcl:)

In short, you cannot do that for (gnu packages …) modules.

But if you remove that #:prefix, it’s hopefully fine?

Thanks,
Ludo’.




Information forwarded to bug-guix <at> gnu.org:
bug#35640; Package guix. (Tue, 14 May 2019 20:58:03 GMT) Full text and rfc822 format available.

Message #38 received at 35640 <at> debbugs.gnu.org (full text, mbox):

From: "pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de>
To: Danny Milosavljevic <dannym <at> scratchpost.org>
Cc: 35640 <at> debbugs.gnu.org, Ludovic Courtès <ludo <at> gnu.org>
Subject: Re: bug#35640: Make USB modems just work on Guix
Date: Tue, 14 May 2019 22:56:48 +0200
[Message part 1 (text/plain, inline)]
On Tue, May 14, 2019 at 10:35:55AM +0200, Danny Milosavljevic wrote:
> Should be
> 
>    (inputs `(("libusb" ,libusb)
>              ("tcl" ,tcl:tcl)))
> 

Yes I did mean that with comma, sorry.

> But I guess you meant that anyway.
> 
> The problem is there's a use-modules cycle somewhere.
> Try putting usb-modeswitch in another module (a new one if necessary).
>

Using a new module helps, thank you!  Now I also do not need a prefix
tcl: anymore.  @Ludo: without that prefix, I got errors because 'zip
was redefined or something, I do not remember now.

Now only packaging issues remain.  When I use trivial-build-system,

       #:builder
       (begin
         (use-modules (guix build utils)
                      (guix packages))
         (let ((source (assoc-ref %build-inputs "source"))
               (tar (assoc-ref %build-inputs "tar"))
               (bzip2 (assoc-ref %build-inputs "bzip2"))
               (share-dir (string-append %output "/share")))
           (copy-file source "data.tar.bz2")
           (invoke (string-append bzip2 "/bin/bzip2") "-d" "data.tar.bz2")
           (invoke (string-append tar "/bin/tar") "xvf" "data.tar")
           (install-file (string-append "usb-modeswitch-data-"
                                        (package-version this-package)
                                        "/usb_modeswitch.d") share-dir))
         #t)))

this package-version call seems not to work (at least not without more
adding more modules).  Is this the right approach?  Also I forgot, do
I need this #t at the end?


> Also, does it really require tcl?  Sounds kinda weird to me.

TCL is not needed for command-line mode switching, but there is a TCL
script called usb_modeswitch_dispatcher that gets called by the UDEV
rule and by the systemd service file shipped with USB_ModeSwitch.
This dispatcher automatically modeswitches USB devices that are
plugged in, I believe.

Regards,
Florian
[0001-Add-USB_ModeSwitch.patch (text/plain, attachment)]

Information forwarded to bug-guix <at> gnu.org:
bug#35640; Package guix. (Wed, 15 May 2019 11:19:02 GMT) Full text and rfc822 format available.

Message #41 received at 35640 <at> debbugs.gnu.org (full text, mbox):

From: "pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 35640 <at> debbugs.gnu.org
Subject: Re: bug#35640: Make USB modems just work on Guix
Date: Wed, 15 May 2019 13:17:44 +0200
[Message part 1 (text/plain, inline)]
On Mon, May 13, 2019 at 10:57:20PM +0200, pelzflorian (Florian Pelz) wrote:
> On Thu, May 09, 2019 at 05:24:39PM +0200, Ludovic Courtès wrote:
> > The comment is unnecessary, but otherwise LGTM!
> > 
> 
> :) I have attached the patch without the command.
> 

I have attached the patch again without the comment and with
mentioning modem support in the Desktop services section in the
doc/guix.texi manual.  Previously it was only said in the Network
services section that modem-manager-service-type were part of
%desktop-services.

Regards,
Florian
[0001-services-Include-ModemManager-in-desktop-services.patch (text/plain, attachment)]

Information forwarded to bug-guix <at> gnu.org:
bug#35640; Package guix. (Wed, 15 May 2019 12:52:01 GMT) Full text and rfc822 format available.

Message #44 received at 35640 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: "pelzflorian \(Florian Pelz\)" <pelzflorian <at> pelzflorian.de>
Cc: 35640 <at> debbugs.gnu.org
Subject: Re: bug#35640: Make USB modems just work on Guix
Date: Wed, 15 May 2019 14:51:20 +0200
"pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de> skribis:

> From 061c976e38b8b332602e84ac74717384aab57d56 Mon Sep 17 00:00:00 2001
> From: Florian Pelz <pelzflorian <at> pelzflorian.de>
> Date: Mon, 13 May 2019 22:51:28 +0200
> Subject: [PATCH] services: Include ModemManager in %desktop-services.
>
> * gnu/services/desktop.scm (%desktop-services): Add modem-manager-service-type.
> * doc/guix.texi (Desktop services): Mention it here.

Applied.  I had applied the desktop.scm yesterday, so I’ve taken just
the texi part here.

Thanks!

Ludo’.




Information forwarded to bug-guix <at> gnu.org:
bug#35640; Package guix. (Wed, 15 May 2019 13:02:02 GMT) Full text and rfc822 format available.

Message #47 received at 35640 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: "pelzflorian \(Florian Pelz\)" <pelzflorian <at> pelzflorian.de>
Cc: Danny Milosavljevic <dannym <at> scratchpost.org>, 35640 <at> debbugs.gnu.org
Subject: Re: bug#35640: Make USB modems just work on Guix
Date: Wed, 15 May 2019 15:01:04 +0200
Hi,

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

> On Tue, May 14, 2019 at 10:35:55AM +0200, Danny Milosavljevic wrote:

[...]

>> The problem is there's a use-modules cycle somewhere.
>> Try putting usb-modeswitch in another module (a new one if necessary).
>>
>
> Using a new module helps, thank you!  Now I also do not need a prefix
> tcl: anymore.  @Ludo: without that prefix, I got errors because 'zip
> was redefined or something, I do not remember now.

That could be a collision with ‘zip’ from (srfi srfi-1) or with ‘zlib’
from (guix licenses), which can both be worked around by doing something
along these lines:

  #:use-module ((srfi srfi-1) #:hide (zip))

> Now only packaging issues remain.  When I use trivial-build-system,
>
>        #:builder
>        (begin
>          (use-modules (guix build utils)
>                       (guix packages))
>          (let ((source (assoc-ref %build-inputs "source"))
>                (tar (assoc-ref %build-inputs "tar"))
>                (bzip2 (assoc-ref %build-inputs "bzip2"))
>                (share-dir (string-append %output "/share")))
>            (copy-file source "data.tar.bz2")
>            (invoke (string-append bzip2 "/bin/bzip2") "-d" "data.tar.bz2")
>            (invoke (string-append tar "/bin/tar") "xvf" "data.tar")
>            (install-file (string-append "usb-modeswitch-data-"
>                                         (package-version this-package)
                                          ^
You’re missing a comma (“unquote”) so that ‘package-version’ is called
on the host side; it doesn’t exist on the build side.

>                                         "/usb_modeswitch.d") share-dir))
>          #t)))

#t is unnecessary here.

> From 3430070606904b6dc6b247a6b8bfb2ce7c4fce0f Mon Sep 17 00:00:00 2001
> From: Florian Pelz <pelzflorian <at> pelzflorian.de>
> Date: Tue, 14 May 2019 12:36:24 +0200
> Subject: [PATCH] Add USB_ModeSwitch.
>
> * gnu/packages/usb-modeswitch.scm (usb-modeswitch-data) Add it.
> (usb-modeswitch) Add it.

Just “New file”.  Make sure to add the file to gnu/local.mk please.

> +(define-module (gnu packages libusb)

Please adjust the module name: it should be ‘usb-modeswitch’.

> +    (synopsis "Data package for USB_ModeSwitch")
> +    (description "Device data collection and UDEV rules file for
> +USB_ModeSwitch.")

Please make it a full sentence, and ideally expound a bit (info "(guix)
Synopses and Descriptions").

> +;;                 (use-modules (guix build utils))

Make sure to remove any leftovers like this comment before sending the
next version.  :-)

> +         (replace 'install
> +           (lambda _                  ; calling make would use usr as PREFIX
> +             (let* ((source (assoc-ref %build-inputs "source"))
> +                    (out (assoc-ref %outputs "out"))
> +                    (bin (string-append out "/bin"))

Please don’t refer to global variables ‘%outputs’ and ‘%build-inputs’.
Instead, take them from the phase’s arguments:

  (lambda* (#:key source outputs inputs #:allow-other-keys)
    (let* ((out (assoc-ref outputs "out")))
      …))

> +                 (install-file "usb_modeswitch_dispatcher"
> +                               dispatcher-bin))))))))

The phase must return #t.

> +    (synopsis "Mode switching tool for controlling 'multi-mode' USB devices")

Probably `multi-mode', as expected in Texinfo.

> +    (description "USB_ModeSwitch is a mode switching tool for controlling USB
> +devices with multiple \"modes\".  When plugged in for the first time many USB

… and @dfn{modes}

Could you send an updated patch?

Is USB_ModeSwitch needed for proper use of ModemManager?  I’d say “no”
but I’m unsure.

Thanks for working on it!

Ludo’.




Information forwarded to bug-guix <at> gnu.org:
bug#35640; Package guix. (Wed, 15 May 2019 14:41:01 GMT) Full text and rfc822 format available.

Message #50 received at 35640 <at> debbugs.gnu.org (full text, mbox):

From: "pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: Danny Milosavljevic <dannym <at> scratchpost.org>, 35640 <at> debbugs.gnu.org
Subject: Re: bug#35640: Make USB modems just work on Guix
Date: Wed, 15 May 2019 16:40:10 +0200
On Wed, May 15, 2019 at 03:01:04PM +0200, Ludovic Courtès wrote:
> Could you send an updated patch?
> 

Thank you very much!  Will do later, today or tomorrow.


> Is USB_ModeSwitch needed for proper use of ModemManager?  I’d say “no”
> but I’m unsure.
>

Only on some modems.

> Thanks for working on it!
> 
> Ludo’.

:)

Regards,
Florian




Information forwarded to bug-guix <at> gnu.org:
bug#35640; Package guix. (Thu, 16 May 2019 07:51:02 GMT) Full text and rfc822 format available.

Message #53 received at 35640 <at> debbugs.gnu.org (full text, mbox):

From: "pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 35640 <at> debbugs.gnu.org
Subject: Re: bug#35640: Make USB modems just work on Guix
Date: Thu, 16 May 2019 09:50:18 +0200
[Message part 1 (text/plain, inline)]
On Thu, May 09, 2019 at 05:24:39PM +0200, Ludovic Courtès wrote:
> >>From d489f805599ea63e2e06727a3201572ee0480a60 Mon Sep 17 00:00:00 2001
> > From: Florian Pelz <pelzflorian <at> pelzflorian.de>
> > Date: Wed, 8 May 2019 20:02:00 +0200
> > Subject: [PATCH 2/2] gnu: network-manager-applet: Propagate packages required
> >  for USB modem setup.
> >
> > * gnu/packages/gnome.scm (network-manager-applet): Propagate iso-codes and
> >   mobile-broadband-provider-info.
> >   (gnome-control-center): Ditto.
> 
> Would it be an option to avoid propagation by instead substituting
> references to these two things in the code of network-manager-applet and
> gnome-control-center?  WDYT?
> 

I have confirmed that the patch attached to this e-mail makes
network-manager-applet’s libnma library load its data from the store
and not the profile.  This fixes nm-connection-editor from
network-manager-applet as well as gnome-control-center which
previously required modem-broadband-provider-info and iso-codes to be
installed in the profile.

I am still working on packaging USB_ModeSwitch which some USB modems
require.

Regards,
Florian
[0001-gnu-network-manager-applet-Patch-libnma-for-modem-su.patch (text/plain, attachment)]

Information forwarded to bug-guix <at> gnu.org:
bug#35640; Package guix. (Thu, 16 May 2019 08:36:02 GMT) Full text and rfc822 format available.

Message #56 received at 35640 <at> debbugs.gnu.org (full text, mbox):

From: "pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 35640 <at> debbugs.gnu.org
Subject: Re: bug#35640: Make USB modems just work on Guix
Date: Thu, 16 May 2019 10:34:46 +0200
On Thu, May 16, 2019 at 09:50:18AM +0200, pelzflorian (Florian Pelz) wrote:
> From 627e41c4741acd5b91771131a1646bb89b8c270b Mon Sep 17 00:00:00 2001
> From: Florian Pelz <pelzflorian <at> pelzflorian.de>
> Date: Wed, 15 May 2019 23:41:44 +0200
> Subject: [PATCH] gnu: network-manager-applet: Patch libnma for modem support.
> 
> * gnu/packages/gnome.scm (network-manager-applet): Patch libnma to load
> iso-codes and mobile-broadband-provider-info from the store and not require
> them in the profile.

I hope it would not have been required to increase a revision number.

Regards,
Florian




Information forwarded to bug-guix <at> gnu.org:
bug#35640; Package guix. (Thu, 16 May 2019 11:31:02 GMT) Full text and rfc822 format available.

Message #59 received at 35640 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: "pelzflorian \(Florian Pelz\)" <pelzflorian <at> pelzflorian.de>
Cc: 35640 <at> debbugs.gnu.org
Subject: Re: bug#35640: Make USB modems just work on Guix
Date: Thu, 16 May 2019 13:30:17 +0200
[Message part 1 (text/plain, inline)]
"pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de> skribis:

> From 627e41c4741acd5b91771131a1646bb89b8c270b Mon Sep 17 00:00:00 2001
> From: Florian Pelz <pelzflorian <at> pelzflorian.de>
> Date: Wed, 15 May 2019 23:41:44 +0200
> Subject: [PATCH] gnu: network-manager-applet: Patch libnma for modem support.
>
> * gnu/packages/gnome.scm (network-manager-applet): Patch libnma to load
> iso-codes and mobile-broadband-provider-info from the store and not require
> them in the profile.

Great.  Applied with the changes below; the spacing change is to please
Emacs (C-M-a & co. get confused by opening parentheses at the beginning
of a line.)

Thanks,
Ludo’.

[Message part 2 (text/x-patch, inline)]
diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
index fc024ebf72..9070673cf6 100644
--- a/gnu/packages/gnome.scm
+++ b/gnu/packages/gnome.scm
@@ -5512,14 +5512,15 @@ to virtual private networks (VPNs) via OpenVPN.")
                                               "mobile-broadband-provider-info"))
                              (iso-codes (assoc-ref inputs "iso-codes")))
                          (substitute* "src/libnma/nma-mobile-providers.c"
-                           (("(g_build_filename \\()dirs\\[i\\].*, \
-(MOBILE_BROADBAND_PROVIDER_INFO.*)" all start end)
+                           (("(g_build_filename \\()dirs\\[i\\].*,\
+ (MOBILE_BROADBAND_PROVIDER_INFO.*)" all start end)
                             (string-append start "\"" mbpi "/share\", " end)))
                          (substitute* "src/libnma/nma-mobile-providers.c"
-                           (("(g_build_filename \\()dirs\\[i\\].*, \
-(ISO_3166_COUNTRY_CODES.*)" all start end)
+                           (("(g_build_filename \\()dirs\\[i\\].*,\
+ (ISO_3166_COUNTRY_CODES.*)" all start end)
                             (string-append start "\"" iso-codes
-                                           "/share\", " end)))))))))
+                                           "/share\", " end)))
+                         #t))))))
     (native-inputs
      `(("intltool" ,intltool)
        ("gobject-introspection" ,gobject-introspection)

Information forwarded to bug-guix <at> gnu.org:
bug#35640; Package guix. (Wed, 22 May 2019 16:30:02 GMT) Full text and rfc822 format available.

Message #62 received at 35640 <at> debbugs.gnu.org (full text, mbox):

From: "pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: Danny Milosavljevic <dannym <at> scratchpost.org>, 35640 <at> debbugs.gnu.org
Subject: Re: bug#35640: Make USB modems just work on Guix
Date: Wed, 22 May 2019 18:29:09 +0200
[Message part 1 (text/plain, inline)]
Thank you for your thorough review.  Find attached a new version of
the patch.  I can now modeswitch my USB modem by doing

./pre-inst-env guix install usb-modeswitch:dispatcher
sudo usb_modeswitch -c ~/.guix-profile/share/usb_modeswitch.d/12d1\:14fe -v 0x12d1 -p 0x14fe

Tring to put the packages in gnu/packages/libusb.scm and not in their
own file gnu/packages/usb-modeswitch.scm again resulted in

[ 11%] LOAD     guix/scripts/search.scm
[ 11%] LOAD     guix/scripts/gc.scm
[ 11%] LOAD     guix/scripts/hash.scm
[ 11%] LOAD     guix/scripts/pack.scm
Backtrace:
In ice-9/boot-9.scm:
   222:29 19 (map1 (((guix utils)) ((guix store)) ((guix #) # (#)) …))
   222:29 18 (map1 (((guix store)) ((guix status) #:select (#)) (#) …))
   222:29 17 (map1 (((guix status) #:select (#)) ((guix grafts)) # …))
   222:29 16 (map1 (((guix grafts)) ((guix monads)) ((guix #)) (#) …))
   222:29 15 (map1 (((guix monads)) ((guix modules)) ((guix #)) (#) …))
   222:29 14 (map1 (((guix modules)) ((guix packages)) ((guix #)) # …))
   222:29 13 (map1 (((guix packages)) ((guix profiles)) ((guix #)) …))
   222:29 12 (map1 (((guix profiles)) ((guix describe)) ((guix #)) …))
   222:29 11 (map1 (((guix describe)) ((guix derivations)) ((# #)) …))
   222:29 10 (map1 (((guix derivations)) ((guix search-paths)) (#) …))
   222:29  9 (map1 (((guix search-paths)) ((guix build-system #)) # …))
   222:29  8 (map1 (((guix build-system gnu)) ((guix scripts #)) # …))
   222:29  7 (map1 (((guix scripts build)) ((guix self) #:select …) …))
   222:29  6 (map1 (((guix self) #:select (make-config.scm)) ((…)) …))
   222:29  5 (map1 (((gnu packages)) ((gnu packages bootstrap)) (…) …))
   222:29  4 (map1 (((gnu packages bootstrap)) ((gnu packages …) …) …))
   222:17  3 (map1 (((gnu packages compression) #:hide (zip)) ((…)) …))
  2830:10  2 (resolve-interface (gnu packages compression) #:select _ …)
   260:13  1 (for-each #<procedure 52470e0 at ice-9/boot-9.scm:2830…> …)
In unknown file:
           0 (scm-error misc-error #f "~A" ("no binding `zip' to h…") …)

ERROR: In procedure scm-error:
no binding `zip' to hide in module (gnu packages compression)

when running make.  Then I rebuilt and commented and uncommented and
moved some code and putting the code in gnu/packages/libusb.scm worked
again in ./pre-inst-env.  Later it failed again.  Danny speculated the
reason was a use-module cycle.  I would like confirmation that this is
what a use-module cycle looks like and that I should stop trying to
put usb-modeswitch back in gnu/packages/libusb.scm.


As for the packaging, I hope it is correct to still refer to %outputs
in the trivial-build-system for usb-modeswitch-data.

Should I also make the usb-modeswitch-data package install the license
file of usb-modeswitch-data?

Or should I use gnu-build-system instead of trivial-build-system?
trivial works now though.

The file dispatcher.c of usb-modeswitch is licensed bsd-2 and not
gpl2+.  Should I list both licenses or just gpl2+?

I have checked the license of the files of usb-modeswitch-data and
usb-modeswitch by going through each of them with the `less` program
and reading its header while assuming that no license header means the
file has the license described in the README file, by diff’ing the
license files with a license downloaded from gnu.org, and that nothing
looked like a program blob (there only are very small hex strings for
the messages USB_ModeSwitch sends like

MessageContent="55534243123456782400000080000612000024000000000000000000000000"

that seem harmless).  Is this the usual procedure?

Currently I also install the UDEV rule shipped with
usb-modeswitch-data; I hope this is correct.

Currently I install the usb_modeswitch_dispatcher that is needed by
the udev rule in a separate output called “dispatcher”.  I am unsure
if this usb_modeswitch_dispatcher would need the usb_modeswitch
program from the “out” output.  Is it OK when one output only works
when the “out” output is installed too?

What is still missing is adding a service type for usb-modeswitch that
extends the udev service type by the rules file and that calls the
usb-modeswitch dispatcher once every reboot.  I can try making one,
but I am not sure if this is the right approach.  I am also unsure if
this service should be part of %desktop-services; many modems need it
though and modem-manager-service-type.

Regards,
Florian
[0001-gnu-Add-USB_ModeSwitch.patch (text/plain, attachment)]

Information forwarded to bug-guix <at> gnu.org:
bug#35640; Package guix. (Wed, 22 May 2019 18:00:02 GMT) Full text and rfc822 format available.

Message #65 received at 35640 <at> debbugs.gnu.org (full text, mbox):

From: "pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 35640 <at> debbugs.gnu.org
Subject: Re: bug#35640: Make USB modems just work on Guix
Date: Wed, 22 May 2019 19:58:58 +0200
[Message part 1 (text/plain, inline)]
I forgot to mention gnu/local.mk in the commit message.  Please use
this patch attached here instead.

Regards,
Florian
[0001-gnu-Add-USB_ModeSwitch.patch (text/plain, attachment)]

Information forwarded to bug-guix <at> gnu.org:
bug#35640; Package guix. (Fri, 24 May 2019 15:38:02 GMT) Full text and rfc822 format available.

Message #68 received at 35640 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: "pelzflorian \(Florian Pelz\)" <pelzflorian <at> pelzflorian.de>
Cc: Danny Milosavljevic <dannym <at> scratchpost.org>, 35640 <at> debbugs.gnu.org
Subject: Re: bug#35640: Make USB modems just work on Guix
Date: Fri, 24 May 2019 17:37:01 +0200
Hello,

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

> Tring to put the packages in gnu/packages/libusb.scm and not in their
> own file gnu/packages/usb-modeswitch.scm again resulted in
>
> [ 11%] LOAD     guix/scripts/search.scm
> [ 11%] LOAD     guix/scripts/gc.scm
> [ 11%] LOAD     guix/scripts/hash.scm
> [ 11%] LOAD     guix/scripts/pack.scm
> Backtrace:
> In ice-9/boot-9.scm:
>    222:29 19 (map1 (((guix utils)) ((guix store)) ((guix #) # (#)) …))
>    222:29 18 (map1 (((guix store)) ((guix status) #:select (#)) (#) …))
>    222:29 17 (map1 (((guix status) #:select (#)) ((guix grafts)) # …))
>    222:29 16 (map1 (((guix grafts)) ((guix monads)) ((guix #)) (#) …))
>    222:29 15 (map1 (((guix monads)) ((guix modules)) ((guix #)) (#) …))
>    222:29 14 (map1 (((guix modules)) ((guix packages)) ((guix #)) # …))
>    222:29 13 (map1 (((guix packages)) ((guix profiles)) ((guix #)) …))
>    222:29 12 (map1 (((guix profiles)) ((guix describe)) ((guix #)) …))
>    222:29 11 (map1 (((guix describe)) ((guix derivations)) ((# #)) …))
>    222:29 10 (map1 (((guix derivations)) ((guix search-paths)) (#) …))
>    222:29  9 (map1 (((guix search-paths)) ((guix build-system #)) # …))
>    222:29  8 (map1 (((guix build-system gnu)) ((guix scripts #)) # …))
>    222:29  7 (map1 (((guix scripts build)) ((guix self) #:select …) …))
>    222:29  6 (map1 (((guix self) #:select (make-config.scm)) ((…)) …))
>    222:29  5 (map1 (((gnu packages)) ((gnu packages bootstrap)) (…) …))
>    222:29  4 (map1 (((gnu packages bootstrap)) ((gnu packages …) …) …))
>    222:17  3 (map1 (((gnu packages compression) #:hide (zip)) ((…)) …))
>   2830:10  2 (resolve-interface (gnu packages compression) #:select _ …)
>    260:13  1 (for-each #<procedure 52470e0 at ice-9/boot-9.scm:2830…> …)
> In unknown file:
>            0 (scm-error misc-error #f "~A" ("no binding `zip' to h…") …)
>
> ERROR: In procedure scm-error:
> no binding `zip' to hide in module (gnu packages compression)

You cannot use #:hide on (gnu packages …) modules, for unfortunate and
obscure reasons.  The trick would be to hide the other ‘zip’ binding,
the one from (srfi srfi-1).

> As for the packaging, I hope it is correct to still refer to %outputs
> in the trivial-build-system for usb-modeswitch-data.

Yes.

> Should I also make the usb-modeswitch-data package install the license
> file of usb-modeswitch-data?
>
> Or should I use gnu-build-system instead of trivial-build-system?
> trivial works now though.

In general we should install license files.  If ‘trivial’ works for you,
that’s OK; an additional line to install the license would be welcome,
but not blocking.

> The file dispatcher.c of usb-modeswitch is licensed bsd-2 and not
> gpl2+.  Should I list both licenses or just gpl2+?

I think it’s enough to mark it as ‘gpl2+’ because, IIUC, the combination
of all this is GPLv2+.  If you think that needs clarification, you can
just add a comment about the ‘license’ field.

> I have checked the license of the files of usb-modeswitch-data and
> usb-modeswitch by going through each of them with the `less` program
> and reading its header while assuming that no license header means the
> file has the license described in the README file, by diff’ing the
> license files with a license downloaded from gnu.org, and that nothing
> looked like a program blob (there only are very small hex strings for
> the messages USB_ModeSwitch sends like
>
> MessageContent="55534243123456782400000080000612000024000000000000000000000000"
>
> that seem harmless).  Is this the usual procedure?

Yes.  I often just scan a few source file headers, not necessarily all
of them, but of course doing an exhaustive search is even better!

> Currently I also install the UDEV rule shipped with
> usb-modeswitch-data; I hope this is correct.

Yep.

> Currently I install the usb_modeswitch_dispatcher that is needed by
> the udev rule in a separate output called “dispatcher”.  I am unsure
> if this usb_modeswitch_dispatcher would need the usb_modeswitch
> program from the “out” output.  Is it OK when one output only works
> when the “out” output is installed too?

I’d say no.  :-)  In general, we want “guix install foo:bar” to provide
something that Just Works.

> What is still missing is adding a service type for usb-modeswitch that
> extends the udev service type by the rules file and that calls the
> usb-modeswitch dispatcher once every reboot.  I can try making one,
> but I am not sure if this is the right approach.  I am also unsure if
> this service should be part of %desktop-services; many modems need it
> though and modem-manager-service-type.

We’ll see that later.  :-)

Let me know if you want to send an updated patch if you we should
proceed with the one you sent.

Thanks!

Ludo’.




Information forwarded to bug-guix <at> gnu.org:
bug#35640; Package guix. (Fri, 24 May 2019 20:13:01 GMT) Full text and rfc822 format available.

Message #71 received at 35640 <at> debbugs.gnu.org (full text, mbox):

From: "pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: Danny Milosavljevic <dannym <at> scratchpost.org>, 35640 <at> debbugs.gnu.org
Subject: Re: bug#35640: Make USB modems just work on Guix
Date: Fri, 24 May 2019 22:12:10 +0200
Thank you for your feedback!

On Fri, May 24, 2019 at 05:37:01PM +0200, Ludovic Courtès wrote:
> > Tring to put the packages in gnu/packages/libusb.scm and not in their
> > own file gnu/packages/usb-modeswitch.scm again resulted in
> >
> > [ 11%] LOAD     guix/scripts/search.scm
> > [ 11%] LOAD     guix/scripts/gc.scm
> > [ 11%] LOAD     guix/scripts/hash.scm
> > [ 11%] LOAD     guix/scripts/pack.scm
> > Backtrace:
> > In ice-9/boot-9.scm:
> >    222:29 19 (map1 (((guix utils)) ((guix store)) ((guix #) # (#)) …))
> >    222:29 18 (map1 (((guix store)) ((guix status) #:select (#)) (#) …))
> >    222:29 17 (map1 (((guix status) #:select (#)) ((guix grafts)) # …))
> >    222:29 16 (map1 (((guix grafts)) ((guix monads)) ((guix #)) (#) …))
> >    222:29 15 (map1 (((guix monads)) ((guix modules)) ((guix #)) (#) …))
> >    222:29 14 (map1 (((guix modules)) ((guix packages)) ((guix #)) # …))
> >    222:29 13 (map1 (((guix packages)) ((guix profiles)) ((guix #)) …))
> >    222:29 12 (map1 (((guix profiles)) ((guix describe)) ((guix #)) …))
> >    222:29 11 (map1 (((guix describe)) ((guix derivations)) ((# #)) …))
> >    222:29 10 (map1 (((guix derivations)) ((guix search-paths)) (#) …))
> >    222:29  9 (map1 (((guix search-paths)) ((guix build-system #)) # …))
> >    222:29  8 (map1 (((guix build-system gnu)) ((guix scripts #)) # …))
> >    222:29  7 (map1 (((guix scripts build)) ((guix self) #:select …) …))
> >    222:29  6 (map1 (((guix self) #:select (make-config.scm)) ((…)) …))
> >    222:29  5 (map1 (((gnu packages)) ((gnu packages bootstrap)) (…) …))
> >    222:29  4 (map1 (((gnu packages bootstrap)) ((gnu packages …) …) …))
> >    222:17  3 (map1 (((gnu packages compression) #:hide (zip)) ((…)) …))
> >   2830:10  2 (resolve-interface (gnu packages compression) #:select _ …)
> >    260:13  1 (for-each #<procedure 52470e0 at ice-9/boot-9.scm:2830…> …)
> > In unknown file:
> >            0 (scm-error misc-error #f "~A" ("no binding `zip' to h…") …)
> >
> > ERROR: In procedure scm-error:
> > no binding `zip' to hide in module (gnu packages compression)
> 
> You cannot use #:hide on (gnu packages …) modules, for unfortunate and
> obscure reasons.  The trick would be to hide the other ‘zip’ binding,
> the one from (srfi srfi-1).
> 

I did not #:hide anything.  The error is reported when (or after?) a
call to “make” loads guix/scripts/pack.scm (which I have not changed)
after putting the packages and required modules into libusb.scm
instead of usb-modeswitch.scm.




> > Should I also make the usb-modeswitch-data package install the license
> > file of usb-modeswitch-data?
> >
> > Or should I use gnu-build-system instead of trivial-build-system?
> > trivial works now though.
> 
> In general we should install license files.  If ‘trivial’ works for you,
> that’s OK; an additional line to install the license would be welcome,
> but not blocking.
> 

I add the license file.



> > The file dispatcher.c of usb-modeswitch is licensed bsd-2 and not
> > gpl2+.  Should I list both licenses or just gpl2+?
> 
> I think it’s enough to mark it as ‘gpl2+’ because, IIUC, the combination
> of all this is GPLv2+.  If you think that needs clarification, you can
> just add a comment about the ‘license’ field.
>

Since nobody is likely to use the USB_ModeSwitch dispatcher.c without
USB_ModeSwitch, I tend to leave it at gpl2+.




> > Currently I install the usb_modeswitch_dispatcher that is needed by
> > the udev rule in a separate output called “dispatcher”.  I am unsure
> > if this usb_modeswitch_dispatcher would need the usb_modeswitch
> > program from the “out” output.  Is it OK when one output only works
> > when the “out” output is installed too?
> 
> I’d say no.  :-)  In general, we want “guix install foo:bar” to provide
> something that Just Works.
>

I will try substitute*ing the dispatcher script to use /gnu/store
until it just works.




> Let me know if you want to send an updated patch if you we should
> proceed with the one you sent.
>

I will send an updated patch tomorrow with a working ”dispatcher“
output.

Regards,
Florian




Information forwarded to bug-guix <at> gnu.org:
bug#35640; Package guix. (Sat, 25 May 2019 11:20:02 GMT) Full text and rfc822 format available.

Message #74 received at 35640 <at> debbugs.gnu.org (full text, mbox):

From: "pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 35640 <at> debbugs.gnu.org
Subject: Re: bug#35640: Make USB modems just work on Guix
Date: Sat, 25 May 2019 13:18:56 +0200
[Message part 1 (text/plain, inline)]
On Fri, May 24, 2019 at 10:12:10PM +0200, pelzflorian (Florian Pelz) wrote:
> I will send an updated patch tomorrow with a working ”dispatcher“
> output.
> 

Please find attached a patch that no longer propagates
usb-modeswitch-data from usb-modeswitch.  I can now modeswitch my USB
modem by running

$ ./pre-inst-env guix install usb-modeswitch:dispatcher
$ lsmod -v #find bus name and device name of modem
[…]
Bus 001 Device 007: ID 12d1:14fe Huawei Technologies Co., Ltd. Modem (Mass Storage Mode)
$ for d in /sys/bus/usb/devices/*/; do echo $d; cat $d/busnum; cat $d/devnum; done
[…]
/sys/bus/usb/devices/1-1/
1
7
[…]
$ sudo usb_modeswitch_dispatcher --switch-mode 1-1 --config-file ~/.guix-profile/etc/usb_modeswitch.conf


I added the --config-file option since by default
usb_modeswitch_dispatcher loads its optional config file from /etc and
a future Guix service type for USB_ModeSwitch should be able to pass a
config file.


The udev rules file in usb-modeswitch-data has lines like:

ATTR{idVendor}=="03f0", ATTR{idProduct}=="002a", RUN+="usb_modeswitch '/%k'"

Maybe I should substitute these by

RUN+="/gnu/store/…-usb-modeswich-2.5.2/usb_modeswitch '/%k'"

but this would introduce a cyclic dependency between usb-modeswitch
and usb-modeswitch-data.  Therefore this rules file should rather be
fixed in a future USB_ModeSwitch service type.

Regards,
Florian
[0001-gnu-Add-USB_ModeSwitch.patch (text/plain, attachment)]

Information forwarded to bug-guix <at> gnu.org:
bug#35640; Package guix. (Sat, 25 May 2019 12:45:02 GMT) Full text and rfc822 format available.

Message #77 received at 35640 <at> debbugs.gnu.org (full text, mbox):

From: "pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 35640 <at> debbugs.gnu.org
Subject: Re: bug#35640: Make USB modems just work on Guix
Date: Sat, 25 May 2019 14:43:58 +0200
On Sat, May 25, 2019 at 01:18:56PM +0200, pelzflorian (Florian Pelz) wrote:
> I added the --config-file option since by default
> usb_modeswitch_dispatcher loads its optional config file from /etc and
> a future Guix service type for USB_ModeSwitch should be able to pass a
> config file.
> […]
> +                 (substitute* "usb_modeswitch_dispatcher"
> +                   (("!/usr/bin/tclsh")
> +                    (string-append "!" jimtcl "/bin/jimsh"))
> +                   (("/usr/sbin") bin)
> +                   (("/usr/share/usb_modeswitch")
> +                    (string-append data "/share/usb_modeswitch.d"))
> +                   (("\\[ParseGlobalConfig\\]") ;use config in command line
> +                    "[ParseGlobalConfig $argv]")
> +                   (("proc \\{ParseGlobalConfig\\} \\{\\}")
> +                    "proc {ParseGlobalConfig} {argv}")
> +                   (("set configFile \\\"\\\"")
> +                    "
> +if {[lindex $argv 2] == \"--config-file\"} {
> +        set configFile [lindex $argv 3]
> +}"))


Or should I rather use a patch file instead of substitute*?




Information forwarded to bug-guix <at> gnu.org:
bug#35640; Package guix. (Sat, 25 May 2019 17:45:01 GMT) Full text and rfc822 format available.

Message #80 received at 35640 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: "pelzflorian \(Florian Pelz\)" <pelzflorian <at> pelzflorian.de>
Cc: 35640 <at> debbugs.gnu.org
Subject: Re: bug#35640: Make USB modems just work on Guix
Date: Sat, 25 May 2019 19:44:37 +0200
Hello,

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

> Please find attached a patch that no longer propagates
> usb-modeswitch-data from usb-modeswitch.  I can now modeswitch my USB
> modem by running

Yay!

> The udev rules file in usb-modeswitch-data has lines like:
>
> ATTR{idVendor}=="03f0", ATTR{idProduct}=="002a", RUN+="usb_modeswitch '/%k'"
>
> Maybe I should substitute these by
>
> RUN+="/gnu/store/…-usb-modeswich-2.5.2/usb_modeswitch '/%k'"
>
> but this would introduce a cyclic dependency between usb-modeswitch
> and usb-modeswitch-data.  Therefore this rules file should rather be
> fixed in a future USB_ModeSwitch service type.

Sounds good.  Another option would be to install the udev rule as part
of the ‘usb-modeswitch’ package, which makes more sense and would solve
the problem.  But anyway, don’t lose your hair over it.

>> +                 (substitute* "usb_modeswitch_dispatcher"
>> +                   (("!/usr/bin/tclsh")
>> +                    (string-append "!" jimtcl "/bin/jimsh"))

I don’t think it’s needed, is it?

>> +                   (("/usr/sbin") bin)
>> +                   (("/usr/share/usb_modeswitch")
>> +                    (string-append data "/share/usb_modeswitch.d"))
>> +                   (("\\[ParseGlobalConfig\\]") ;use config in command line
>> +                    "[ParseGlobalConfig $argv]")
>> +                   (("proc \\{ParseGlobalConfig\\} \\{\\}")
>> +                    "proc {ParseGlobalConfig} {argv}")
>> +                   (("set configFile \\\"\\\"")
>> +                    "
>> +if {[lindex $argv 2] == \"--config-file\"} {
>> +        set configFile [lindex $argv 3]
>> +}"))
>
>
> Or should I rather use a patch file instead of substitute*?

I think it’s OK like this.  It does mean Guix’s
‘usb_modeswitch_dispatcher’ has an option that upstream doesn’t provide.
It would be worth proposing it upstream.

Thanks!

Ludo’.




Information forwarded to bug-guix <at> gnu.org:
bug#35640; Package guix. (Sat, 25 May 2019 19:43:01 GMT) Full text and rfc822 format available.

Message #83 received at 35640 <at> debbugs.gnu.org (full text, mbox):

From: "pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 35640 <at> debbugs.gnu.org
Subject: Re: bug#35640: Make USB modems just work on Guix
Date: Sat, 25 May 2019 21:42:15 +0200
On Sat, May 25, 2019 at 07:44:37PM +0200, Ludovic Courtès wrote:
> "pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de> skribis:
> > The udev rules file in usb-modeswitch-data has lines like:
> >
> > ATTR{idVendor}=="03f0", ATTR{idProduct}=="002a", RUN+="usb_modeswitch '/%k'"
> >
> > Maybe I should substitute these by
> >
> > RUN+="/gnu/store/…-usb-modeswich-2.5.2/usb_modeswitch '/%k'"
> >
> > but this would introduce a cyclic dependency between usb-modeswitch
> > and usb-modeswitch-data.  Therefore this rules file should rather be
> > fixed in a future USB_ModeSwitch service type.
> 
> Sounds good.  Another option would be to install the udev rule as part
> of the ‘usb-modeswitch’ package, which makes more sense and would solve
> the problem.  But anyway, don’t lose your hair over it.
>

The udev rules file is shipped with usb-modeswitch-data, so I need to
install it from usb-modeswitch-data.



> >> +                 (substitute* "usb_modeswitch_dispatcher"
> >> +                   (("!/usr/bin/tclsh")
> >> +                    (string-append "!" jimtcl "/bin/jimsh"))
> 
> I don’t think it’s needed, is it?
> 

Frankly, I am not actually sure if usb_modeswitch_dispatcher is really
needed for the USB_ModeSwitch service type.  In much earlier (2010)
versions of USB_ModeSwitch
(<https://web.archive.org/web/20100921062014/http://draisberghof.de/usb_modeswitch/usb-modeswitch-data-20100826.tar.bz2>)
the UDEV rules file referred to usb_modeswitch_dispatcher.  It does
not do so anymore, instead it apparently uses usb_modeswitch directly.

I will ask in the USB_ModeSwitch forums tomorrow if the dispatcher is
needed.  I will also ask about an option for specifying the config
file.  usb_modeswitch has one, usb_modeswitch_dispatcher does not have
the option.

Regards,
Florian




Information forwarded to bug-guix <at> gnu.org:
bug#35640; Package guix. (Wed, 12 Jun 2019 10:37:01 GMT) Full text and rfc822 format available.

Message #86 received at 35640 <at> debbugs.gnu.org (full text, mbox):

From: "pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 35640 <at> debbugs.gnu.org
Subject: Re: bug#35640: Make USB modems just work on Guix
Date: Wed, 12 Jun 2019 12:36:47 +0200
[Message part 1 (text/plain, inline)]
Find attached patches that make USB modems just work, fixing this bug.

I have confirmed that at least on x86_64-linux

(service usb-modeswitch-service-type)

works with the default config and that

(service usb-modeswitch-service-type
         (usb-modeswitch-configuration
                              (config-file #f)))

works, passing no config file, leading to different defaults.  Manual
use as described in a comment of the usb-modeswitch package works as
well.


I hope using putenv before wrap-program is OK.  I tried using
computed-file #:options instead, but could not get it to work.

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::).


On Sat, May 25, 2019 at 09:42:15PM +0200, pelzflorian (Florian Pelz) wrote:
> Frankly, I am not actually sure if usb_modeswitch_dispatcher is really
> needed for the USB_ModeSwitch service type.

I am sure, it is needed.


> In much earlier (2010)
> versions of USB_ModeSwitch
> (<https://web.archive.org/web/20100921062014/http://draisberghof.de/usb_modeswitch/usb-modeswitch-data-20100826.tar.bz2>)
> the UDEV rules file referred to usb_modeswitch_dispatcher.  It does
> not do so anymore, instead it apparently uses usb_modeswitch directly.
>

There are two different executable files called usb_modeswitch.  The
one used by the UDEV rule runs the dispatcher.


> I will ask in the USB_ModeSwitch forums tomorrow if the dispatcher is
> needed.  I will also ask about an option for specifying the config
> file.  usb_modeswitch has one, usb_modeswitch_dispatcher does not have
> the option.
>

I have not asked.  I will propose the patch after this is commited at
Guix.

Regards,
Florian
[0001-gnu-Add-USB_ModeSwitch.patch (text/plain, attachment)]
[0002-Add-usb-modeswitch-service-type.patch (text/plain, attachment)]
[0003-services-Include-USB_ModeSwitch-in-desktop-services.patch (text/plain, attachment)]

Information forwarded to bug-guix <at> gnu.org:
bug#35640; Package guix. (Wed, 12 Jun 2019 10:42:02 GMT) Full text and rfc822 format available.

Message #89 received at 35640 <at> debbugs.gnu.org (full text, mbox):

From: "pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 35640 <at> debbugs.gnu.org
Subject: Re: bug#35640: Make USB modems just work on Guix
Date: Wed, 12 Jun 2019 12:41:14 +0200
On Wed, Jun 12, 2019 at 12:36:47PM +0200, pelzflorian (Florian Pelz) wrote:
> Find attached patches that make USB modems just work, fixing this bug.
> 

I forgot to ask: The USB_ModeSwitch website says:

If you are a system integrator (package maintainer) you can use this
XML file to check for new releases: usb-modeswitch-versions.xml
<http://www.draisberghof.de/usb_modeswitch/usb-modeswitch-versions.xml>.

Is it possible to add a hash of this URL to the usb-modeswitch and
usb-modeswitch-data packages so that guix refresh notifies us of new
releases?




Information forwarded to bug-guix <at> gnu.org:
bug#35640; Package guix. (Wed, 12 Jun 2019 12:14:01 GMT) Full text and rfc822 format available.

Message #92 received at 35640 <at> debbugs.gnu.org (full text, mbox):

From: "pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 35640 <at> debbugs.gnu.org
Subject: Re: bug#35640: Make USB modems just work on Guix
Date: Wed, 12 Jun 2019 14:13:12 +0200
[Message part 1 (text/plain, inline)]
On Sat, May 25, 2019 at 07:44:37PM +0200, Ludovic Courtès wrote:
> >> +                 (substitute* "usb_modeswitch_dispatcher"
> >> +                   (("!/usr/bin/tclsh")
> >> +                    (string-append "!" jimtcl "/bin/jimsh"))
> 
> I don’t think it’s needed, is it?
> 

I see now, you mean the exclamation mark?  It is not needed.  Sorry.

Attached is the same patch without exclamation mark.

Regards,
Florian
[0001-gnu-Add-USB_ModeSwitch.patch (text/plain, attachment)]

Information forwarded to bug-guix <at> gnu.org:
bug#35640; Package guix. (Wed, 12 Jun 2019 12:22:01 GMT) Full text and rfc822 format available.

Message #95 received at 35640 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: "pelzflorian \(Florian Pelz\)" <pelzflorian <at> pelzflorian.de>
Cc: 35640 <at> debbugs.gnu.org
Subject: Re: bug#35640: Make USB modems just work on Guix
Date: Wed, 12 Jun 2019 14:21:05 +0200
"pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de> skribis:

> On Sat, May 25, 2019 at 07:44:37PM +0200, Ludovic Courtès wrote:
>> >> +                 (substitute* "usb_modeswitch_dispatcher"
>> >> +                   (("!/usr/bin/tclsh")
>> >> +                    (string-append "!" jimtcl "/bin/jimsh"))
>> 
>> I don’t think it’s needed, is it?
>> 
>
> I see now, you mean the exclamation mark?  It is not needed.  Sorry.

I meant that the ‘patch-shebangs’ phase should take care of this, so you
can remove this substitution and save two lines.

Ludo’.




Information forwarded to bug-guix <at> gnu.org:
bug#35640; Package guix. (Wed, 12 Jun 2019 19:52:01 GMT) Full text and rfc822 format available.

Message #98 received at 35640 <at> debbugs.gnu.org (full text, mbox):

From: "pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 35640 <at> debbugs.gnu.org
Subject: Re: bug#35640: Make USB modems just work on Guix
Date: Wed, 12 Jun 2019 21:51:20 +0200
On Wed, Jun 12, 2019 at 02:21:05PM +0200, Ludovic Courtès wrote:
> "pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de> skribis:
> > On Sat, May 25, 2019 at 07:44:37PM +0200, Ludovic Courtès wrote:
> >> >> +                 (substitute* "usb_modeswitch_dispatcher"
> >> >> +                   (("!/usr/bin/tclsh")
> >> >> +                    (string-append "!" jimtcl "/bin/jimsh"))
> […]
> I meant that the ‘patch-shebangs’ phase should take care of this, so you
> can remove this substitution and save two lines.
> 
> Ludo’.

It is needed.  Upstream USB_Modeswitch bundles jimtcl.  Its Makefile
uses jimsh0 from the bundled jimtcl, if possible, and replaces the
shebang using sed.  Therefore it seems right to use jimsh for Guix’
USB_ModeSwitch as well.

patch-shebang fails because the basename of #!/usr/bin/tclsh is not
jimsh.

patch-shebang: /gnu/store/24yzny7szv1fnmq6ci1x2ndyy7dzyigk-usb-modeswitch-2.5.2-dispatcher/bin/usb_modeswitch_dispatcher: warning: no binary for interpreter `tclsh' found in $PATH

Regards,
Florian




Information forwarded to bug-guix <at> gnu.org:
bug#35640; Package guix. (Wed, 12 Jun 2019 20:43:01 GMT) Full text and rfc822 format available.

Message #101 received at 35640 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: "pelzflorian \(Florian Pelz\)" <pelzflorian <at> pelzflorian.de>
Cc: 35640 <at> debbugs.gnu.org
Subject: Re: bug#35640: Make USB modems just work on Guix
Date: Wed, 12 Jun 2019 22:42:36 +0200
"pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de> skribis:

> On Wed, Jun 12, 2019 at 02:21:05PM +0200, Ludovic Courtès wrote:
>> "pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de> skribis:
>> > On Sat, May 25, 2019 at 07:44:37PM +0200, Ludovic Courtès wrote:
>> >> >> +                 (substitute* "usb_modeswitch_dispatcher"
>> >> >> +                   (("!/usr/bin/tclsh")
>> >> >> +                    (string-append "!" jimtcl "/bin/jimsh"))
>> […]
>> I meant that the ‘patch-shebangs’ phase should take care of this, so you
>> can remove this substitution and save two lines.
>> 
>> Ludo’.
>
> It is needed.  Upstream USB_Modeswitch bundles jimtcl.  Its Makefile
> uses jimsh0 from the bundled jimtcl, if possible, and replaces the
> shebang using sed.  Therefore it seems right to use jimsh for Guix’
> USB_ModeSwitch as well.
>
> patch-shebang fails because the basename of #!/usr/bin/tclsh is not
> jimsh.
>
> patch-shebang: /gnu/store/24yzny7szv1fnmq6ci1x2ndyy7dzyigk-usb-modeswitch-2.5.2-dispatcher/bin/usb_modeswitch_dispatcher: warning: no binary for interpreter `tclsh' found in $PATH

Oh got it, thanks for explaining.

Ludo’.




Information forwarded to bug-guix <at> gnu.org:
bug#35640; Package guix. (Wed, 12 Jun 2019 21:00:02 GMT) Full text and rfc822 format available.

Message #104 received at 35640 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: "pelzflorian \(Florian Pelz\)" <pelzflorian <at> pelzflorian.de>
Cc: 35640 <at> debbugs.gnu.org
Subject: Re: bug#35640: Make USB modems just work on Guix
Date: Wed, 12 Jun 2019 22:58:49 +0200
"pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de> skribis:

>>From 2a790dacdb818387325f7a2a895adde6bacabf8b Mon Sep 17 00:00:00 2001
> From: Florian Pelz <pelzflorian <at> pelzflorian.de>
> Date: Wed, 12 Jun 2019 14:05:44 +0200
> Subject: [PATCH 1/3] gnu: Add USB_ModeSwitch.
>
> * gnu/packages/usb-modeswitch.scm: New file.
> * gnu/packages/patches/usb-modeswitch-accept-config-arg.patch: New file.
> * gnu/local.mk (GNU_SYSTEM_MODULES): Add package.
>   (dist_patch_DATA): Add patch.

Applied, thanks!

Ludo'.




Information forwarded to bug-guix <at> gnu.org:
bug#35640; Package guix. (Wed, 12 Jun 2019 21:02:01 GMT) Full text and rfc822 format available.

Message #107 received at 35640 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: "pelzflorian \(Florian Pelz\)" <pelzflorian <at> pelzflorian.de>
Cc: 35640 <at> debbugs.gnu.org
Subject: Re: bug#35640: Make USB modems just work on Guix
Date: Wed, 12 Jun 2019 23:00:43 +0200
"pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de> skribis:

> On Wed, Jun 12, 2019 at 12:36:47PM +0200, pelzflorian (Florian Pelz) wrote:
>> Find attached patches that make USB modems just work, fixing this bug.
>> 
>
> I forgot to ask: The USB_ModeSwitch website says:
>
> If you are a system integrator (package maintainer) you can use this
> XML file to check for new releases: usb-modeswitch-versions.xml
> <http://www.draisberghof.de/usb_modeswitch/usb-modeswitch-versions.xml>.
>
> Is it possible to add a hash of this URL to the usb-modeswitch and
> usb-modeswitch-data packages so that guix refresh notifies us of new
> releases?

No, it’s not that simple.  You could write an “updater” (see (guix
upstream)) that specifically reads this file and reports the new version
specified in this file, but maybe it’s overkill to do that for a single
package.

Thanks,
Ludo’.




Information forwarded to bug-guix <at> gnu.org:
bug#35640; Package guix. (Wed, 12 Jun 2019 21:12:02 GMT) Full text and rfc822 format available.

Message #110 received at 35640 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: "pelzflorian \(Florian Pelz\)" <pelzflorian <at> pelzflorian.de>
Cc: 35640 <at> debbugs.gnu.org
Subject: Re: bug#35640: Make USB modems just work on Guix
Date: Wed, 12 Jun 2019 23:11:16 +0200
"pelzflorian (Florian Pelz)" <pelzflorian <at> 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 <at> 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 <at> 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’.




Information forwarded to bug-guix <at> gnu.org:
bug#35640; Package guix. (Thu, 13 Jun 2019 18:05:02 GMT) Full text and rfc822 format available.

Message #113 received at 35640 <at> debbugs.gnu.org (full text, mbox):

From: "pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 35640 <at> debbugs.gnu.org
Subject: Re: bug#35640: Make USB modems just work on Guix
Date: Thu, 13 Jun 2019 20:04:53 +0200
Find attached patches taking into account your suggestions.  (The
second patch is unchanged.)

On Wed, Jun 12, 2019 at 11:11:16PM +0200, Ludovic Courtès wrote:
> > +                  ;; wrap-program needs bash in PATH:
> > +                  (putenv (string-append "PATH=" #$bash "/bin"))
> 
> Why do you think so?  ‘wrap-program’ does not read $PATH, AFAICS.
> 

wrap-program uses (which "bash").  Without bash in the path, it
generates a wrong shebang “#!#f”.

Regards,
Florian




Information forwarded to bug-guix <at> gnu.org:
bug#35640; Package guix. (Thu, 13 Jun 2019 18:07:01 GMT) Full text and rfc822 format available.

Message #116 received at 35640 <at> debbugs.gnu.org (full text, mbox):

From: "pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 35640 <at> debbugs.gnu.org
Subject: Re: bug#35640: Make USB modems just work on Guix
Date: Thu, 13 Jun 2019 20:05:52 +0200
[Message part 1 (text/plain, inline)]
On Thu, Jun 13, 2019 at 08:04:52PM +0200, pelzflorian (Florian Pelz) wrote:
> Find attached patches taking into account your suggestions.  (The
> second patch is unchanged.)
> 

Forgot attachment.  Sorry.
[0001-Add-usb-modeswitch-service-type.patch (text/plain, attachment)]
[0002-services-Include-USB_ModeSwitch-in-desktop-services.patch (text/plain, attachment)]

Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Sat, 15 Jun 2019 16:40:02 GMT) Full text and rfc822 format available.

Notification sent to "pelzflorian (Florian Pelz)" <pelzflorian <at> pelzflorian.de>:
bug acknowledged by developer. (Sat, 15 Jun 2019 16:40:02 GMT) Full text and rfc822 format available.

Message #121 received at 35640-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: "pelzflorian \(Florian Pelz\)" <pelzflorian <at> pelzflorian.de>
Cc: 35640-done <at> debbugs.gnu.org
Subject: Re: bug#35640: Make USB modems just work on Guix
Date: Sat, 15 Jun 2019 18:39:22 +0200
Hello!

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

> From 27aff97683537407c178ea2b664069def0cf141a Mon Sep 17 00:00:00 2001
> From: Florian Pelz <pelzflorian <at> pelzflorian.de>
> Date: Thu, 13 Jun 2019 19:17:05 +0200
> Subject: [PATCH 1/2] Add usb-modeswitch-service-type.
>
> * gnu/services/networking.scm (usb-modeswitch-service-type): New variable.
> (usb-modeswitch-configuration): New variable.
> (usb-modeswitch-sh): New procedure.
> (usb-modeswitch-configuration->udev-rules): New procedure.
> * doc/guix.texi (Networking Services): Document it.

[...]

> From f4a5103b365f8bc5d2c514dad2e40f3c9981cfc2 Mon Sep 17 00:00:00 2001
> From: Florian Pelz <pelzflorian <at> pelzflorian.de>
> Date: Wed, 12 Jun 2019 11:16:57 +0200
> Subject: [PATCH 2/2] 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.

Pushed, thank you!

Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 14 Jul 2019 11:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 286 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.