guix-commits
[Top][All Lists]
Advanced

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

03/07: gnu: Add inputattach service.


From: guix-commits
Subject: 03/07: gnu: Add inputattach service.
Date: Mon, 18 Mar 2019 05:51:31 -0400 (EDT)

civodul pushed a commit to branch master
in repository guix.

commit 97ab799afeff032b422642d945c2bcc764f6d8ed
Author: Tim Gesthuizen <address@hidden>
Date:   Sat Jan 5 23:28:18 2019 +0100

    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.
    
    Signed-off-by: Ludovic Courtès <address@hidden>
---
 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 a3dd344..601afed 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -22503,6 +22503,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 0dee57e..8f8e177 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:
@@ -1021,6 +1026,47 @@ as expected.")))
 
 
 ;;;
+;;; inputattach-service-type
+;;;
+
+(define-record-type* <inputattach-configuration>
+  inputattach-configuration
+  make-inputattach-configuration
+  inputattach-configuration?
+  (device-type inputattach-configuration-device-type
+               (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.
 ;;;
 



reply via email to

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