guix-patches
[Top][All Lists]
Advanced

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

[bug#34067] Add input-wacom/inputattach


From: Tim Gesthuizen
Subject: [bug#34067] Add input-wacom/inputattach
Date: Sun, 17 Mar 2019 21:36:27 +0100
User-agent: mu4e 1.0; emacs 26.1

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.

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

>From 2dffbe48072e0281651a5200d75c7783de4eacbd Mon Sep 17 00:00:00 2001
From: Tim Gesthuizen <address@hidden>
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
 
address@hidden inputattach
address@hidden inputattach Service
+
address@hidden {Data Type} inputattach-configuration
address@hidden @asis
address@hidden @code{device-type} The type of device to connect to.
address@hidden @code{device} The device file to connect to the device.
address@hidden @code{log-file} The file to log messages to.
address@hidden table
address@hidden deftp
+
address@hidden {Scheme Procedure} inputattach-service-type
+Return a service that runs inputattach on a device and
+dispatches events from it.
address@hidden 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 <address@hidden>
 ;;; Copyright © 2018 Ricardo Wurmus <address@hidden>
 ;;; Copyright © 2017, 2019 Christopher Baines <address@hidden>
+;;; Copyright © 2019 Tim Gesthuizen <address@hidden>
 ;;;
 ;;; 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 via email to

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