From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([209.51.188.92]:53150) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gj1Fq-0001h3-JJ for guix-patches@gnu.org; Mon, 14 Jan 2019 07:22:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gj1Fm-0002RF-Lq for guix-patches@gnu.org; Mon, 14 Jan 2019 07:22:10 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:59067) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gj1Fm-0002Qn-0X for guix-patches@gnu.org; Mon, 14 Jan 2019 07:22:06 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gj1Fl-0000Qc-9D for guix-patches@gnu.org; Mon, 14 Jan 2019 07:22:05 -0500 Subject: [bug#34067] Add input-wacom/inputattach Resent-Message-ID: Received: from eggs.gnu.org ([209.51.188.92]:52791) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gj1Em-0001cZ-Am for guix-patches@gnu.org; Mon, 14 Jan 2019 07:21:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gj1Eh-0001tX-VV for guix-patches@gnu.org; Mon, 14 Jan 2019 07:21:03 -0500 Received: from sonic310-12.consmr.mail.ir2.yahoo.com ([77.238.177.33]:42139) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gj1Eh-0001pk-5a for guix-patches@gnu.org; Mon, 14 Jan 2019 07:20:59 -0500 Received: from pD954F60F.dip0.t-ipconnect.de (EHLO finkpad) ([217.84.246.15]) by smtp412.mail.ir2.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID 11b16769087e01753f7336ba7232007f for ; Mon, 14 Jan 2019 12:20:52 +0000 (UTC) From: Tim Gesthuizen Date: Mon, 14 Jan 2019 13:20:50 +0100 Message-ID: <87fttvl9b1.fsf@yahoo.de> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 34067@debbugs.gnu.org --=-=-= Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" --==-=-= Content-Type: text/plain Hi, I added the following changes in order to get the touchscreen on my thinkpad x200t to work. Quick summary: - Add functions to locate modules for linux-libre. - Change linux-libre to not include non deterministic symlinks to dead items and package the source in separate output. - Add input-wacom driver and inputattach. - Add an inputattach service type that starts inputattach as a daemon. - Document the new service type There are some things worth discussing about these patches: - firmware.scm for input-wacom is probably not quite the optimal file. - linux-libre gains quite some size from packaging its build tree - Lots of small things - Maybe other things It would be nice if someone could review the patches. Tim. --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEKUiC5+8BRKEri5fa0uWPaa77GdUFAlw8fqIACgkQ0uWPaa77 GdXscggAoC5rn7fDEnIazaYcaOXGMto8z3Mcxu44nxZA4gEOqhky0M/PpbIgVSjd An3LLxf3PF75Wc66i51cduPzYBnVX9wZ+ekIvBvUUvMvuR7JVlzQ6O6NfAVY6+ax KsuQX4r6bNsMVQJH4ky0u2KJX5TaEZWi4gEVSIFX0CTBlILewILEpm6M3iDQegRu z2ZV0gEYjXtbRpuI59AbaJ2UyjIopEfnjwFTVCmWK8WD1ZKkw4ziGMHJERKpxoxh h4L7tqfW0tkdNjRZ3ZHGglInVdL79fdTsxnuPhfiVOVK/7/S/1rg7njBsgkqmDp3 h0fuhb3+QSE/oAV8LtaySAdjLeRiEg== =wX5B -----END PGP SIGNATURE----- --==-=-=-- --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: inline; filename=0001-gnu-Add-linux-libre-fill-version.patch Content-Transfer-Encoding: quoted-printable >From 9c5fc83d9d5a162fb3d4662c3e66cd77918159da Mon Sep 17 00:00:00 2001 From: Tim Gesthuizen Date: Wed, 9 Jan 2019 18:40:42 +0100 Subject: [PATCH 1/7] gnu: Add linux-libre-fill-version linux-libre-fill-version adds a patch version to the version if it is missing. * gnu/packages/linux.scm (linux-libre-fill-version): New function --- gnu/packages/linux.scm | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm index d8f37e705..aa18fba10 100644 --- a/gnu/packages/linux.scm +++ b/gnu/packages/linux.scm @@ -32,6 +32,7 @@ ;;; Copyright =C2=A9 2018 Manuel Graf ;;; Copyright =C2=A9 2018 Pierre Langlois ;;; Copyright =C2=A9 2018 Vasile Dumitrascu +;;; Copyright =C2=A9 2019 Tim Gesthuizen ;;; ;;; This file is part of GNU Guix. ;;; @@ -124,7 +125,8 @@ #:use-module (srfi srfi-1) #:use-module (srfi srfi-2) #:use-module (srfi srfi-26) - #:use-module (ice-9 match)) + #:use-module (ice-9 match) + #:use-module (ice-9 regex)) =20 (define-public (system->linux-architecture arch) "Return the Linux architecture name for ARCH, a Guix system name such as @@ -278,6 +280,14 @@ for ARCH and optionally VARIANT, or #f if there is no = such configuration." options) "\n")) =20 +(define-public (linux-libre-fill-version version) + "If the patch number of the linux-libre version is 0 it is left out. Add= the +patch number to the version if it is missing." + (if (string-match "^[0-9]+\\.[0-9]+$" + version) + (string-append version ".0") + version)) + (define* (make-linux-libre version hash supported-systems #:key ;; A function that takes an arch and a variant. --=20 2.20.1 --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0002-gnu-Add-linux-libre-module-path.patch >From 24f65c10bcfc8349778d024f039528997c9e7da9 Mon Sep 17 00:00:00 2001 From: Tim Gesthuizen Date: Wed, 9 Jan 2019 17:56:21 +0100 Subject: [PATCH 2/7] gnu: Add linux-libre-module-path Add a function that evaluates to the module path where the modules for linux-libre in a specific version are stored. * gnu/packages/linux.scm (linux-libre-module-path): New function --- gnu/packages/linux.scm | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm index aa18fba10..ccad6eba0 100644 --- a/gnu/packages/linux.scm +++ b/gnu/packages/linux.scm @@ -288,6 +288,13 @@ patch number to the version if it is missing." (string-append version ".0") version)) +(define-public (linux-libre-module-path version) + "Return the install directory for modules for linux-libre in version +VERSION." + (string-append "/lib/modules/" + (linux-libre-fill-version version) + "-gnu")) + (define* (make-linux-libre version hash supported-systems #:key ;; A function that takes an arch and a variant. -- 2.20.1 --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0003-gnu-linux-libre-Copy-source-to-the-store.patch >From e771153f957e1bd41dbef32bf6f7e997f9a732f5 Mon Sep 17 00:00:00 2001 From: Tim Gesthuizen Date: Fri, 4 Jan 2019 12:22:34 +0100 Subject: [PATCH 3/7] gnu: linux-libre: Copy source to the store The source code is needed by some kernel modules to compile. The item in the store only symlinks the build directory in /tmp which is not reachable later on and is a source of non determinism for the store item. This patch deletes the symlinks and copies the source to a separate output. * gnu/packages/linux.scm (linux-libre): [outputs]: Add output source [arguments]: Add phase to copy source to the store item. --- gnu/packages/linux.scm | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm index ccad6eba0..50c348b15 100644 --- a/gnu/packages/linux.scm +++ b/gnu/packages/linux.scm @@ -343,10 +343,12 @@ VERSION." '()) ((? string? config) `(("kconfig" ,config)))))) + (outputs '("out" "source")) (arguments `(#:modules ((guix build gnu-build-system) (guix build utils) (srfi srfi-1) + (ice-9 format) (ice-9 match)) #:phases (modify-phases %standard-phases @@ -421,7 +423,40 @@ VERSION." (string-append "INSTALL_PATH=" out) (string-append "INSTALL_MOD_PATH=" out) "INSTALL_MOD_STRIP=1" - "modules_install"))))) + "modules_install")))) + ;; After installing the source and build directories are symlinked to + ;; the build location in /tmp and are not reachable later on. Copying + ;; the files to a separate output keeps them available. + (add-after 'install 'copy-source + (lambda* (#:key outputs #:allow-other-keys) + ;; The patch is left out in the official kernel version numbering + ;; if it is 0. The module path is however always constructed with + ;; major.minor.patch. + (let* ((out (assoc-ref outputs "out")) + (source (assoc-ref outputs "source")) + (basesubdir ,(linux-libre-module-path version)) + (source-dir (string-append out basesubdir "/source")) + (build-dir (string-append out basesubdir "/build"))) + (for-each (lambda (file) + (when (symbolic-link? file) + (delete-file file))) + (list source-dir build-dir)) + (let ((source-dest (string-append source + basesubdir + "/source")) + (build-dest (string-append source + basesubdir + "/build"))) + (mkdir-p (string-append source basesubdir)) + (format #t "Copying source to ~a\n" + source-dest) + (with-output-to-port (%make-void-port "w") + (lambda _ (copy-recursively (getcwd) source-dest + #:follow-symlinks? #t + #:keep-mtime? #t))) + ;; source-dir content = build-dir content + (symlink source-dest build-dest)) + #t)))) #:tests? #f)) (home-page "https://www.gnu.org/software/linux-libre/") (synopsis "100% free redistribution of a cleaned Linux kernel") -- 2.20.1 --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: inline; filename=0004-gnu-Add-input-wacom.patch Content-Transfer-Encoding: quoted-printable >From 4cc4535566f0496e24fcf567c73494c18d4b8a08 Mon Sep 17 00:00:00 2001 From: Tim Gesthuizen Date: Sat, 5 Jan 2019 00:32:16 +0100 Subject: [PATCH 4/7] gnu: Add input-wacom * gnu/packages/firmware.scm (input-wacom): New variable --- gnu/packages/firmware.scm | 98 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) diff --git a/gnu/packages/firmware.scm b/gnu/packages/firmware.scm index 0f2d32bbd..be2fc4de4 100644 --- a/gnu/packages/firmware.scm +++ b/gnu/packages/firmware.scm @@ -5,6 +5,7 @@ ;;; Copyright =C2=A9 2017, 2018 Efraim Flashner ;;; Copyright =C2=A9 2018 Tobias Geerinckx-Rice ;;; Copyright =C2=A9 2018 Vagrant Cascadian +;;; Copyright =C2=A9 2019 Tim Gesthuizen ;;; ;;; This file is part of GNU Guix. ;;; @@ -31,6 +32,7 @@ #:use-module (gnu packages) #:use-module (gnu packages admin) #:use-module (gnu packages assembly) + #:use-module (gnu packages autotools) #:use-module (gnu packages bison) #:use-module (gnu packages cmake) #:use-module (gnu packages cross-base) @@ -530,3 +532,99 @@ switching support).\n") #t))))) (native-inputs `(("cross-gcc" ,(cross-gcc "arm-none-eabi" #:xgcc gcc-7= )) ("cross-binutils" ,(cross-binutils "arm-none-eabi")))= ))) + +(define-public input-wacom + (package + (name "input-wacom") + (version "0.42.0") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/linuxwacom/input-wacom.git") + (commit (string-append name "-" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 "04lnn7v0rm4ppbya140im5d4igcl6c1nrqpgbsr0i8wkral0nv= 7j")))) + (build-system gnu-build-system) + (native-inputs `(("autoconf" ,autoconf) + ("automake" ,automake) + ("gcc" ,@(assoc-ref (package-native-inputs linux-libr= e) + "gcc")))) + (inputs `(("linux-source" ,linux-libre "source"))) + (arguments `(#:configure-flags (list + (string-append "--with-kernel-dir=3D" + (assoc-ref %build-inputs + "linux-sourc= e") + ,(linux-libre-module-pa= th + (package-version linu= x-libre))) + (string-append "--with-kernel-version= =3D" + ,(linux-libre-fill-vers= ion + (package-version linu= x-libre)) + "-gnu")) + #:modules ((ice-9 ftw) + (ice-9 format) + (ice-9 regex) + (guix build utils) + (guix build gnu-build-system)) + #:phases (modify-phases %standard-phases + (replace 'bootstrap + (lambda* (#:key inputs outputs #:allow-other= -keys) + (setenv "CC" (string-append (assoc-ref inp= uts "gcc") + "/bin/gcc")) + (substitute* "configure.ac" + (("/lib/modules/.*/") + (string-append (assoc-ref inputs "linux= -source") + ,(linux-libre-module-path + (package-version linux= -libre)) + "/")) + (("`uname -r`") + (string-append ,(linux-libre-fill-versi= on (package-version linux-libre)) + "-gnu"))) + (invoke (string-append (assoc-ref inputs "= autoconf") + "/bin/autoreconf") + "-v" "--install") + (substitute* "configure" + (("/bin/sh") + (string-append (assoc-ref inputs "bash") + "/bin/sh"))) + #t)) + ;; input-wacom tries to use the Makefile of the + ;; kernels build tree to install its modules i= nto + ;; the OSs structure. This does not work for = us + ;; as we cannot pass extra arguments to make w= hich + ;; results in an installation to /lib. Becaus= e of + ;; this we just copy all modules that were bui= ld + ;; to the output. + (replace 'install + (lambda* (#:key outputs #:allow-other-keys) + (let ((install-dir + (string-append + (assoc-ref outputs "out") + ,(linux-libre-module-path + (package-version linux-libre)) + "/kernel/drivers/input/touchscreen= /"))) + (mkdir-p install-dir) + (file-system-fold + ;; Don't enter hidden directories + (lambda (path stat result) + (not (equal? #\. (string-ref (basenam= e path) 0)))) + (lambda (path stat result) + (when (string-match "^.*\\.ko$" path) + (format #t "Installing module ~a\n" + (basename path)) + (copy-file path + (string-append install-d= ir + (basename= path))))) + (const #t) + (const #t) + (const #t) + (lambda _ (throw 'file-system-error)) + #t + (getcwd)) + #t)))))) + (home-page "https://linuxwacom.github.io/") + (synopsis "Linux kernel driver for various wacom touchscreens") + (description "A set of kernel drivers that add support for various wac= om +touchscreens. In combination with xf86-input-wacom and libwacom it forms a= set +of modules to support wacom touchscreens with the X server.") + (license license:gpl2))) --=20 2.20.1 --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0005-gnu-Add-inputattach.patch >From cb02272b9759426427ba1accc60915b455dfb357 Mon Sep 17 00:00:00 2001 From: Tim Gesthuizen Date: Sat, 5 Jan 2019 20:55:14 +0100 Subject: [PATCH 5/7] gnu: Add inputattach * gnu/packages/firmware.scm (inputattach): New variable --- gnu/packages/firmware.scm | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/gnu/packages/firmware.scm b/gnu/packages/firmware.scm index be2fc4de4..cc2022a90 100644 --- a/gnu/packages/firmware.scm +++ b/gnu/packages/firmware.scm @@ -628,3 +628,31 @@ switching support).\n") touchscreens. In combination with xf86-input-wacom and libwacom it forms a set of modules to support wacom touchscreens with the X server.") (license license:gpl2))) + +(define-public inputattach + (package + (inherit input-wacom) + (name "inputattach") + (arguments + `(#:phases + (modify-phases %standard-phases + (delete 'bootstrap) + (delete 'configure) + (replace 'build + (lambda* (#:key inputs #:allow-other-keys) + (with-directory-excursion "inputattach" + (invoke (string-append (assoc-ref inputs "gcc") + "/bin/gcc") + "-o" "inputattach" "inputattach.c")) + #t)) + (delete 'check) + (replace 'install + (lambda* (#:key outputs #:allow-other-keys) + (let ((target-dir (string-append + (assoc-ref outputs "out") + "/bin/"))) + (mkdir-p target-dir) + (copy-file "inputattach/inputattach" + (string-append target-dir + "inputattach")))))))) + (synopsis "Dispatch input peripherals events to a device file"))) -- 2.20.1 --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: inline; filename=0006-gnu-Add-inputattach-service.patch Content-Transfer-Encoding: quoted-printable >From 8a1bb6706be11cd9c1e683e6d242accad0346d6b Mon Sep 17 00:00:00 2001 From: Tim Gesthuizen Date: Sat, 5 Jan 2019 23:28:18 +0100 Subject: [PATCH 6/7] gnu: Add inputattach service Add a service that runs inputattach as a daemon to translate events from serial ports. * gnu/local.mk: Add gnu/services/hardware.scm * gnu/services/hardware.scm (): New record type * gnu/services/hardware.scm (inputattach-service-type): New service type * gnu/services/hardware.scm (inputattach-service): New function squash --- gnu/local.mk | 1 + gnu/services/hardware.scm | 71 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 gnu/services/hardware.scm diff --git a/gnu/local.mk b/gnu/local.mk index 7c319b727..d9e06bd17 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -486,6 +486,7 @@ GNU_SYSTEM_MODULES =3D \ %D%/services/docker.scm \ %D%/services/authentication.scm \ %D%/services/games.scm \ + %D%/services/hardware.scm \ %D%/services/kerberos.scm \ %D%/services/lirc.scm \ %D%/services/virtualization.scm \ diff --git a/gnu/services/hardware.scm b/gnu/services/hardware.scm new file mode 100644 index 000000000..f924fb34d --- /dev/null +++ b/gnu/services/hardware.scm @@ -0,0 +1,71 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright =C2=A9 2019 Tim Gesthuizen +;;; +;;; 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 . + +(define-module (gnu services hardware) + #:use-module (gnu services) + #:use-module (gnu services shepherd) + #:use-module (gnu packages admin) + #:use-module (gnu packages firmware) + #:use-module (guix records) + #:use-module (guix gexp) + #:use-module (ice-9 match) + #:export (inputattach-configuration + inputattach-configuration? + inputattach-service-type + inputattach-service)) + +(define-record-type* + inputattach-configuration + make-inputattach-configuration + inputattach-configuration? + (devicetype inputattach-configuration-devicetype + (default "wacom")) + (device inputattach-configuration-device + (default "/dev/ttyS0")) + (log-file inputattach-configuration-log-file + (default #f))) + +(define inputattach-shepherd-service + (match-lambda + (($ type device log-file) + (list (shepherd-service + (provision '(inputattach)) + (requirement '(udev)) + (documentation "inputattach daemon") + (start #~(make-forkexec-constructor + (list (string-append #$inputattach + "/bin/inputattach") + (string-append "--" #$type) + #$device) + #:log-file #$log-file)) + (stop #~(make-kill-destructor))))))) + +(define inputattach-service-type + (service-type + (name 'inputattach) + (extensions + (list (service-extension shepherd-root-service-type + inputattach-shepherd-service))) + (default-value (inputattach-configuration)))) + +(define* (inputattach-service #:key (type "wacom") (device "/dev/ttyS0") (= log-file #f)) + (service inputattach-service-type + (inputattach-configuration + (devicetype type) + (device device) + (log-file log-file)))) --=20 2.20.1 --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0007-doc-Add-documentation-for-inputattach-service.patch >From a9cd86ad2244fff023f0c1bf4038748872aeab13 Mon Sep 17 00:00:00 2001 From: Tim Gesthuizen Date: Sun, 6 Jan 2019 11:56:57 +0100 Subject: [PATCH 7/7] doc: Add documentation for inputattach-service * doc/guix.texi (Miscellaneous Services): Add inputattach Service subsubheading --- doc/guix.texi | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/doc/guix.texi b/doc/guix.texi index c0cc8d416..e0921d34d 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -22020,6 +22020,17 @@ that enables sharing the clipboard with a vm and setting the guest display resolution when the graphical console window resizes. @end deffn +@cindex inputattach +@subsubheading inputattach Service + +The @code{(gnu services hardware)} module provides the following service. + +@deffn {Scheme Procedure} inputattach-service [#:type "wacom"] @ + [#:device "/dev/ttyS0"] [#:log-file #f] +Return a service that runs inputattach on @var{device} to decode events from +@var{type}. +@end deffn + @subsubsection Dictionary Services @cindex dictionary The @code{(gnu services dict)} module provides the following service: -- 2.20.1 --=-=-=--