Skip to content

Commit

Permalink
debian: Update patches from PR glidernet#25
Browse files Browse the repository at this point in the history
  • Loading branch information
kerel-fs committed Mar 15, 2017
1 parent 4e9cd29 commit 9ab4108
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 2d5ae0932b8421d0b9cbd1d61bcc93cce7536aae Mon Sep 17 00:00:00 2001
From 228440e319b06bcc3f4c300b5bba8f6d1094a54b Mon Sep 17 00:00:00 2001
From: "Fabian P. Schmidt" <[email protected]>
Date: Thu, 16 Feb 2017 09:38:26 +0100
Subject: [PATCH] Add systemd units for ogn-decode and ogn-rf
Subject: [PATCH 1/3] Add systemd units for ogn-decode and ogn-rf

---
scripts/ogn-decode.service | 11 +++++++++++
Expand All @@ -12,22 +12,26 @@ Subject: [PATCH] Add systemd units for ogn-decode and ogn-rf
create mode 100644 scripts/ogn-decode.socket
create mode 100644 scripts/ogn-rf.service

diff --git a/scripts/ogn-decode.service b/scripts/ogn-decode.service
new file mode 100644
index 0000000..f2374e3
--- /dev/null
+++ b/scripts/ogn-decode.service
@@ -0,0 +1,13 @@
@@ -0,0 +1,11 @@
+[Unit]
+Description=Decode ogn/flarm data given by a fifo and forward it to glidernet.org
+After=network.target time-sync.target
+
+[Service]
+StandardInput=tty
+StandardOutput=journal
+User=ogn
+ExecStart=/usr/bin/ogn-decode /etc/rtlsdr-ogn.conf
+Restart=on-failure
+
+[Install]
+WantedBy=multi-user.target
diff --git a/scripts/ogn-decode.socket b/scripts/ogn-decode.socket
new file mode 100644
index 0000000..5ad1405
--- /dev/null
+++ b/scripts/ogn-decode.socket
@@ -0,0 +1,6 @@
Expand All @@ -37,6 +41,9 @@ Subject: [PATCH] Add systemd units for ogn-decode and ogn-rf
+
+[Install]
+WantedBy=sockets.target
diff --git a/scripts/ogn-rf.service b/scripts/ogn-rf.service
new file mode 100644
index 0000000..5066056
--- /dev/null
+++ b/scripts/ogn-rf.service
@@ -0,0 +1,11 @@
Expand All @@ -51,3 +58,6 @@ Subject: [PATCH] Add systemd units for ogn-decode and ogn-rf
+
+[Install]
+WantedBy=multi-user.target
--
2.1.4

Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
From ee4e7ce325556925f3ddff8faeab273c1513bbb2 Mon Sep 17 00:00:00 2001
From: "Fabian P. Schmidt" <[email protected]>
Date: Sun, 19 Feb 2017 23:43:34 +0100
Subject: [PATCH 2/3] ogn-decode.service: Set StandardInput to tty

This is a workaround for #11: Version 0.2.5 crashs with SEGV if invoked by systemd,
since ogn-decode exits when it gets an EOF via stdin.
---
scripts/ogn-decode.service | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/scripts/ogn-decode.service b/scripts/ogn-decode.service
index f2374e3..cc0448b 100644
--- a/scripts/ogn-decode.service
+++ b/scripts/ogn-decode.service
@@ -3,6 +3,12 @@ Description=Decode ogn/flarm data given by a fifo and forward it to glidernet.or
After=network.target time-sync.target

[Service]
+# Using a tty as StandardInput is needed as a workaround,
+# since ogn-decode requires an interactive tty (as in: 'doesn't return EOF'),
+# see also: https://github.com/glidernet/ogn-rf/issues/11
+StandardInput=tty-fail
+StandardOutput=journal
+TTYPath=/dev/tty3
User=ogn
ExecStart=/usr/bin/ogn-decode /etc/rtlsdr-ogn.conf
Restart=on-failure
--
2.1.4

27 changes: 27 additions & 0 deletions debian/patches/0003-ogn-rf.service-Execute-ogn-rf-as-root.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
From 04e0b051e83a3f3b5c69fc47b3be2ef36eea6708 Mon Sep 17 00:00:00 2001
From: "Fabian P. Schmidt" <[email protected]>
Date: Wed, 15 Mar 2017 14:07:05 +0100
Subject: [PATCH 3/3] ogn-rf.service: Execute ogn-rf as root

The gpu support on the raspberry pi requires access to /dev/vcio and
/dev/kmem, thus ogn-rf needs to be run as root.
---
scripts/ogn-rf.service | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/ogn-rf.service b/scripts/ogn-rf.service
index 5066056..2737f62 100644
--- a/scripts/ogn-rf.service
+++ b/scripts/ogn-rf.service
@@ -3,7 +3,7 @@ Description=Receive ogn/flarm data and write the raw data to a fifo
After=network.target time-sync.target

[Service]
-User=ogn
+User=root
ExecStart=/usr/bin/ogn-rf /etc/rtlsdr-ogn.conf
Restart=on-failure

--
2.1.4

2 changes: 2 additions & 0 deletions debian/patches/series
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@
0005-Add-missing-file-gpu_fft_base.c.patch
0006-Makefile-Fix-target-RPI_GPU.patch
0001-Add-systemd-units-for-ogn-decode-and-ogn-rf.patch
0002-ogn-decode.service-Set-StandardInput-to-tty.patch
0003-ogn-rf.service-Execute-ogn-rf-as-root.patch
0001-Add-rtlsdr-ogn.conf-conffile.patch
0001-ogn-rf-Detect-if-stdin-is-a-terminal.patch

0 comments on commit 9ab4108

Please sign in to comment.