From mboxrd@z Thu Jan 1 00:00:00 1970 From: "pelzflorian (Florian Pelz)" Subject: bug#35640: Make USB modems just work on Guix Date: Mon, 13 May 2019 22:57:20 +0200 Message-ID: <20190513205720.k2bruoaa5zpdslhu@pelzflorian.localdomain> References: <20190508182607.wcjfxkoqwcvzrdmt@pelzflorian.localdomain> <87v9yjd51k.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="6ot6xifyb7bxqd57" Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([209.51.188.92]:46284) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQI1M-0005Ov-M2 for bug-guix@gnu.org; Mon, 13 May 2019 16:58:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hQI1K-0005Li-TY for bug-guix@gnu.org; Mon, 13 May 2019 16:58:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:32944) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hQI1K-0005LV-KR for bug-guix@gnu.org; Mon, 13 May 2019 16:58:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hQI1K-0000rT-GO for bug-guix@gnu.org; Mon, 13 May 2019 16:58:02 -0400 Sender: "Debbugs-submit" Resent-Message-ID: Content-Disposition: inline In-Reply-To: <87v9yjd51k.fsf@gnu.org> List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: "bug-Guix" To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 35640@debbugs.gnu.org --6ot6xifyb7bxqd57 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit 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 --6ot6xifyb7bxqd57 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="0001-services-Include-ModemManager-in-desktop-services.patch" >From 827d931eb6b72572f547c87e650780cf50e9e20c Mon Sep 17 00:00:00 2001 From: Florian Pelz 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 --6ot6xifyb7bxqd57 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: attachment; filename="0001-Add-USB_ModeSwitch.patch" Content-Transfer-Encoding: 8bit >From 8861177166d74b84c0ac18bf102802cc1e6cf5d3 Mon Sep 17 00:00:00 2001 From: Florian Pelz 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 ;;; Copyright © 2018 Tobias Geerinckx-Rice ;;; Copyright © 2018 Vagrant Cascadian +;;; Copyright © 2019 Florian Pelz ;;; ;;; This file is part of GNU Guix. ;;; @@ -25,6 +26,7 @@ ;;; along with GNU Guix. If not, see . (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 --6ot6xifyb7bxqd57--