GNU bug report logs - #34067
Add input-wacom/inputattach

Previous Next

Package: guix-patches;

Reported by: Tim Gesthuizen <tim.gesthuizen <at> yahoo.de>

Date: Mon, 14 Jan 2019 12:22:02 UTC

Severity: normal

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 34067 in the body.
You can then email your comments to 34067 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#34067; Package guix-patches. (Mon, 14 Jan 2019 12:22:05 GMT) Full text and rfc822 format available.

Acknowledgement sent to Tim Gesthuizen <tim.gesthuizen <at> yahoo.de>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Mon, 14 Jan 2019 12:22:05 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Tim Gesthuizen <tim.gesthuizen <at> yahoo.de>
To: guix-patches <at> gnu.org
Subject: Add input-wacom/inputattach
Date: Mon, 14 Jan 2019 13:20:50 +0100
[Message part 1 (text/plain, inline)]
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.

[signature.asc (application/pgp-signature, inline)]
[0001-gnu-Add-linux-libre-fill-version.patch (text/x-patch, inline)]
From 9c5fc83d9d5a162fb3d4662c3e66cd77918159da Mon Sep 17 00:00:00 2001
From: Tim Gesthuizen <tim.gesthuizen <at> yahoo.de>
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 © 2018 Manuel Graf <graf <at> init.at>
 ;;; Copyright © 2018 Pierre Langlois <pierre.langlois <at> gmx.com>
 ;;; Copyright © 2018 Vasile Dumitrascu <va511e <at> yahoo.com>
+;;; Copyright © 2019 Tim Gesthuizen <tim.gesthuizen <at> yahoo.de>
 ;;;
 ;;; 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))
 
 (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"))
 
+(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.
-- 
2.20.1

[0002-gnu-Add-linux-libre-module-path.patch (text/x-patch, inline)]
From 24f65c10bcfc8349778d024f039528997c9e7da9 Mon Sep 17 00:00:00 2001
From: Tim Gesthuizen <tim.gesthuizen <at> yahoo.de>
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

[0003-gnu-linux-libre-Copy-source-to-the-store.patch (text/x-patch, inline)]
From e771153f957e1bd41dbef32bf6f7e997f9a732f5 Mon Sep 17 00:00:00 2001
From: Tim Gesthuizen <tim.gesthuizen <at> yahoo.de>
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

[0004-gnu-Add-input-wacom.patch (text/x-patch, inline)]
From 4cc4535566f0496e24fcf567c73494c18d4b8a08 Mon Sep 17 00:00:00 2001
From: Tim Gesthuizen <tim.gesthuizen <at> yahoo.de>
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 © 2017, 2018 Efraim Flashner <efraim <at> flashner.co.il>
 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me <at> tobias.gr>
 ;;; Copyright © 2018 Vagrant Cascadian <vagrant <at> debian.org>
+;;; Copyright © 2019 Tim Gesthuizen <tim.gesthuizen <at> yahoo.de>
 ;;;
 ;;; 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 "04lnn7v0rm4ppbya140im5d4igcl6c1nrqpgbsr0i8wkral0nv7j"))))
+    (build-system gnu-build-system)
+    (native-inputs `(("autoconf" ,autoconf)
+                     ("automake" ,automake)
+                     ("gcc" ,@(assoc-ref (package-native-inputs linux-libre)
+                                         "gcc"))))
+    (inputs `(("linux-source" ,linux-libre "source")))
+    (arguments `(#:configure-flags (list
+                                    (string-append "--with-kernel-dir="
+                                                   (assoc-ref %build-inputs
+                                                              "linux-source")
+                                                   ,(linux-libre-module-path
+                                                     (package-version linux-libre)))
+                                    (string-append "--with-kernel-version="
+                                                   ,(linux-libre-fill-version
+                                                     (package-version linux-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 inputs "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-version (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 into
+                            ;; the OSs structure.  This does not work for us
+                            ;; as we cannot pass extra arguments to make which
+                            ;; results in an installation to /lib.  Because of
+                            ;; this we just copy all modules that were build
+                            ;; 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 (basename 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-dir
+                                                                 (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 wacom
+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)))
-- 
2.20.1

[0005-gnu-Add-inputattach.patch (text/x-patch, inline)]
From cb02272b9759426427ba1accc60915b455dfb357 Mon Sep 17 00:00:00 2001
From: Tim Gesthuizen <tim.gesthuizen <at> yahoo.de>
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

[0006-gnu-Add-inputattach-service.patch (text/x-patch, inline)]
From 8a1bb6706be11cd9c1e683e6d242accad0346d6b Mon Sep 17 00:00:00 2001
From: Tim Gesthuizen <tim.gesthuizen <at> yahoo.de>
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 (<inputattach-configuration>): 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 =				\
   %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 © 2019 Tim Gesthuizen <tim.gesthuizen <at> yahoo.de>
+;;;
+;;; 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 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>
+  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
+    (($ <inputattach-configuration> 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))))
-- 
2.20.1

[0007-doc-Add-documentation-for-inputattach-service.patch (text/x-patch, inline)]
From a9cd86ad2244fff023f0c1bf4038748872aeab13 Mon Sep 17 00:00:00 2001
From: Tim Gesthuizen <tim.gesthuizen <at> yahoo.de>
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


Information forwarded to guix-patches <at> gnu.org:
bug#34067; Package guix-patches. (Sun, 20 Jan 2019 18:06:02 GMT) Full text and rfc822 format available.

Message #8 received at 34067 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Tim Gesthuizen <tim.gesthuizen <at> yahoo.de>
Cc: 34067 <at> debbugs.gnu.org
Subject: Re: [bug#34067] Add input-wacom/inputattach
Date: Sun, 20 Jan 2019 19:05:29 +0100
Hi Tim,

Thanks for the patches!  Here’s a quick review:

>>From 9c5fc83d9d5a162fb3d4662c3e66cd77918159da Mon Sep 17 00:00:00 2001
> From: Tim Gesthuizen <tim.gesthuizen <at> yahoo.de>
> 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

Could the ‘version-major+minor’ procedure play a similar role for what
you want?

>>From 24f65c10bcfc8349778d024f039528997c9e7da9 Mon Sep 17 00:00:00 2001
> From: Tim Gesthuizen <tim.gesthuizen <at> yahoo.de>
> 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

s/path/file-name/  :-)

>>From e771153f957e1bd41dbef32bf6f7e997f9a732f5 Mon Sep 17 00:00:00 2001
> From: Tim Gesthuizen <tim.gesthuizen <at> yahoo.de>
> 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.

I’d rather avoid that and this would fill up stores.  What about simply
writing:

  (inputs
    `(("linux-libre-source" ,(package-source linux-libre))
      …))

in the ‘input-wacom’ package?  The downside is that the package
definition of ‘input-wacom’ would have to unpack it, etc., but it seems
worth it.

>>From 4cc4535566f0496e24fcf567c73494c18d4b8a08 Mon Sep 17 00:00:00 2001
> From: Tim Gesthuizen <tim.gesthuizen <at> yahoo.de>
> 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

[...]

> +    (synopsis "Linux kernel driver for various wacom touchscreens")

So this should go to linux.scm rather than firmware.scm.  :-)

Could you please make sure the code doesn’t contain binary blobs—e.g.,
in the form of large ‘char’ arrays?  You can maybe just check whether
Debian “main” contains this driver.

Then there’s the question of which kernel version to target.  I guess
it’s reasonable to just choose whatever ‘linux-libre’ points to.
Thoughts?

> +    (description "A set of kernel drivers that add support for various wacom
> +touchscreens. In combination with xf86-input-wacom and libwacom it forms a set
> +of modules to support wacom touchscreens with the X server.")

Please write full sentences and address the two-space-after-period issue
that ‘guix lint’ tells you about.  :-)

>>From cb02272b9759426427ba1accc60915b455dfb357 Mon Sep 17 00:00:00 2001
> From: Tim Gesthuizen <tim.gesthuizen <at> yahoo.de>
> Date: Sat, 5 Jan 2019 20:55:14 +0100
> Subject: [PATCH 5/7] gnu: Add inputattach
>
> * gnu/packages/firmware.scm (inputattach): New variable

[...]

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

Please return #t.

>>From 8a1bb6706be11cd9c1e683e6d242accad0346d6b Mon Sep 17 00:00:00 2001
> From: Tim Gesthuizen <tim.gesthuizen <at> yahoo.de>
> 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 (<inputattach-configuration>): New record type
> * gnu/services/hardware.scm (inputattach-service-type): New service type
> * gnu/services/hardware.scm (inputattach-service): New function
>
> squash

Leftover.  :-)  Also, no need to repeat the file name when it’s the same.

> +++ b/gnu/services/hardware.scm

Do you think desktop.scm would make sense?

> +(define-record-type* <inputattach-configuration>
> +  inputattach-configuration
> +  make-inputattach-configuration
> +  inputattach-configuration?
> +  (devicetype inputattach-configuration-devicetype
> +              (default "wacom"))

‘device-type’

> +(define inputattach-service-type
> +  (service-type
> +   (name 'inputattach)
> +   (extensions
> +    (list (service-extension shepherd-root-service-type
> +                             inputattach-shepherd-service)))
> +   (default-value (inputattach-configuration))))

Please add a ‘description’ field so people can find out about it with
‘guix system search’.

> +(define* (inputattach-service #:key (type "wacom") (device "/dev/ttyS0") (log-file #f))

This can be removed (we no longer provide such procedures.)

>>From a9cd86ad2244fff023f0c1bf4038748872aeab13 Mon Sep 17 00:00:00 2001
> From: Tim Gesthuizen <tim.gesthuizen <at> yahoo.de>
> 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

Can be squashed with the previous patch.

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

Here could you document ‘inputattach-service-type’ and
‘inputattach-configuration’?

Thanks!

Ludo’.




Information forwarded to guix-patches <at> gnu.org:
bug#34067; Package guix-patches. (Sun, 17 Mar 2019 20:37:02 GMT) Full text and rfc822 format available.

Message #11 received at 34067 <at> debbugs.gnu.org (full text, mbox):

From: Tim Gesthuizen <tim.gesthuizen <at> yahoo.de>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 34067 <at> debbugs.gnu.org
Subject: Re: [bug#34067] Add input-wacom/inputattach
Date: Sun, 17 Mar 2019 21:36:27 +0100
[Message part 1 (text/plain, inline)]
Hi Ludo,
sorry for the long delay!

For now I guess it would be the best to not package the actual driver
and rely on the one that is merged into linux-libre.  I reduced the
patches to only add inputattach and the service type for it.

Tim.

[0001-gnu-Add-inputattach.patch (text/x-patch, inline)]
From 72a27f6f4d1f6ad171f479b03b531e51c6c997ef Mon Sep 17 00:00:00 2001
From: Tim Gesthuizen <tim.gesthuizen <at> yahoo.de>
Date: Sat, 5 Jan 2019 20:55:14 +0100
Subject: [PATCH 1/2] gnu: Add inputattach

* gnu/packages/linux.scm (inputattach): New variable.
---
 gnu/packages/linux.scm | 43 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index ffd376de45..1755032f91 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -32,6 +32,7 @@
 ;;; Copyright © 2018 Manuel Graf <graf <at> init.at>
 ;;; Copyright © 2018 Pierre Langlois <pierre.langlois <at> gmx.com>
 ;;; Copyright © 2018 Vasile Dumitrascu <va511e <at> yahoo.com>
+;;; Copyright © 2019 Tim Gesthuizen <tim.gesthuizen <at> yahoo.de>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -5134,3 +5135,45 @@ the correct permissions and ownership, and then pack them up, or one would
 have to construct the archives directly, without using the archiver.")
     (home-page "http://freshmeat.sourceforge.net/projects/fakeroot")
     (license license:gpl3+)))
+
+(define-public inputattach
+  (package
+    (name "inputattach")
+    (version "0.42.0")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/linuxwacom/input-wacom.git")
+                    (commit (string-append "input-wacom-" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32 "04lnn7v0rm4ppbya140im5d4igcl6c1nrqpgbsr0i8wkral0nv7j"))))
+    (build-system gnu-build-system)
+    (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"))
+               #t))))))
+    (home-page "https://linuxwacom.github.io/")
+    (synopsis "Dispatch input peripherals events to a device file")
+    (description "inputattach dispatches input events from several device
+types and interfaces and translates so that the X server can use them.")
+    (license license:gpl2+)))
-- 
2.21.0

[0002-gnu-Add-inputattach-service.patch (text/x-patch, inline)]
From 2dffbe48072e0281651a5200d75c7783de4eacbd Mon Sep 17 00:00:00 2001
From: Tim Gesthuizen <tim.gesthuizen <at> yahoo.de>
Date: Sat, 5 Jan 2019 23:28:18 +0100
Subject: [PATCH 2/2] gnu: Add inputattach service

Add a service that runs inputattach as a daemon to translate events from
serial ports.

* gnu/services/desktop.scm (<inputattach-configuration>): New record type.
* gnu/services/desktop.scm (inputattach-service-type): New service type.
* doc/guix.texi (Miscellaneous Services): Add inputattach Service
  subsubheading.
---
 doc/guix.texi            | 16 ++++++++++++++
 gnu/services/desktop.scm | 46 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 62 insertions(+)

diff --git a/doc/guix.texi b/doc/guix.texi
index 9fb5cff06d..38d5daccd7 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -22306,6 +22306,22 @@ 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
+
+@deftp {Data Type} inputattach-configuration
+@table @asis
+@item @code{device-type} The type of device to connect to.
+@item @code{device} The device file to connect to the device.
+@item @code{log-file} The file to log messages to.
+@end table
+@end deftp
+
+@deffn {Scheme Procedure} inputattach-service-type
+Return a service that runs inputattach on a device and
+dispatches events from it.
+@end deffn
+
 @subsection Dictionary Services
 @cindex dictionary
 The @code{(gnu services dict)} module provides the following service:
diff --git a/gnu/services/desktop.scm b/gnu/services/desktop.scm
index ce63969dc8..16687236eb 100644
--- a/gnu/services/desktop.scm
+++ b/gnu/services/desktop.scm
@@ -8,6 +8,7 @@
 ;;; Copyright © 2018 Efraim Flashner <efraim <at> flashner.co.il>
 ;;; Copyright © 2018 Ricardo Wurmus <rekado <at> elephly.net>
 ;;; Copyright © 2017, 2019 Christopher Baines <mail <at> cbaines.net>
+;;; Copyright © 2019 Tim Gesthuizen <tim.gesthuizen <at> yahoo.de>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -123,6 +124,10 @@
             enlightenment-desktop-configuration?
             enlightenment-desktop-service-type
 
+            inputattach-configuration
+            inputattach-configuration?
+            inputattach-service-type
+
             %desktop-services))
 
 ;;; Commentary:
@@ -1015,6 +1020,47 @@ thumbnails and makes setuid the programs which enlightenment needs to function
 as expected.")))
 
 
+;;;
+;;; inputattach-service-type
+;;;
+
+(define-record-type* <inputattach-configuration>
+  inputattach-configuration
+  make-inputattach-configuration
+  inputattach-configuration?
+  (device-type 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
+    (($ <inputattach-configuration> 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))
+   (description "Return a service that runs inputattach on a device and
+dispatches events from it.")))
+
+
 ;;;
 ;;; The default set of desktop services.
 ;;;
-- 
2.21.0


Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Mon, 18 Mar 2019 09:25:01 GMT) Full text and rfc822 format available.

Notification sent to Tim Gesthuizen <tim.gesthuizen <at> yahoo.de>:
bug acknowledged by developer. (Mon, 18 Mar 2019 09:25:02 GMT) Full text and rfc822 format available.

Message #16 received at 34067-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Tim Gesthuizen <tim.gesthuizen <at> yahoo.de>
Cc: 34067-done <at> debbugs.gnu.org
Subject: Re: [bug#34067] Add input-wacom/inputattach
Date: Mon, 18 Mar 2019 10:24:29 +0100
Hi Tim,

Tim Gesthuizen <tim.gesthuizen <at> yahoo.de> skribis:

> For now I guess it would be the best to not package the actual driver
> and rely on the one that is merged into linux-libre.  I reduced the
> patches to only add inputattach and the service type for it.

Sounds good!

I applied both patches and expounded a bit the documentation in a
followup commit.

Thank you!

Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 15 Apr 2019 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 5 years and 11 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.