Make USB modems just work on Guix

  • Done
  • quality assurance status badge
Details
3 participants
  • Danny Milosavljevic
  • Ludovic Courtès
  • pelzflorian (Florian Pelz)
Owner
unassigned
Submitted by
pelzflorian (Florian Pelz)
Severity
normal
P
P
pelzflorian (Florian Pelz) wrote on 8 May 2019 20:26
(address . bug-guix@gnu.org)
20190508182607.wcjfxkoqwcvzrdmt@pelzflorian.localdomain
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
From 5e9b45fe785dee52da2a67fbecbabc4741f85e54 Mon Sep 17 00:00:00 2001
From: Florian Pelz <pelzflorian@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(+)

Toggle diff (16 lines)
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
(service wpa-supplicant-service-type) ;needed by NetworkManager
(service avahi-service-type)
(udisks-service)
--
2.21.0
From d489f805599ea63e2e06727a3201572ee0480a60 Mon Sep 17 00:00:00 2001
From: Florian Pelz <pelzflorian@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.
---
gnu/packages/gnome.scm | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)

Toggle diff (32 lines)
diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
index 7c40a39f01..a3765007bf 100644
--- a/gnu/packages/gnome.scm
+++ b/gnu/packages/gnome.scm
@@ -5511,10 +5511,12 @@ to virtual private networks (VPNs) via OpenVPN.")
;; libnm-gtk.pc refers to all these.
`(("dbus-glib" ,dbus-glib)
("gtk+" ,gtk+)
+ ("iso-codes" ,iso-codes) ;mobile broadband country selection
+ ("mobile-broadband-provider-info"
+ ,mobile-broadband-provider-info) ;mobile broadband provider selection
("network-manager" ,network-manager)))
(inputs
- `(("iso-codes" ,iso-codes)
- ("libgudev" ,libgudev)
+ `(("libgudev" ,libgudev)
("libnotify" ,libnotify)
("libsecret" ,libsecret)
("libselinux" ,libselinux)
@@ -5895,6 +5897,10 @@ devices using the GNOME desktop.")
("smbclient" ,samba)
("tzdata" ,tzdata)
("upower" ,upower)))
+ (propagated-inputs
+ `(("iso-codes" ,iso-codes) ;mobile broadband country selection
+ ("mobile-broadband-provider-info"
+ ,mobile-broadband-provider-info))) ;mobile broadband provider selection
(synopsis "Utilities to configure the GNOME desktop")
(home-page "https://www.gnome.org/")
(description
--
2.21.0
P
P
pelzflorian (Florian Pelz) wrote on 9 May 2019 07:31
(address . 35640@debbugs.gnu.org)
20190509053158.cbp3i6q4qvmjs64o@pelzflorian.localdomain
On Wed, May 08, 2019 at 08:26:07PM +0200, pelzflorian (Florian Pelz) wrote:
Toggle quote (7 lines)
> 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.


Toggle quote (6 lines)
> 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?


Toggle quote (3 lines)
> 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
D
D
Danny Milosavljevic wrote on 9 May 2019 14:55
(name . pelzflorian (Florian Pelz))(address . pelzflorian@pelzflorian.de)(address . 35640@debbugs.gnu.org)
20190509145504.41cf8efc@scratchpost.org
I think back then we thought it would be too big for the installation medium.
How big is it after that?
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCAAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAlzUIygACgkQ5xo1VCww
uqUBaAgAlhvcN07b2+px8LR49pPnlYWVAw/C9VkDAFVxCqL3MK3c/3Zfkgki0daD
zplR9EnVJ6HQ35RgSJxDkjtaHsZNji4xEt2ZnEETVxKOSUozcjWsaXqTYM71Cjct
4RmXYrsr9BjZNYjTGVZUG91ECkUWt51thSNLqauLSouzsE9XPUBsDWeFXpzdpXqC
Ab/+xJqAIfvquwY0pa5DIdWpYyF+hhYEIrltqahWuMqW6ZQZRDFQTrB2/uNR530q
oTUU1gm86sxRO09oRinqyuN+uVOvkhLWE2Z5m/kOMJTVEERdROzBOMDPQaK1cXbf
ZYhMuDDKNv43QaI6B8jqIe2TK5eXQg==
=Iw46
-----END PGP SIGNATURE-----


P
P
pelzflorian (Florian Pelz) wrote on 9 May 2019 15:07
(name . Danny Milosavljevic)(address . dannym@scratchpost.org)(address . 35640@debbugs.gnu.org)
20190509130712.7dyymud4ndtdsg6v@pelzflorian.localdomain
On Thu, May 09, 2019 at 02:55:04PM +0200, Danny Milosavljevic wrote:
Toggle quote (4 lines)
> 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
P
P
pelzflorian (Florian Pelz) wrote on 9 May 2019 15:43
(name . Danny Milosavljevic)(address . dannym@scratchpost.org)(address . 35640@debbugs.gnu.org)
20190509134356.y7kodjqndlnfx7am@pelzflorian.localdomain
OBOn Thu, May 09, 2019 at 03:07:12PM +0200, pelzflorian (Florian Pelz) wrote:
Toggle quote (9 lines)
> 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
L
L
Ludovic Courtès wrote on 9 May 2019 17:24
(name . pelzflorian (Florian Pelz))(address . pelzflorian@pelzflorian.de)(address . 35640@debbugs.gnu.org)
87v9yjd51k.fsf@gnu.org
Hi Florian,

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

Toggle quote (22 lines)
>>From 5e9b45fe785dee52da2a67fbecbabc4741f85e54 Mon Sep 17 00:00:00 2001
> From: Florian Pelz <pelzflorian@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:

Toggle snippet (6 lines)
$ guix size network-manager | tail -1
total: 534.9 MiB
$ guix size network-manager modem-manager | tail -1
total: 534.9 MiB

Toggle quote (10 lines)
>>From d489f805599ea63e2e06727a3201572ee0480a60 Mon Sep 17 00:00:00 2001
> From: Florian Pelz <pelzflorian@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’.
P
P
pelzflorian (Florian Pelz) wrote on 13 May 2019 22:57
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 35640@debbugs.gnu.org)
20190513205720.k2bruoaa5zpdslhu@pelzflorian.localdomain
On Thu, May 09, 2019 at 05:24:39PM +0200, Ludovic Courtès wrote:
Toggle quote (3 lines)
> 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.

Toggle quote (5 lines)
> 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
From 827d931eb6b72572f547c87e650780cf50e9e20c Mon Sep 17 00:00:00 2001
From: Florian Pelz <pelzflorian@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.
---
gnu/services/desktop.scm | 1 +
1 file changed, 1 insertion(+)

Toggle diff (14 lines)
diff --git a/gnu/services/desktop.scm b/gnu/services/desktop.scm
index 5e0bd102a2..ac714ca5e0 100644
--- a/gnu/services/desktop.scm
+++ b/gnu/services/desktop.scm
@@ -1062,6 +1062,7 @@ dispatches events from it.")))
;; The D-Bus clique.
(service network-manager-service-type)
+ (service modem-manager-service-type)
(service wpa-supplicant-service-type) ;needed by NetworkManager
(service avahi-service-type)
(udisks-service)
--
2.21.0
P
P
pelzflorian (Florian Pelz) wrote on 13 May 2019 23:04
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 35640@debbugs.gnu.org)
20190513210443.y2xs7fsvxwng3zjz@pelzflorian.localdomain
On Mon, May 13, 2019 at 10:57:20PM +0200, pelzflorian (Florian Pelz) wrote:
Toggle quote (8 lines)
> 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@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@2.5.2 gnu/packages/libusb.scm:642 174c8f0> #<package usb-modeswitch@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@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@2.5.2 gnu/packages/libusb.scm:642 174c8f0> _ _)
936:16 4 (cache! #<weak-table 178/223> #<package usb-modeswitch@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@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
P
P
pelzflorian (Florian Pelz) wrote on 14 May 2019 09:22
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 35640@debbugs.gnu.org)
20190514072238.qyh2jqlnhvwbb426@pelzflorian.localdomain
On Mon, May 13, 2019 at 11:04:43PM +0200, pelzflorian (Florian Pelz) wrote:
Toggle quote (4 lines)
> 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
D
D
Danny Milosavljevic wrote on 14 May 2019 10:35
(name . pelzflorian (Florian Pelz))(address . pelzflorian@pelzflorian.de)
20190514103555.1b2a6316@scratchpost.org
Hi Florian,

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

Toggle quote (8 lines)
> 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.

Toggle quote (10 lines)
> 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.
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCAAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAlzafesACgkQ5xo1VCww
uqU/nQf/ZMQLpCGA/PwGV0wXcbkdhVHJDBngI+j+e9Po090bp8xM7mOctmQpojW/
TUs4QN4iiMVn8FxPkay9yao6Ald9msxU5M66XeSdHOxHn6Vg8l6EjkMIimCclyWQ
cxqcUVs/fPzOf9ovwxercSzbm02kq08Q+WOLBcLeD5ZJXgq9yQnF8jS/Y6E5w8zC
yEjFOm/6xU8c9pZNVfgZeBoWEkF8d8P+WqxkcVvha5M5XnhgdnLVEH+hmzRKXs7m
g71asVofV2O6SfIqC3/bMWn2XFwTWsnaR/yxKv8Q1xfbq6u9McPqlZdoSG/OUQxd
xqQ1ly7hRX2D47w8DFtnwBU5lk7BPA==
=DCBn
-----END PGP SIGNATURE-----


L
L
Ludovic Courtès wrote on 14 May 2019 22:48
(name . pelzflorian (Florian Pelz))(address . pelzflorian@pelzflorian.de)(address . 35640@debbugs.gnu.org)
87d0kkyd7w.fsf@gnu.org
"pelzflorian (Florian Pelz)" <pelzflorian@pelzflorian.de> skribis:

Toggle quote (2 lines)
> + #: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’.
P
P
pelzflorian (Florian Pelz) wrote on 14 May 2019 22:56
(name . Danny Milosavljevic)(address . dannym@scratchpost.org)
20190514205648.nl4s4lwvc4t67gho@pelzflorian.localdomain
On Tue, May 14, 2019 at 10:35:55AM +0200, Danny Milosavljevic wrote:
Toggle quote (6 lines)
> Should be
>
> (inputs `(("libusb" ,libusb)
> ("tcl" ,tcl:tcl)))
>

Yes I did mean that with comma, sorry.

Toggle quote (6 lines)
> 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?


Toggle quote (2 lines)
> 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
P
P
pelzflorian (Florian Pelz) wrote on 15 May 2019 13:17
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 35640@debbugs.gnu.org)
20190515111743.eo3ayemhoygiphun@pelzflorian.localdomain
On Mon, May 13, 2019 at 10:57:20PM +0200, pelzflorian (Florian Pelz) wrote:
Toggle quote (7 lines)
> 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
From 061c976e38b8b332602e84ac74717384aab57d56 Mon Sep 17 00:00:00 2001
From: Florian Pelz <pelzflorian@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.
---
doc/guix.texi | 17 +++++++++--------
gnu/services/desktop.scm | 1 +
2 files changed, 10 insertions(+), 8 deletions(-)

Toggle diff (49 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index 3f50bf77fe..aa08832fae 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -59,7 +59,7 @@ Copyright @copyright{} 2018 Oleg Pykhalov@*
Copyright @copyright{} 2018 Mike Gerwitz@*
Copyright @copyright{} 2018 Pierre-Antoine Rouby@*
Copyright @copyright{} 2018 G�bor Boskovits@*
-Copyright @copyright{} 2018 Florian Pelz@*
+Copyright @copyright{} 2018, 2019 Florian Pelz@*
Copyright @copyright{} 2018 Laura Lazzati@*
Copyright @copyright{} 2018 Alex Vong@*
Copyright @copyright{} 2019 Josh Holland@*
@@ -14620,13 +14620,14 @@ adds or adjusts services for a typical ``desktop'' setup.
In particular, it adds a graphical login manager (@pxref{X Window,
@code{gdm-service-type}}), screen lockers, a network management tool
-(@pxref{Networking Services, @code{network-manager-service-type}}), energy and color
-management services, the @code{elogind} login and seat manager, the
-Polkit privilege service, the GeoClue location service, the
-AccountsService daemon that allows authorized users change system
-passwords, an NTP client (@pxref{Networking Services}), the Avahi
-daemon, and has the name service switch service configured to be able to
-use @code{nss-mdns} (@pxref{Name Service Switch, mDNS}).
+(@pxref{Networking Services, @code{network-manager-service-type}}) with modem
+support (@pxref{Networking Services, @code{modem-manager-service-type}}),
+energy and color management services, the @code{elogind} login and seat
+manager, the Polkit privilege service, the GeoClue location service, the
+AccountsService daemon that allows authorized users change system passwords,
+an NTP client (@pxref{Networking Services}), the Avahi daemon, and has the
+name service switch service configured to be able to use @code{nss-mdns}
+(@pxref{Name Service Switch, mDNS}).
@end defvr
The @var{%desktop-services} variable can be used as the @code{services}
diff --git a/gnu/services/desktop.scm b/gnu/services/desktop.scm
index 5e0bd102a2..ac714ca5e0 100644
--- a/gnu/services/desktop.scm
+++ b/gnu/services/desktop.scm
@@ -1062,6 +1062,7 @@ dispatches events from it.")))
;; The D-Bus clique.
(service network-manager-service-type)
+ (service modem-manager-service-type)
(service wpa-supplicant-service-type) ;needed by NetworkManager
(service avahi-service-type)
(udisks-service)
--
2.21.0
L
L
Ludovic Courtès wrote on 15 May 2019 14:51
(name . pelzflorian (Florian Pelz))(address . pelzflorian@pelzflorian.de)(address . 35640@debbugs.gnu.org)
87lfz7vq2f.fsf@gnu.org
"pelzflorian (Florian Pelz)" <pelzflorian@pelzflorian.de> skribis:

Toggle quote (8 lines)
> From 061c976e38b8b332602e84ac74717384aab57d56 Mon Sep 17 00:00:00 2001
> From: Florian Pelz <pelzflorian@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’.
L
L
Ludovic Courtès wrote on 15 May 2019 15:01
(name . pelzflorian (Florian Pelz))(address . pelzflorian@pelzflorian.de)
87ef4zvpm7.fsf@gnu.org
Hi,

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

Toggle quote (2 lines)
> On Tue, May 14, 2019 at 10:35:55AM +0200, Danny Milosavljevic wrote:

[...]

Toggle quote (8 lines)
>> 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))

Toggle quote (15 lines)
> 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.

Toggle quote (3 lines)
> "/usb_modeswitch.d") share-dir))
> #t)))

#t is unnecessary here.

Toggle quote (8 lines)
> From 3430070606904b6dc6b247a6b8bfb2ce7c4fce0f Mon Sep 17 00:00:00 2001
> From: Florian Pelz <pelzflorian@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.

Toggle quote (2 lines)
> +(define-module (gnu packages libusb)

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

Toggle quote (4 lines)
> + (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").

Toggle quote (2 lines)
> +;; (use-modules (guix build utils))

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

Toggle quote (6 lines)
> + (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")))
…))

Toggle quote (3 lines)
> + (install-file "usb_modeswitch_dispatcher"
> + dispatcher-bin))))))))

The phase must return #t.

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

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

Toggle quote (3 lines)
> + (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’.
P
P
pelzflorian (Florian Pelz) wrote on 15 May 2019 16:40
(name . Ludovic Courtès)(address . ludo@gnu.org)
20190515144010.pdsk4zv7fm4mprpv@pelzflorian.localdomain
On Wed, May 15, 2019 at 03:01:04PM +0200, Ludovic Courtès wrote:
Toggle quote (3 lines)
> Could you send an updated patch?
>

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


Toggle quote (4 lines)
> Is USB_ModeSwitch needed for proper use of ModemManager? I’d say “no”
> but I’m unsure.
>

Only on some modems.

Toggle quote (4 lines)
> Thanks for working on it!
>
> Ludo’.

:)

Regards,
Florian
P
P
pelzflorian (Florian Pelz) wrote on 16 May 2019 09:50
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 35640@debbugs.gnu.org)
20190516075018.htx3hi4vd5zswjpw@pelzflorian.localdomain
On Thu, May 09, 2019 at 05:24:39PM +0200, Ludovic Courtès wrote:
Toggle quote (15 lines)
> >>From d489f805599ea63e2e06727a3201572ee0480a60 Mon Sep 17 00:00:00 2001
> > From: Florian Pelz <pelzflorian@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
From 627e41c4741acd5b91771131a1646bb89b8c270b Mon Sep 17 00:00:00 2001
From: Florian Pelz <pelzflorian@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.
---
gnu/packages/gnome.scm | 22 ++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)

Toggle diff (49 lines)
diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
index 09984717cc..fc024ebf72 100644
--- a/gnu/packages/gnome.scm
+++ b/gnu/packages/gnome.scm
@@ -35,6 +35,7 @@
;;; Copyright � 2018, 2019 Timothy Sample <samplet@ngyro.com>
;;; Copyright � 2019 Danny Milosavljevic <dannym@scratchpost.org>
;;; Copyright � 2019 Marius Bakke <mbakke@fastmail.com>
+;;; Copyright � 2019 Florian Pelz <pelzflorian@pelzflorian.de>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -5502,7 +5503,23 @@ to virtual private networks (VPNs) via OpenVPN.")
(base32
"1js0i2kwfklahsn77qgxzdscy33drrlym3mrj1qhlw0zf8ri56ya"))))
(build-system glib-or-gtk-build-system)
- (arguments '(#:configure-flags '("--disable-migration")))
+ (arguments '(#:configure-flags '("--disable-migration")
+ #:phases
+ (modify-phases %standard-phases
+ (add-after 'unpack 'patch-source
+ (lambda* (#:key inputs #:allow-other-keys)
+ (let ((mbpi (assoc-ref inputs
+ "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)
+ (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)
+ (string-append start "\"" iso-codes
+ "/share\", " end)))))))))
(native-inputs
`(("intltool" ,intltool)
("gobject-introspection" ,gobject-introspection)
@@ -5519,7 +5536,8 @@ to virtual private networks (VPNs) via OpenVPN.")
("libsecret" ,libsecret)
("libselinux" ,libselinux)
("jansson" ,jansson) ; for team support
- ("modem-manager" ,modem-manager)))
+ ("modem-manager" ,modem-manager)
+ ("mobile-broadband-provider-info" ,mobile-broadband-provider-info)))
(synopsis "Applet for managing network connections")
(home-page "https://www.gnome.org/projects/NetworkManager/")
(description
--
2.21.0
P
P
pelzflorian (Florian Pelz) wrote on 16 May 2019 10:34
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 35640@debbugs.gnu.org)
20190516083446.i2xdzug5zcb3sndy@pelzflorian.localdomain
On Thu, May 16, 2019 at 09:50:18AM +0200, pelzflorian (Florian Pelz) wrote:
Toggle quote (9 lines)
> From 627e41c4741acd5b91771131a1646bb89b8c270b Mon Sep 17 00:00:00 2001
> From: Florian Pelz <pelzflorian@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
L
L
Ludovic Courtès wrote on 16 May 2019 13:30
(name . pelzflorian (Florian Pelz))(address . pelzflorian@pelzflorian.de)(address . 35640@debbugs.gnu.org)
87sgtehc1i.fsf@gnu.org
"pelzflorian (Florian Pelz)" <pelzflorian@pelzflorian.de> skribis:

Toggle quote (9 lines)
> From 627e41c4741acd5b91771131a1646bb89b8c270b Mon Sep 17 00:00:00 2001
> From: Florian Pelz <pelzflorian@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’.
Toggle diff (25 lines)
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)
P
P
pelzflorian (Florian Pelz) wrote on 22 May 2019 18:29
(name . Ludovic Courtès)(address . ludo@gnu.org)
20190522162909.tds5wz7lj6npkgy4@pelzflorian.localdomain
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
P
P
pelzflorian (Florian Pelz) wrote on 22 May 2019 19:58
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 35640@debbugs.gnu.org)
20190522175858.qsin6ybgpsemnarb@pelzflorian.localdomain
I forgot to mention gnu/local.mk in the commit message. Please use
this patch attached here instead.

Regards,
Florian
L
L
Ludovic Courtès wrote on 24 May 2019 17:37
(name . pelzflorian (Florian Pelz))(address . pelzflorian@pelzflorian.de)
87ef4nx3s2.fsf@gnu.org
Hello,

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

Toggle quote (34 lines)
> 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).

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

Yes.

Toggle quote (6 lines)
> 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.

Toggle quote (3 lines)
> 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.

Toggle quote (12 lines)
> 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!

Toggle quote (3 lines)
> Currently I also install the UDEV rule shipped with
> usb-modeswitch-data; I hope this is correct.

Yep.

Toggle quote (6 lines)
> 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.

Toggle quote (7 lines)
> 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’.
P
P
pelzflorian (Florian Pelz) wrote on 24 May 2019 22:12
(name . Ludovic Courtès)(address . ludo@gnu.org)
20190524201210.bzeyua7lv2mamf52@pelzflorian.localdomain
Thank you for your feedback!

On Fri, May 24, 2019 at 05:37:01PM +0200, Ludovic Courtès wrote:
Toggle quote (39 lines)
> > 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.




Toggle quote (11 lines)
> > 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.



Toggle quote (8 lines)
> > 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+.




Toggle quote (10 lines)
> > 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.




Toggle quote (4 lines)
> 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
P
P
pelzflorian (Florian Pelz) wrote on 25 May 2019 13:18
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 35640@debbugs.gnu.org)
20190525111856.jfu5ly2p6ynn3rdk@pelzflorian.localdomain
On Fri, May 24, 2019 at 10:12:10PM +0200, pelzflorian (Florian Pelz) wrote:
Toggle quote (4 lines)
> 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
P
P
pelzflorian (Florian Pelz) wrote on 25 May 2019 14:43
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 35640@debbugs.gnu.org)
20190525124358.bezpp7y4rqtuigs4@pelzflorian.localdomain
On Sat, May 25, 2019 at 01:18:56PM +0200, pelzflorian (Florian Pelz) wrote:
Toggle quote (22 lines)
> 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*?
L
L
Ludovic Courtès wrote on 25 May 2019 19:44
(name . pelzflorian (Florian Pelz))(address . pelzflorian@pelzflorian.de)(address . 35640@debbugs.gnu.org)
87lfyupgxm.fsf@gnu.org
Hello,

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

Toggle quote (4 lines)
> 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!

Toggle quote (12 lines)
> 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.

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

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

Toggle quote (16 lines)
>> + (("/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’.
P
P
pelzflorian (Florian Pelz) wrote on 25 May 2019 21:42
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 35640@debbugs.gnu.org)
20190525194215.egiyrax3f3k7nojp@pelzflorian.localdomain
On Sat, May 25, 2019 at 07:44:37PM +0200, Ludovic Courtès wrote:
Toggle quote (18 lines)
> "pelzflorian (Florian Pelz)" <pelzflorian@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.



Toggle quote (7 lines)
> >> + (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
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
P
P
pelzflorian (Florian Pelz) wrote on 12 Jun 2019 12:36
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 35640@debbugs.gnu.org)
20190612103646.yem2wtmw6w2vw7an@pelzflorian.localdomain
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:
Toggle quote (3 lines)
> 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.


Toggle quote (7 lines)
> 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.


Toggle quote (6 lines)
> 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
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.


* gnu/services/desktop.scm (%desktop-services): Add usb-modeswitch-service-type.
* doc/guix.texi (Networking Services): Document it.
---
doc/guix.texi | 3 +++
gnu/services/desktop.scm | 1 +
2 files changed, 4 insertions(+)

Toggle diff (28 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index 28e752a335..5c36abeb71 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -12668,6 +12668,9 @@ 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
plugged in.
+
+This service is part of @code{%desktop-services} (@pxref{Desktop
+Services}).
@end defvr
@deftp {Data Type} usb-modeswitch-configuration
diff --git a/gnu/services/desktop.scm b/gnu/services/desktop.scm
index 652f7b1b02..343d507c14 100644
--- a/gnu/services/desktop.scm
+++ b/gnu/services/desktop.scm
@@ -1067,6 +1067,7 @@ dispatches events from it.")))
profile-service-type
(list network-manager-applet))
(service modem-manager-service-type)
+ (service usb-modeswitch-service-type)
;; The D-Bus clique.
(service avahi-service-type)
--
2.21.0
P
P
pelzflorian (Florian Pelz) wrote on 12 Jun 2019 12:41
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 35640@debbugs.gnu.org)
20190612104114.aye2qfnla7bjatqm@pelzflorian.localdomain
On Wed, Jun 12, 2019 at 12:36:47PM +0200, pelzflorian (Florian Pelz) wrote:
Toggle quote (3 lines)
> 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

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?
P
P
pelzflorian (Florian Pelz) wrote on 12 Jun 2019 14:13
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 35640@debbugs.gnu.org)
20190612121312.hobngtkentkiavai@pelzflorian.localdomain
On Sat, May 25, 2019 at 07:44:37PM +0200, Ludovic Courtès wrote:
Toggle quote (7 lines)
> >> + (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
L
L
Ludovic Courtès wrote on 12 Jun 2019 14:21
(name . pelzflorian (Florian Pelz))(address . pelzflorian@pelzflorian.de)(address . 35640@debbugs.gnu.org)
874l4vxadq.fsf@gnu.org
"pelzflorian (Florian Pelz)" <pelzflorian@pelzflorian.de> skribis:

Toggle quote (10 lines)
> 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’.
P
P
pelzflorian (Florian Pelz) wrote on 12 Jun 2019 21:51
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 35640@debbugs.gnu.org)
20190612195120.bg7yuvjghf2d546f@pelzflorian.localdomain
On Wed, Jun 12, 2019 at 02:21:05PM +0200, Ludovic Courtès wrote:
Toggle quote (11 lines)
> "pelzflorian (Florian Pelz)" <pelzflorian@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
L
L
Ludovic Courtès wrote on 12 Jun 2019 22:42
(name . pelzflorian (Florian Pelz))(address . pelzflorian@pelzflorian.de)(address . 35640@debbugs.gnu.org)
87v9xasfgj.fsf@gnu.org
"pelzflorian (Florian Pelz)" <pelzflorian@pelzflorian.de> skribis:

Toggle quote (22 lines)
> On Wed, Jun 12, 2019 at 02:21:05PM +0200, Ludovic Courtès wrote:
>> "pelzflorian (Florian Pelz)" <pelzflorian@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’.
L
L
Ludovic Courtès wrote on 12 Jun 2019 22:58
(name . pelzflorian (Florian Pelz))(address . pelzflorian@pelzflorian.de)(address . 35640@debbugs.gnu.org)
87r27ysepi.fsf@gnu.org
"pelzflorian (Florian Pelz)" <pelzflorian@pelzflorian.de> skribis:

Toggle quote (10 lines)
>>From 2a790dacdb818387325f7a2a895adde6bacabf8b Mon Sep 17 00:00:00 2001
> From: Florian Pelz <pelzflorian@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'.
L
L
Ludovic Courtès wrote on 12 Jun 2019 23:00
(name . pelzflorian (Florian Pelz))(address . pelzflorian@pelzflorian.de)(address . 35640@debbugs.gnu.org)
87h88usemc.fsf@gnu.org
"pelzflorian (Florian Pelz)" <pelzflorian@pelzflorian.de> skribis:

Toggle quote (14 lines)
> 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’.
L
L
Ludovic Courtès wrote on 12 Jun 2019 23:11
(name . pelzflorian (Florian Pelz))(address . pelzflorian@pelzflorian.de)(address . 35640@debbugs.gnu.org)
87zhmmqzkb.fsf@gnu.org
"pelzflorian (Florian Pelz)" <pelzflorian@pelzflorian.de> skribis:

Toggle quote (7 lines)
> 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:

Toggle quote (10 lines)
>>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.

[...]

Toggle quote (5 lines)
> +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).

Toggle quote (12 lines)
> +(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.

Toggle quote (9 lines)
> + (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)
"")

Toggle quote (8 lines)
> + (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.

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

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

Toggle quote (10 lines)
>>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’.
P
P
pelzflorian (Florian Pelz) wrote on 13 Jun 2019 20:04
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 35640@debbugs.gnu.org)
20190613180452.yeytgript2vhnl5b@pelzflorian.localdomain
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:
Toggle quote (6 lines)
> > + ;; 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
P
P
pelzflorian (Florian Pelz) wrote on 13 Jun 2019 20:05
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 35640@debbugs.gnu.org)
20190613180552.ckiihg7p6imni5a3@pelzflorian.localdomain
On Thu, Jun 13, 2019 at 08:04:52PM +0200, pelzflorian (Florian Pelz) wrote:
Toggle quote (4 lines)
> Find attached patches taking into account your suggestions. (The
> second patch is unchanged.)
>

Forgot attachment. Sorry.
From f4a5103b365f8bc5d2c514dad2e40f3c9981cfc2 Mon Sep 17 00:00:00 2001
From: Florian Pelz <pelzflorian@pelzflorian.de>
Date: Wed, 12 Jun 2019 11:16:57 +0200
Subject: [PATCH 2/2] services: Include USB_ModeSwitch in %desktop-services.


* gnu/services/desktop.scm (%desktop-services): Add usb-modeswitch-service-type.
* doc/guix.texi (Networking Services): Document it.
---
doc/guix.texi | 3 +++
gnu/services/desktop.scm | 1 +
2 files changed, 4 insertions(+)

Toggle diff (28 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index c407d6257f..8b07693445 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -12681,6 +12681,9 @@ 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
plugged in.
+
+This service is part of @code{%desktop-services} (@pxref{Desktop
+Services}).
@end defvr
@deftp {Data Type} usb-modeswitch-configuration
diff --git a/gnu/services/desktop.scm b/gnu/services/desktop.scm
index 652f7b1b02..343d507c14 100644
--- a/gnu/services/desktop.scm
+++ b/gnu/services/desktop.scm
@@ -1067,6 +1067,7 @@ dispatches events from it.")))
profile-service-type
(list network-manager-applet))
(service modem-manager-service-type)
+ (service usb-modeswitch-service-type)
;; The D-Bus clique.
(service avahi-service-type)
--
2.21.0
L
L
Ludovic Courtès wrote on 15 Jun 2019 18:39
(name . pelzflorian (Florian Pelz))(address . pelzflorian@pelzflorian.de)(address . 35640-done@debbugs.gnu.org)
87h88qajlx.fsf@gnu.org
Hello!

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

Toggle quote (11 lines)
> From 27aff97683537407c178ea2b664069def0cf141a Mon Sep 17 00:00:00 2001
> From: Florian Pelz <pelzflorian@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.

[...]

Toggle quote (10 lines)
> From f4a5103b365f8bc5d2c514dad2e40f3c9981cfc2 Mon Sep 17 00:00:00 2001
> From: Florian Pelz <pelzflorian@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’.
Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 35640@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 35640
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch