unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#37750] inputattach: Add baud rate option
@ 2019-10-14 17:30 Tim Gesthuizen via Guix-patches via
  2019-10-14 17:57 ` [bug#37750] Fixup: Documentation Tim Gesthuizen via Guix-patches via
  0 siblings, 1 reply; 3+ messages in thread
From: Tim Gesthuizen via Guix-patches via @ 2019-10-14 17:30 UTC (permalink / raw)
  To: 37750

[-- Attachment #1: Type: text/plain, Size: 195 bytes --]

Hi Guix,

The attached patch adds a baud-rate option to the inputattach-service
which is needed for some devices.
It would be nice if someone could review and commit if the patch is
fine.

Tim.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-Add-baud-rate-parameter-to-inputattach-service.patch --]
[-- Type: text/x-patch, Size: 2638 bytes --]

From 29bf34ead05c47a1d045dd60185c803dd6af204a Mon Sep 17 00:00:00 2001
From: Tim Gesthuizen <tim.gesthuizen@yahoo.de>
Date: Thu, 10 Oct 2019 18:38:36 +0200
Subject: [PATCH] gnu: Add baud-rate parameter to inputattach-service

* gnu/services/desktop.scm (inputattach-configuration): Add baud-rate field.
  (inputattach-shepherd-service): Add baud-rate to parameters when specified.
---
 gnu/services/desktop.scm | 32 ++++++++++++++++++++------------
 1 file changed, 20 insertions(+), 12 deletions(-)

diff --git a/gnu/services/desktop.scm b/gnu/services/desktop.scm
index a32756e040..35320bdde2 100644
--- a/gnu/services/desktop.scm
+++ b/gnu/services/desktop.scm
@@ -1021,23 +1021,31 @@ 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
+                             (if (number? baud-rate)
+                                 (list "--baud-rate" (number->string baud-rate))
+                                 (error "Expected baud-rate to be a number or #f" 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
-- 
2.23.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-10-21 21:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-14 17:30 [bug#37750] inputattach: Add baud rate option Tim Gesthuizen via Guix-patches via
2019-10-14 17:57 ` [bug#37750] Fixup: Documentation Tim Gesthuizen via Guix-patches via
2019-10-21 21:05   ` bug#37750: " Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).