GNU bug report logs - #37750
inputattach: Add baud rate option

Previous Next

Package: guix-patches;

Reported by: Tim Gesthuizen <tim.gesthuizen <at> yahoo.de>

Date: Mon, 14 Oct 2019 17:31:01 UTC

Severity: normal

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 37750 in the body.
You can then email your comments to 37750 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#37750; Package guix-patches. (Mon, 14 Oct 2019 17:31:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Tim Gesthuizen <tim.gesthuizen <at> yahoo.de>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Mon, 14 Oct 2019 17:31:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Tim Gesthuizen <tim.gesthuizen <at> yahoo.de>
To: guix-patches <at> gnu.org
Subject: inputattach: Add baud rate option
Date: Mon, 14 Oct 2019 19:30:22 +0200
[Message part 1 (text/plain, inline)]
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.

[0001-gnu-Add-baud-rate-parameter-to-inputattach-service.patch (text/x-patch, inline)]
From 29bf34ead05c47a1d045dd60185c803dd6af204a Mon Sep 17 00:00:00 2001
From: Tim Gesthuizen <tim.gesthuizen <at> 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


Information forwarded to guix-patches <at> gnu.org:
bug#37750; Package guix-patches. (Mon, 14 Oct 2019 17:58:01 GMT) Full text and rfc822 format available.

Message #8 received at 37750 <at> debbugs.gnu.org (full text, mbox):

From: Tim Gesthuizen <tim.gesthuizen <at> yahoo.de>
To: 37750 <at> debbugs.gnu.org
Subject: Fixup: Documentation
Date: Mon, 14 Oct 2019 19:57:29 +0200
[Message part 1 (text/plain, inline)]
Of course there is also documentation for the new parameter which I
missed to send.
You find an updated patch attached.

Sorry for the hassle,
Tim.

[0001-gnu-Add-baud-rate-parameter-to-inputattach-service.patch (text/x-patch, inline)]
From 544ae60c79134be980d6ee0430deb6abe4cad8ca Mon Sep 17 00:00:00 2001
From: Tim Gesthuizen <tim.gesthuizen <at> 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.
* doc/guix.texi (Miscellaneous Services): [inputattach Service] Document
  baud-rate parameter.
---
 doc/guix.texi            |  4 ++++
 gnu/services/desktop.scm | 32 ++++++++++++++++++++------------
 2 files changed, 24 insertions(+), 12 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 6703c2756c..e53a708df2 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -24549,6 +24549,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 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


Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Mon, 21 Oct 2019 21:06:02 GMT) Full text and rfc822 format available.

Notification sent to Tim Gesthuizen <tim.gesthuizen <at> yahoo.de>:
bug acknowledged by developer. (Mon, 21 Oct 2019 21:06:02 GMT) Full text and rfc822 format available.

Message #13 received at 37750-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Tim Gesthuizen <tim.gesthuizen <at> yahoo.de>
Cc: 37750-done <at> debbugs.gnu.org
Subject: Re: [bug#37750] Fixup: Documentation
Date: Mon, 21 Oct 2019 23:05:23 +0200
[Message part 1 (text/plain, inline)]
Hi Tim,

Tim Gesthuizen <tim.gesthuizen <at> yahoo.de> skribis:

>>From 544ae60c79134be980d6ee0430deb6abe4cad8ca Mon Sep 17 00:00:00 2001
> From: Tim Gesthuizen <tim.gesthuizen <at> 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.
> * 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’.

[Message part 2 (text/x-patch, inline)]
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))))

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 19 Nov 2019 12:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 160 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.