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

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

[debbugs-tracker] bug#37750: closed (inputattach: Add baud rate option)


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#37750: closed (inputattach: Add baud rate option)
Date: Mon, 21 Oct 2019 21:06:02 +0000

Your message dated Mon, 21 Oct 2019 23:05:23 +0200
with message-id <address@hidden>
and subject line Re: [bug#37750] Fixup: Documentation
has caused the debbugs.gnu.org bug report #37750,
regarding inputattach: Add baud rate option
to be marked as done.

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


-- 
37750: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=37750
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: inputattach: Add baud rate option Date: Mon, 14 Oct 2019 19:30:22 +0200 User-agent: mu4e 1.2.0; emacs 26.3
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.

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


--- End Message ---
--- Begin Message --- Subject: Re: [bug#37750] Fixup: Documentation Date: Mon, 21 Oct 2019 23:05:23 +0200 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)
Hi Tim,

Tim Gesthuizen <address@hidden> skribis:

>>From 544ae60c79134be980d6ee0430deb6abe4cad8ca Mon Sep 17 00:00:00 2001
> From: Tim Gesthuizen <address@hidden>
> 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.
> * doc/guix.texi (Miscellaneous Services): [inputattach Service] Document
>   baud-rate parameter.

Neat.  I took the liberty to apply it with the minor change below (we
don’t usually call ‘error’; eventually I think we should use contracts à
la Racket in such situations.)

Thanks!

Ludo’.

diff --git a/gnu/services/desktop.scm b/gnu/services/desktop.scm
index 20e89c0dea..08acb79ed6 100644
--- a/gnu/services/desktop.scm
+++ b/gnu/services/desktop.scm
@@ -1037,9 +1037,7 @@ as expected.")))
   (match-lambda
     (($ <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 "--baud-rate" (number->string baud-rate))
                              '())
                          (list (string-append "--" type)
                                device))))

--- End Message ---

reply via email to

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