guix-commits
[Top][All Lists]
Advanced

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

01/04: services: inputattach: Add 'baud-rate' parameter.


From: guix-commits
Subject: 01/04: services: inputattach: Add 'baud-rate' parameter.
Date: Mon, 21 Oct 2019 17:30:56 -0400 (EDT)

civodul pushed a commit to branch master
in repository guix.

commit 84261a233ecb58d7a622329d95a8d0d3fc92f886
Author: Tim Gesthuizen <address@hidden>
Date:   Thu Oct 10 18:38:36 2019 +0200

    services: inputattach: Add 'baud-rate' parameter.
    
    * gnu/services/desktop.scm (inputattach-configuration): Add baud-rate field.
      (inputattach-shepherd-service): Add baud-rate to parameters when 
specified.
    * doc/guix.texi (Miscellaneous Services): [inputattach Service] Document
      baud-rate parameter.
    
    Signed-off-by: Ludovic Courtès <address@hidden>
---
 doc/guix.texi            |  4 ++++
 gnu/services/desktop.scm | 30 ++++++++++++++++++------------
 2 files changed, 22 insertions(+), 12 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 15b6ff0..b550b1c 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -24573,6 +24573,10 @@ The type of device to connect to.  Run 
@command{inputattach --help}, from the
 @item @code{device} (default: @code{"/dev/ttyS0"})
 The device file to connect to the device.
 
+@item @code{baud-rate} (default: @code{#f})
+Baud rate to use for the serial connection.
+Should be a number or @code{#f}.
+
 @item @code{log-file} (default: @code{#f})
 If true, this must be the name of a file to log messages to.
 @end table
diff --git a/gnu/services/desktop.scm b/gnu/services/desktop.scm
index 5a7f8be..08acb79 100644
--- a/gnu/services/desktop.scm
+++ b/gnu/services/desktop.scm
@@ -1028,23 +1028,29 @@ as expected.")))
                (default "wacom"))
   (device inputattach-configuration-device
           (default "/dev/ttyS0"))
+  (baud-rate inputattach-configuration-baud-rate
+             (default #f))
   (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)))))))
+    (($ <inputattach-configuration> type device baud-rate log-file)
+     (let ((args (append (if baud-rate
+                             (list "--baud-rate" (number->string baud-rate))
+                             '())
+                         (list (string-append "--" type)
+                               device))))
+       (list (shepherd-service
+              (provision '(inputattach))
+              (requirement '(udev))
+              (documentation "inputattach daemon")
+              (start #~(make-forkexec-constructor
+                        (cons (string-append #$inputattach
+                                             "/bin/inputattach")
+                              (quote #$args))
+                        #:log-file #$log-file))
+              (stop #~(make-kill-destructor))))))))
 
 (define inputattach-service-type
   (service-type



reply via email to

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