unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: "pelzflorian (Florian Pelz)" <pelzflorian@pelzflorian.de>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: 35640@debbugs.gnu.org
Subject: bug#35640: Make USB modems just work on Guix
Date: Mon, 13 May 2019 22:57:20 +0200	[thread overview]
Message-ID: <20190513205720.k2bruoaa5zpdslhu@pelzflorian.localdomain> (raw)
In-Reply-To: <87v9yjd51k.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 694 bytes --]

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

[-- Attachment #2: 0001-services-Include-ModemManager-in-desktop-services.patch --]
[-- Type: text/plain, Size: 877 bytes --]

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(+)

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


[-- Attachment #3: 0001-Add-USB_ModeSwitch.patch --]
[-- Type: text/plain, Size: 5752 bytes --]

From 8861177166d74b84c0ac18bf102802cc1e6cf5d3 Mon Sep 17 00:00:00 2001
From: Florian Pelz <pelzflorian@pelzflorian.de>
Date: Mon, 13 May 2019 22:35:00 +0200
Subject: [PATCH] Add USB_ModeSwitch.

* gnu/packages/libusb.scm (usb-modeswitch-data) Add it.
(usb-modeswitch) Add it.
---
 gnu/packages/libusb.scm | 91 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 91 insertions(+)

diff --git a/gnu/packages/libusb.scm b/gnu/packages/libusb.scm
index 5ef62e47fb..00577bb333 100644
--- a/gnu/packages/libusb.scm
+++ b/gnu/packages/libusb.scm
@@ -8,6 +8,7 @@
 ;;; Copyright © 2017 Jonathan Brielmaier <jonathan.brielmaier@web.de>
 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2018 Vagrant Cascadian <vagrant@debian.org>
+;;; Copyright © 2019 Florian Pelz <pelzflorian@pelzflorian.de>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -25,6 +26,7 @@
 ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
 
 (define-module (gnu packages libusb)
+  #:use-module (system repl debug)
   #:use-module (gnu packages)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix packages)
@@ -36,6 +38,7 @@
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system glib-or-gtk)
   #:use-module (guix build-system python)
+  #:use-module (guix build-system trivial)
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages gnupg)
   #:use-module (gnu packages gtk)
@@ -45,8 +48,12 @@
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages python)
   #:use-module (gnu packages python-xyz)
+  #:use-module ((gnu packages tcl) #:prefix tcl:)
+  #:use-module (system foreign)
+  #:use-module (rnrs bytevectors)
   #:use-module (gnu packages tls)
   #:use-module (gnu packages xiph))
+(terminal-width 1000000)
 
 (define-public libusb
   (package
@@ -601,3 +608,87 @@ HID-Class devices.")
 
 (define-public python2-hidapi
   (package-with-python2 python-hidapi))
+
+(define-public usb-modeswitch-data
+  (package
+    (name "usb-modeswitch-data")
+    (version "20170806")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append
+                    "http://www.draisberghof.de/usb_modeswitch/"
+                    "usb-modeswitch-data-" version ".tar.bz2"))
+              (sha256
+               (base32
+                "0b1wari3aza6qjggqd0hk2zsh93k1q8scgmwh6f8wr0flpr3whff"))))
+    (build-system trivial-build-system)
+    (arguments
+     `(#:modules ((guix build utils))
+       #:builder
+       (begin
+         (let ((share-dir (string-append %output "/share")))
+           (install-file
+            (string-append (assoc-ref %build-inputs "source")
+                           "/usb_modeswitch.d")
+            share-dir))
+         #t)))
+    (home-page "http://www.draisberghof.de/usb_modeswitch/")
+    (synopsis "Data package for USB_ModeSwitch")
+    (description "Device data collection and UDEV rules file for
+USB_ModeSwitch.")
+    (license license:gpl2+)))
+
+(define-public usb-modeswitch
+  (package
+    (name "usb-modeswitch")
+    (version "2.5.2")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append
+                    "http://www.draisberghof.de/usb_modeswitch/"
+                    "usb-modeswitch-" version ".tar.bz2"))
+              (sha256
+               (base32
+                "19ifi80g9ns5dmspchjvfj4ykxssq9yrci8m227dgb3yr04srzxb"))))
+    (native-inputs
+     `(("pkg-config" ,pkg-config)))
+    (inputs `(("libusb" ,libusb)
+              ("tcl" ,(error tcl:tcl))))
+    (propagated-inputs `(("usb-modeswitch-data" ,usb-modeswitch-data)))
+    (outputs '("out" "dispatcher"))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:tests? #f                    ; does not support `make check`
+       #:make-flags (list "CC=gcc")
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure)          ; no configure script
+         (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"))
+                    (man1 (string-append out "/share/man/man1"))
+                    (dispatcher-out (assoc-ref %outputs "dispatcher"))
+                    (etc (string-append dispatcher-out "/etc"))
+                    (dispatcher-bin (string-append dispatcher-out "/bin")))
+               (begin
+                 (install-file "usb_modeswitch" bin)
+                 (install-file "usb_modeswitch.1" man1)
+                 (install-file "usb_modeswitch.conf" etc)
+                 (rename-file "usb_modeswitch.tcl" "usb_modeswitch_dispatcher")
+                 (substitute* "usb_modeswitch_dispatcher"
+                   (("!/usr/bin/tclsh")
+                     (string-append (assoc-ref %build-inputs "tcl")
+                                    "/bin/tclsh")))
+                 (install-file "usb_modeswitch_dispatcher"
+                               dispatcher-bin))))))))
+    (home-page "http://www.draisberghof.de/usb_modeswitch/")
+    (synopsis "Mode switching tool for controlling 'multi-mode' USB devices")
+    (description "USB_ModeSwitch is a mode switching tool for controlling USB
+devices with multiple \"modes\".  When plugged in for the first time many USB
+devices (primarily high-speed WAN modems) act like a flash storage containing
+installers for Windows drivers.  USB_ModeSwitch replays the sequence the
+Windows drivers would send to switch their mode from storage to modem (or
+whatever the thing is supposed to do).")
+    (license license:gpl2+)))
-- 
2.21.0


  reply	other threads:[~2019-05-13 20:58 UTC|newest]

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

Reply instructions:

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

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

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

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

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

  git send-email \
    --in-reply-to=20190513205720.k2bruoaa5zpdslhu@pelzflorian.localdomain \
    --to=pelzflorian@pelzflorian.de \
    --cc=35640@debbugs.gnu.org \
    --cc=ludo@gnu.org \
    /path/to/YOUR_REPLY

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

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).