Subject: [PATCH] gnu: Add remserial

From: "Artyom V. Poptsov" <[email-masked]>
Date: Thu, 09 Jun 2022 21:53:30 +0300

Hello,

this patch adds 'remserial'. [1]

- Artyom

References:
1. "Communications bridge between TCP/IP and a serial port"
   http://lpccomp.bc.ca/remserial/

From 0f1b94b57eda653176429b183f3f30de9c0d38d3 Mon Sep 17 00:00:00 2001
From: "Artyom V. Poptsov" <[email-masked]>
Date: Thu, 9 Jun 2022 21:50:25 +0300
Subject: [PATCH] gnu: Add remserial

* gnu/packages/linux.scm (remserial): New variable.
---
 gnu/packages/linux.scm | 61 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 61 insertions(+)

diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index dacb29a6ac..006848aabd 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -9263,3 +9263,64 @@ libraries are found or why they cannot be located.")
 gestures you make on your touchpad or touchscreen into visible actions in your
 desktop.")
     (license license:gpl3+)))
+
+(define-public remserial
+  (package
+    (name "remserial")
+    (version "1.4")
+    (source (origin
+              (method url-fetch)
+              (uri (list (string-append
+                          "http://lpccomp.bc.ca/remserial/remserial-" version
+                          ".tar.gz")
+                         ;; XXX: 'guix build' returns 405 "Method Not Allowed"
+                         ;; for the official URL although 'guix download'
+                         ;; fetches the file without any problems.  Let's use
+                         ;; the version from the Internet Archive for now.
+                         (string-append
+                          "https://web.archive.org/web/20220406152331/"
+                          "http://lpccomp.bc.ca/remserial/remserial-" version
+                          ".tar.gz")))
+              (sha256
+               (base32
+                "0jhi73pcnmvrg5zvhwc60gynp0c3r5z3fvi50vpv37smyibn55fn"))))
+    (build-system gnu-build-system)
+    (native-inputs (list linux-libre-headers))
+    (arguments
+     (list #:make-flags
+           #~(list (string-append "CC=" #$(cc-for-target))
+                   "CFLAGS=-D_XOPEN_SOURCE=500")
+           #:tests?
+           #f ;no tests.
+           #:phases
+           #~(modify-phases %standard-phases
+               (delete 'configure)
+               (replace 'install
+                 (lambda* (#:key outputs #:allow-other-keys)
+                   (let* ((out     (assoc-ref outputs "out"))
+                          (bin-dir (string-append out "/bin")))
+                     (install-file "remserial" bin-dir)) #t)))))
+    (home-page "http://lpccomp.bc.ca/remserial/")
+    (synopsis "Communications bridge between TCP/IP and a serial port")
+    (description
+     "The remserial program acts as a communications bridge
+between a TCP/IP network port and a Linux device such as a serial port.  Any
+character-oriented Linux @file{/dev} device will work.
+
+The program can also use pseudo-ttys as the device.  A pseudo-tty is like a
+serial port in that it has a @file{/dev} entry that can be opened by a program
+that expects a serial port device, except that instead of belonging to a
+physical serial device, the data can be intercepted by another program.  The
+remserial program uses this to connect a network port to the
+\"master\" (programming) side of the pseudo-tty allowing the device
+driver (slave) side to be used by some program expecting a serial port.
+
+The program can operate as a server accepting network connections from other
+machines, or as a client, connecting to remote machine that is running the
+remserial program or some other program that accepts a raw network connection.
+The network connection passes data as-is, there is no control protocol over
+the network socket.
+
+Multiple copies of the program can run on the same computer at the same time
+assuming each is using a different network port and device.")
+    (license license:gpl2+)))
-- 
2.25.1

-- 
Artyom "avp" Poptsov <[email-masked]>
Home page: https://memory-heap.org/~avp/
CADR Hackerspace co-founder: https://cadrspace.ru/
GPG: D0C2 EAC1 3310 822D 98DE  B57C E9C5 A2D9 0898 A02F