aboutsummaryrefslogtreecommitdiff
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2019, 2020 Florian Pelz <pelzflorian@pelzflorian.de>
;;; Copyright © 2020 Tobias Geerinckx-Rice <me@tobias.gr>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (gnu packages usb-modeswitch)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (guix packages)
  #:use-module (guix download)
  #:use-module (guix build-system gnu)
  #:use-module (guix build-system trivial)
  #:use-module (guix utils)
  #:use-module (gnu packages)
  #:use-module (gnu packages base)
  #:use-module (gnu packages compression)
  #:use-module (gnu packages embedded)
  #:use-module (gnu packages libusb)
  #:use-module (gnu packages pkg-config))

(define-public usb-modeswitch-data
  (package
    (name "usb-modeswitch-data")
    (version "20191128")
    (source (origin
              (method url-fetch)
              (uri (string-append
                    "https://www.draisberghof.de/usb_modeswitch/"
                    "usb-modeswitch-data-" version ".tar.bz2"))
              (sha256
               (base32
                "1ygahl3r26r38ai8yyblq9nhf3v5i6n6r6672p5wf88wg5h9n0rz"))))
    (build-system trivial-build-system)
    (native-inputs (list tar bzip2))
    (arguments
     `(#:modules ((guix build utils))
       #:builder
       (begin
         (use-modules (guix build utils))
         (let* ((source (assoc-ref %build-inputs "source"))
                (tar (assoc-ref %build-inputs "tar"))
                (bzip2 (assoc-ref %build-inputs "bzip2"))
                (files (string-append "usb-modeswitch-data-"
                                      ,(package-version this-package)))
                (share-dir (string-append %output "/share"))
                (doc-dir (string-append share-dir "/doc/"))
                (license-dir (string-append doc-dir
                                            (strip-store-file-name %output)))
                (udev-dir (string-append %output "/udev")))
           (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")
           (copy-recursively (string-append files "/usb_modeswitch.d")
                             (string-append share-dir "/usb_modeswitch.d"))
           (install-file (string-append files "/40-usb_modeswitch.rules")
                         udev-dir)
           (install-file (string-append files "/COPYING") license-dir)))))
    (home-page "https://www.draisberghof.de/usb_modeswitch/")
    (synopsis "Data package for USB_ModeSwitch")
    (description "This package contains data about devices and a UDEV rules
file for use with USB_ModeSwitch.")
    (license license:gpl2+)))

(define-public usb-modeswitch
  (package
    (name "usb-modeswitch")
    (version "2.6.1")
    (source (origin
              (method url-fetch)
              (uri (string-append
                    "https://www.draisberghof.de/usb_modeswitch/"
                    "usb-modeswitch-" version ".tar.bz2"))
              (sha256
               (base32
                "0d7s8p92r36danjd15y1zaznf6rbk17kxyg9367nabz56vhxk5ai"))))
    (native-inputs (list pkg-config))
    (inputs (list libusb jimtcl usb-modeswitch-data))
    (outputs '("out" "dispatcher"))
    (build-system gnu-build-system)
    (arguments
     `(#:tests? #f                    ; does not support `make check`
       #:make-flags
       (list ,(string-append "CC=" (cc-for-target)))
       #:phases
       (modify-phases %standard-phases
         (delete 'configure)          ; no configure script
         (replace 'install
           (lambda* (#:key source outputs inputs #:allow-other-keys)
             (let* ((source (assoc-ref inputs "source"))
                    (jimtcl (assoc-ref inputs "jimtcl"))
                    (data (assoc-ref inputs "usb-modeswitch-data"))
                    (out (assoc-ref outputs "out"))
                    (bin (string-append out "/bin"))
                    (man1 (string-append out "/share/man/man1"))
                    (dispatcher-out (assoc-ref outputs "dispatcher"))
                    (udev (string-append dispatcher-out "/lib/udev"))
                    (etc (string-append dispatcher-out "/etc"))
                    (dispatcher-bin (string-append dispatcher-out "/bin"))
                    (dispatcher-man1 (string-append dispatcher-out
                                                    "/share/man/man1")))
               (begin
                 ;; Users can install the default output and
                 ;; usb-modeswitch-data and then modeswitch their USB device
                 ;; by running e.g.:
                 ;;
                 ;;   sudo usb_modeswitch -c \
                 ;;   ~/.guix-profile/share/usb_modeswitch.d/12d1\:14fe \
                 ;;   -v 0x12d1 -p 0x14fe
                 ;;
                 ;; But it is simpler to use the usb-modeswitch-service-type
                 ;; that installs a UDEV rules file which invokes a shell
                 ;; script in lib/udev (also called `usb_modeswitch' like the
                 ;; main binary) which, in turn, invokes the program
                 ;; `usb_modeswitch_dispatcher'.  Normal users should not
                 ;; invoke this dispatcher directly, so it is a separate output.
                 (install-file "usb_modeswitch" bin)
                 (install-file "usb_modeswitch.conf" etc)
                 (install-file "usb_modeswitch.1" man1)
                 (install-file "usb_modeswitch_dispatcher.1" dispatcher-man1)

                 (substitute* "usb_modeswitch.sh"
                   (("PATH=") "PATH=$PATH:") ; we do not want hardcoded FHS path
                   (("init_path=") "init_path=/does/not/exist")) ; no /sbin/init
                 (rename-file "usb_modeswitch.sh" "usb_modeswitch")
                 (install-file "usb_modeswitch" udev)

                 (rename-file "usb_modeswitch_dispatcher.tcl" "usb_modeswitch_dispatcher")
                 (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")))
                 (install-file "usb_modeswitch_dispatcher"
                               dispatcher-bin)
                 #t)))))))
    (home-page "https://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 @dfn{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 (list license:gpl2+ ;"this program" according to home page
                   license:bsd-2)))) ;dispatcher.c
rusader)[description]: Likewise. * gnu/packages/language.scm (praat)[description]: Likewise. * gnu/packages/linux.scm (light)[description]: Likewise. * gnu/packages/lisp-xyz.scm (sbcl-hu.dwim.defclass-star)[description]: Likewise. * gnu/packages/mail.scm (dovecot-trees, sieve-connect)[description]: Likewise. * gnu/packages/ocaml.scm (ocaml-opam-file-format, ocaml-cppo) (ocaml4.07-ppx-variants-conv)[description]: Likewise. * gnu/packages/perl.scm (perl-convert-binhex)[description]: Likewise. * gnu/packages/python-crypto.scm (python-ecdsa)[description]: Likewise. * gnu/packages/python-web.scm (python-html5lib)[synopsis, description]: Likewise. (python-venusian)[synopsis]: Likewise. * gnu/packages/python-xyz.scm (python-readlike, python-gssapi) (python-flufl-i18n)[description]: Likewise. (python-pox, python-watchdog, python-xattr)[synopsis, description]: Likewise. * gnu/packages/ruby.scm (ruby-sorcerer)[description]: Likewise. * gnu/packages/rust-apps.scm (watchexec)[description]: Likewise. * gnu/packages/rust.scm (mrustc)[synopsis]: Likewise. * gnu/packages/shells.scm (s-shell)[description]: Likewise. * gnu/packages/ssh.scm (sshpass)[description]: Likewise. * gnu/packages/terminals.scm (beep)[description]: Likewise. * gnu/packages/web.scm (perl-lwp-useragent-cached)[description]: Likewise. * gnu/packages/wv.scm (wv)[description]: Likewise. Tobias Geerinckx-Rice 2020-08-29gnu: ndctl: Update to 69....* gnu/packages/disk.scm (ndctl): Update to 69. Tobias Geerinckx-Rice 2020-08-24gnu: python-parted: Update to 3.11.6....* gnu/packages/disk.scm (python-parted): Update to 3.11.6. (python2-parted): Drop unsupported Python 2 variant. Tobias Geerinckx-Rice 2020-08-06gnu: Add hddtemp....* gnu/packages/disk.scm (hddtemp): New variable. Pierre Neidhardt 2020-07-26gnu: libblockdev: Update to 2.24....* gnu/packages/disk.scm (libblockdev): Update to 2.24. Tobias Geerinckx-Rice 2020-07-15gnu: gparted: Use the Glib-or-GTK build system....Fixes <https://issues.guix.gnu.org/38544>. * gnu/packages/disk.scm (gparted)[build-system]: Use glib-or-gtk-build-system. Tobias Geerinckx-Rice 2020-07-12gnu: Remove ".git" from "https://github/…/….git"....Until now, 'lookup-origin' and thus 'lookup-origin-revision' in (guix swh) would sometimes return #f for these because the ".git" URLs are redirects to the non-".git" URLs. Consequently, 'guix lint -c archival' would keep saying "scheduled Software Heritage archival"; likewise, the fallback download code would fail. * gnu/packages/ada.scm, gnu/packages/admin.scm, gnu/packages/aidc.scm, gnu/packages/algebra.scm, gnu/packages/android.scm, gnu/packages/animation.scm, gnu/packages/arcan.scm, gnu/packages/assembly.scm, gnu/packages/audio.scm, gnu/packages/authentication.scm, gnu/packages/avr.scm, gnu/packages/axoloti.scm, gnu/packages/backup.scm, gnu/packages/bash.scm, gnu/packages/benchmark.scm, gnu/packages/bioconductor.scm, gnu/packages/bioinformatics.scm, gnu/packages/bittorrent.scm, gnu/packages/boost.scm, gnu/packages/build-tools.scm, gnu/packages/c.scm, gnu/packages/calendar.scm, gnu/packages/cdrom.scm, gnu/packages/check.scm, gnu/packages/chemistry.scm, gnu/packages/chez.scm, gnu/packages/clojure.scm, gnu/packages/code.scm, gnu/packages/compression.scm, gnu/packages/compton.scm, gnu/packages/coq.scm, gnu/packages/cpp.scm, gnu/packages/cran.scm, gnu/packages/crypto.scm, gnu/packages/curl.scm, gnu/packages/databases.scm, gnu/packages/datastructures.scm, gnu/packages/debug.scm, gnu/packages/disk.scm, gnu/packages/distributed.scm, gnu/packages/django.scm, gnu/packages/dlang.scm, gnu/packages/dns.scm, gnu/packages/docker.scm, gnu/packages/education.scm, gnu/packages/efi.scm, gnu/packages/elixir.scm, gnu/packages/emacs-xyz.scm, gnu/packages/embedded.scm, gnu/packages/emulators.scm, gnu/packages/engineering.scm, gnu/packages/erlang.scm, gnu/packages/fabric-management.scm, gnu/packages/file-systems.scm, gnu/packages/finance.scm, gnu/packages/firmware.scm, gnu/packages/flashing-tools.scm, gnu/packages/fonts.scm, gnu/packages/fontutils.scm, gnu/packages/fpga.scm, gnu/packages/game-development.scm, gnu/packages/games.scm, gnu/packages/genealogy.scm, gnu/packages/genimage.scm, gnu/packages/geo.scm, gnu/packages/gimp.scm, gnu/packages/gl.scm, gnu/packages/gnome-xyz.scm, gnu/packages/gnome.scm, gnu/packages/gnuzilla.scm, gnu/packages/golang.scm, gnu/packages/gpodder.scm, gnu/packages/graph.scm, gnu/packages/graphics.scm, gnu/packages/graphviz.scm, gnu/packages/groff.scm, gnu/packages/groovy.scm, gnu/packages/gtk.scm, gnu/packages/guile-xyz.scm, gnu/packages/guile.scm, gnu/packages/hardware.scm, gnu/packages/haskell-apps.scm, gnu/packages/haskell-xyz.scm, gnu/packages/hexedit.scm, gnu/packages/i2p.scm, gnu/packages/ibus.scm, gnu/packages/image-processing.scm, gnu/packages/image-viewers.scm, gnu/packages/image.scm, gnu/packages/ipfs.scm, gnu/packages/java-graphics.scm, gnu/packages/java-maths.scm, gnu/packages/java.scm, gnu/packages/javascript.scm, gnu/packages/jrnl.scm, gnu/packages/julia.scm, gnu/packages/jupyter.scm, gnu/packages/kodi.scm, gnu/packages/language.scm, gnu/packages/lego.scm, gnu/packages/less.scm, gnu/packages/libusb.scm, gnu/packages/linux.scm, gnu/packages/lirc.scm, gnu/packages/lisp-xyz.scm, gnu/packages/llvm.scm, gnu/packages/logging.scm, gnu/packages/lolcode.scm, gnu/packages/lua.scm, gnu/packages/lxde.scm, gnu/packages/lxqt.scm, gnu/packages/machine-learning.scm, gnu/packages/mail.scm, gnu/packages/markup.scm, gnu/packages/maths.scm, gnu/packages/maven.scm, gnu/packages/mes.scm, gnu/packages/messaging.scm, gnu/packages/monitoring.scm, gnu/packages/mpd.scm, gnu/packages/music.scm, gnu/packages/networking.scm, gnu/packages/node-xyz.scm, gnu/packages/ocaml.scm, gnu/packages/ocr.scm, gnu/packages/onc-rpc.scm, gnu/packages/opencl.scm, gnu/packages/opencog.scm, gnu/packages/pantheon.scm, gnu/packages/password-utils.scm, gnu/packages/patchutils.scm, gnu/packages/pdf.scm, gnu/packages/perl6.scm, gnu/packages/phabricator.scm, gnu/packages/popt.scm, gnu/packages/printers.scm, gnu/packages/prolog.scm, gnu/packages/protobuf.scm, gnu/packages/pulseaudio.scm, gnu/packages/python-crypto.scm, gnu/packages/python-web.scm, gnu/packages/python-xyz.scm, gnu/packages/qt.scm, gnu/packages/radio.scm, gnu/packages/rails.scm, gnu/packages/rdf.scm, gnu/packages/rednotebook.scm, gnu/packages/rpc.scm, gnu/packages/rsync.scm, gnu/packages/ruby.scm, gnu/packages/rust.scm, gnu/packages/scheme.scm, gnu/packages/screen.scm, gnu/packages/security-token.scm, gnu/packages/selinux.scm, gnu/packages/serialization.scm, gnu/packages/shells.scm, gnu/packages/shellutils.scm, gnu/packages/simh.scm, gnu/packages/sml.scm, gnu/packages/ssh.scm, gnu/packages/statistics.scm, gnu/packages/stenography.scm, gnu/packages/sync.scm, gnu/packages/syncthing.scm, gnu/packages/synergy.scm, gnu/packages/telephony.scm, gnu/packages/terminals.scm, gnu/packages/tex.scm, gnu/packages/texinfo.scm, gnu/packages/text-editors.scm, gnu/packages/textutils.scm, gnu/packages/time.scm, gnu/packages/tmux.scm, gnu/packages/tor.scm, gnu/packages/toys.scm, gnu/packages/version-control.scm, gnu/packages/video.scm, gnu/packages/vim.scm, gnu/packages/virtualization.scm, gnu/packages/vlang.scm, gnu/packages/vnc.scm, gnu/packages/vpn.scm, gnu/packages/web-browsers.scm, gnu/packages/web.scm, gnu/packages/wireservice.scm, gnu/packages/wm.scm, gnu/packages/wxwidgets.scm, gnu/packages/xdisorg.scm, gnu/packages/xml.scm, gnu/packages/xorg.scm, tests/lint.scm: Remove trailing ".git" from 'git-reference' URL. Ludovic Courtès 2020-07-01gnu: rmlint: Update to 2.10.1....* gnu/packages/disk.scm (rmlint): Update to 2.10.1. Tobias Geerinckx-Rice 2020-05-14gnu: libblockdev: Set default configuration directory....Fix error from 'udisks': “Failed to get contents of the config dir (/etc/libblockdev/conf.d/)Error opening directory "/etc/libblockdev/conf.d/": No such file or directory.” * gnu/packages/disk.scm (libblockdev)[arguments]: Add phase 'patch-configuration-directory'. Signed-off-by: Efraim Flashner <efraim@flashner.co.il> Brice Waegeneire 2020-05-14gnu: libblockdev: Appease guix lint....* gnu/packages/disk.scm (libblockdev)[inputs]: Move gobject-introspection to ... [native-inputs]: ... here. Signed-off-by: Efraim Flashner <efraim@flashner.co.il> Brice Waegeneire 2020-05-13gnu: fsarchiver: Move to (gnu packages file-systems)....* gnu/packages/disk.scm (fsarchiver): Move this variable… * gnu/packages/file-systems.scm (fsarchiver): …here. Tobias Geerinckx-Rice 2020-05-11gnu: xfe: Fix few more FHS directories....* gnu/packages/disk.scm (xfe): Fix /bin and /share paths in st/config.h and src/xfedefs.h, respectively. Signed-off-by: Nicolas Goaziou <mail@nicolasgoaziou.fr> Raghav Gururajan 2020-05-08Merge branch 'core-updates'Marius Bakke 2020-05-08gnu: Add fsarchiver....* gnu/packages/disk.scm (fsarchiver): New variable. Signed-off-by: Danny Milosavljevic <dannym@scratchpost.org> Raghav Gururajan 2020-05-06Merge branch 'master' into core-updatesMarius Bakke 2020-05-06gnu: xfe: Fix hard-coded FHS directories....* gnu/packages/disk.scm (xfe): [arguments]: Remove phase `patch-xfe-paths'. Add phases `patch-bin-dirs' and `patch-share-dirs'. [inputs]: Add `bash', `coreutils', `file' and `findutils'. Signed-off-by: Nicolas Goaziou <mail@nicolasgoaziou.fr> Raghav Gururajan 2020-05-02Merge branch 'master' into core-updatesMarius Bakke 2020-05-01gnu: xfe: Use a mirror:// URL....* gnu/packages/disk.scm (xfe)[source]: Use a mirror://sourceforge URL. Nicolas Goaziou 2020-05-01gnu: xfe: Fix configuration and icons....* gnu/packages/disk.scm (xfe)[arguments]<#:make-flags>: Remove BASH_COMPLETION_DIR. [arguments]<#:phases>[patch-xferc-path]: Remove phase. [arguments]<#:phases>[patch-xfe-paths]: New phase. Signed-off-by: Danny Milosavljevic <dannym@scratchpost.org> Raghav Gururajan 2020-05-01gnu: udevil: Fix loading of setuid-programs....* gnu/packages/disk.scm (udevil)[arguments]<#:configure-flags>: Add "--with-mount-prog", "--with-umount-prog", "--with-losetup-prog", "--with-setfacl-prog". [arguments]<#:phases>[patch-udevil-reference]: New phase. Signed-off-by: Danny Milosavljevic <dannym@scratchpost.org> Raghav Gururajan 2020-04-23Merge branch 'master' into core-updates... Conflicts: etc/news.scm gnu/local.mk gnu/packages/bootloaders.scm gnu/packages/linphone.scm gnu/packages/linux.scm gnu/packages/tls.scm gnu/system.scm Marius Bakke 2020-04-23gnu: Add udevil....* gnu/packages/disk.scm (udevil): New variable. Signed-off-by: Nicolas Goaziou <mail@nicolasgoaziou.fr> Raghav Gururajan 2020-04-13Merge branch 'master' into core-updatesMarius Bakke 2020-04-13gnu: ndctl: Update to 68....* gnu/packages/disk.scm (ndctl): Update to 68. Tobias Geerinckx-Rice 2020-04-11Merge branch 'master' into core-updatesMarius Bakke 2020-04-09gnu: Add xfe....* gnu/packages/disk.scm (xfe): New variable. Raghav Gururajan 2020-04-08Merge branch 'master' into core-updates... Conflicts: etc/news.scm gnu/local.mk gnu/packages/check.scm gnu/packages/cross-base.scm gnu/packages/gimp.scm gnu/packages/java.scm gnu/packages/mail.scm gnu/packages/sdl.scm gnu/packages/texinfo.scm gnu/packages/tls.scm gnu/packages/version-control.scm Marius Bakke 2020-04-04gnu: gparted: Make some inputs native....* gnu/packages/disk.scm (gparted)[inputs]: Move yelp-tools from here... [native-inputs]: ...to here. Signed-off-by: Danny Milosavljevic <dannym@scratchpost.org> Vincent Legoll 2020-03-14Merge branch 'master' into core-updatesMarius Bakke