emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[debbugs-tracker] bug#34067: closed (Add input-wacom/inputattach)


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#34067: closed (Add input-wacom/inputattach)
Date: Mon, 18 Mar 2019 09:25:02 +0000

Your message dated Mon, 18 Mar 2019 10:24:29 +0100
with message-id <address@hidden>
and subject line Re: [bug#34067] Add input-wacom/inputattach
has caused the debbugs.gnu.org bug report #34067,
regarding Add input-wacom/inputattach
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
34067: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=34067
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: Add input-wacom/inputattach Date: Mon, 14 Jan 2019 13:20:50 +0100
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.

Attachment: signature.asc
Description: PGP signature

>From 9c5fc83d9d5a162fb3d4662c3e66cd77918159da Mon Sep 17 00:00:00 2001
From: Tim Gesthuizen <address@hidden>
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 <address@hidden>
 ;;; Copyright © 2018 Pierre Langlois <address@hidden>
 ;;; Copyright © 2018 Vasile Dumitrascu <address@hidden>
+;;; Copyright © 2019 Tim Gesthuizen <address@hidden>
 ;;;
 ;;; 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

>From 24f65c10bcfc8349778d024f039528997c9e7da9 Mon Sep 17 00:00:00 2001
From: Tim Gesthuizen <address@hidden>
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

>From e771153f957e1bd41dbef32bf6f7e997f9a732f5 Mon Sep 17 00:00:00 2001
From: Tim Gesthuizen <address@hidden>
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

>From 4cc4535566f0496e24fcf567c73494c18d4b8a08 Mon Sep 17 00:00:00 2001
From: Tim Gesthuizen <address@hidden>
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 <address@hidden>
 ;;; Copyright © 2018 Tobias Geerinckx-Rice <address@hidden>
 ;;; Copyright © 2018 Vagrant Cascadian <address@hidden>
+;;; Copyright © 2019 Tim Gesthuizen <address@hidden>
 ;;;
 ;;; 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

>From cb02272b9759426427ba1accc60915b455dfb357 Mon Sep 17 00:00:00 2001
From: Tim Gesthuizen <address@hidden>
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

>From 8a1bb6706be11cd9c1e683e6d242accad0346d6b Mon Sep 17 00:00:00 2001
From: Tim Gesthuizen <address@hidden>
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 <address@hidden>
+;;;
+;;; 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

>From a9cd86ad2244fff023f0c1bf4038748872aeab13 Mon Sep 17 00:00:00 2001
From: Tim Gesthuizen <address@hidden>
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
 
address@hidden inputattach
address@hidden inputattach Service
+
+The @code{(gnu services hardware)} module provides the following service.
+
address@hidden {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
address@hidden
address@hidden deffn
+
 @subsubsection Dictionary Services
 @cindex dictionary
 The @code{(gnu services dict)} module provides the following service:
-- 
2.20.1


--- End Message ---
--- Begin Message --- Subject: Re: [bug#34067] Add input-wacom/inputattach Date: Mon, 18 Mar 2019 10:24:29 +0100 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)
Hi Tim,

Tim Gesthuizen <address@hidden> 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’.


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]