Add new files for 2nd Socat bridge
-Create a new set of systemd units to chose from for the creation of ttyIN2 and ttyOUT2 for a 2nd separate AT channel -Create a new script that kills the smd7 port bridge when smd7 is needed for use by ttyOUT or ttyOUT2
This commit is contained in:
4
socat-at-bridge/killsmd7bridge
Normal file
4
socat-at-bridge/killsmd7bridge
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Look for the process by its command and kill it so socat can have smd7 instead
|
||||||
|
pkill -f "/usr/bin/port_bridge smd7 at_usb2 1"
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Read from /dev/ttyIN2 and write to smd7
|
||||||
|
BindsTo=socat-smd7.service
|
||||||
|
After=socat-smd7.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
ExecStart=/bin/bash -c "/bin/cat /dev/ttyIN2 > /dev/smd7"
|
||||||
|
ExecStartPost=/bin/sleep 2s
|
||||||
|
StandardInput=tty-force
|
||||||
|
Restart=always
|
||||||
|
RestartSec=1s
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Read from /dev/smd7 and write to ttyIN2
|
||||||
|
BindsTo=socat-smd7.service
|
||||||
|
After=socat-smd7.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
ExecStart=/bin/bash -c "/bin/cat /dev/smd7 > /dev/ttyIN2"
|
||||||
|
ExecStartPost=/bin/sleep 2s
|
||||||
|
StandardInput=tty-force
|
||||||
|
Restart=always
|
||||||
|
RestartSec=1s
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
13
socat-at-bridge/smd7_tty2_systemd_units/socat-smd7.service
Normal file
13
socat-at-bridge/smd7_tty2_systemd_units/socat-smd7.service
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Socat Serial Emulation for smd7
|
||||||
|
After=ql-netd.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
ExecStart=/usrdata/socat-at-bridge/socat-armel-static -d -d pty,link=/dev/ttyIN2,raw,echo=0 pty,link=/dev/ttyOUT2,raw,echo=1
|
||||||
|
# Add a delay to prevent the clients from starting too early
|
||||||
|
ExecStartPost=/bin/sleep 2s
|
||||||
|
Restart=always
|
||||||
|
RestartSec=1s
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Read from /dev/ttyIN2 and write to smd11
|
||||||
|
BindsTo=socat-smd11.service
|
||||||
|
After=socat-smd11.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
ExecStart=/bin/bash -c "/bin/cat /dev/ttyIN2 > /dev/smd11"
|
||||||
|
ExecStartPost=/bin/sleep 2s
|
||||||
|
StandardInput=tty-force
|
||||||
|
Restart=always
|
||||||
|
RestartSec=1s
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Read from /dev/smd11 and write to ttyIN2
|
||||||
|
BindsTo=socat-smd11.service
|
||||||
|
After=socat-smd11.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
ExecStart=/bin/bash -c "/bin/cat /dev/smd11 > /dev/ttyIN2"
|
||||||
|
ExecStartPost=/bin/sleep 2s
|
||||||
|
StandardInput=tty-force
|
||||||
|
Restart=always
|
||||||
|
RestartSec=1s
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
13
socat-at-bridge/systemd_tty2_units/socat-smd11.service
Normal file
13
socat-at-bridge/systemd_tty2_units/socat-smd11.service
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Socat Serial Emulation for smd11
|
||||||
|
After=ql-netd.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
ExecStart=/usrdata/socat-at-bridge/socat-armel-static -d -d pty,link=/dev/ttyIN2,raw,echo=0 pty,link=/dev/ttyOUT2,raw,echo=1
|
||||||
|
# Add a delay to prevent the clients from starting too early
|
||||||
|
ExecStartPost=/bin/sleep 2s
|
||||||
|
Restart=always
|
||||||
|
RestartSec=1s
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
Reference in New Issue
Block a user