stuff for digirig and icom ic-v8000
This commit is contained in:
@@ -0,0 +1,122 @@
|
||||
# Role: scanner_digirig
|
||||
# Configure direwolf with the Digirig device
|
||||
#
|
||||
# - Set up udev rules to make special device drivers for the Digirig in /dev/radio so we don't
|
||||
# have to relay on /dev/ttyUSB0, 1 or whatever number the OS happens to assign. This gives the
|
||||
# device names consistency.
|
||||
#
|
||||
# - Set up systemd service to start Direwolf when the device is connected via USB, and to stop it
|
||||
# when the radio is disconnected.
|
||||
#
|
||||
# - Copy configuration files
|
||||
#
|
||||
|
||||
- name: Create various directories
|
||||
file:
|
||||
path: "{{item}}"
|
||||
state: directory
|
||||
owner: busnet
|
||||
group: busnet
|
||||
mode: u=rwx,g=rwx,o=rx
|
||||
with_items:
|
||||
- /opt/busnet/direwolf
|
||||
- /opt/busnet/direwolf/config
|
||||
- /opt/busnet/direwolf/logs
|
||||
|
||||
- name: Make sure busnet user is in groups for audio and USB access
|
||||
ansible.builtin.user:
|
||||
name: busnet
|
||||
groups: "{{item}}"
|
||||
append: yes
|
||||
with_items:
|
||||
- dialout
|
||||
- pulse-access
|
||||
- audio
|
||||
- plugdev
|
||||
|
||||
###################################################################################################
|
||||
# DIREWOLF CONF
|
||||
###################################################################################################
|
||||
|
||||
- name: Copy Direwolf config for Digirig
|
||||
template:
|
||||
src: "templates/digirig-direwolf.conf.j2"
|
||||
dest: "/opt/busnet/direwolf/config/digirig.conf"
|
||||
owner: busnet
|
||||
group: busnet
|
||||
|
||||
|
||||
###################################################################################################
|
||||
# SYSTEMD
|
||||
###################################################################################################
|
||||
|
||||
# udev rules start this automatically when the radio USB is connected, and stop when disconnected.
|
||||
- name: Install systemd unit file for Direwolf and Digirig USB sound card
|
||||
template:
|
||||
src: "templates/digirig-direwolf.service.j2"
|
||||
dest: "/etc/systemd/system/digirig-direwolf.service"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0644"
|
||||
|
||||
- name: Enable digirig-direwolf service
|
||||
systemd:
|
||||
name: "digirig-direwolf"
|
||||
daemon_reload: true
|
||||
enabled: true
|
||||
|
||||
# socat creates a full duplex/bidirectional pipe between a serial port /dev/radio/digirig-tnc and
|
||||
# Direwolf's KISS TCP interface, which is running on localhost:8001. The kissattach program needs
|
||||
# a serial port to work, and this is how we accomplish connecting kissattach to direwolf.
|
||||
- name: Install systemd unit file for digirig-socat
|
||||
template:
|
||||
src: "templates/digirig-socat.service.j2"
|
||||
dest: "/etc/systemd/system/digirig-socat.service"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0644"
|
||||
|
||||
- name: Enable digirig-socat service
|
||||
systemd:
|
||||
name: "digirig-socat"
|
||||
daemon_reload: true
|
||||
enabled: true
|
||||
|
||||
# This starts after digirig-socat and makes the attachment to the new serial device we just created
|
||||
# with socat! This effectively connects the Linux AX.25 system to direwolf's KISS TCP port.
|
||||
- name: Install systemd unit file for digirig-kissattach
|
||||
template:
|
||||
src: "templates/digirig-kissattach.service.j2"
|
||||
dest: "/etc/systemd/system/digirig-kissattach.service"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0644"
|
||||
|
||||
- name: Enable digirig-kissattach service
|
||||
systemd:
|
||||
name: "digirig-kissattach"
|
||||
daemon_reload: true
|
||||
enabled: true
|
||||
|
||||
|
||||
###################################################################################################
|
||||
# UDEV RULES
|
||||
###################################################################################################
|
||||
|
||||
- name: Copy udev rules for the Digirig USB sound card
|
||||
template:
|
||||
src: templates/98-digirig-udev.rules.j2
|
||||
dest: /etc/udev/rules.d/98-digirig-udev.rules
|
||||
owner: root
|
||||
group: root
|
||||
register: digirig_udev_result
|
||||
|
||||
- name: Reload udev rules
|
||||
ansible.builtin.command:
|
||||
cmd: "udevadm control --reload"
|
||||
when: digirig_udev_result.changed
|
||||
|
||||
- name: udevadm trigger
|
||||
ansible.builtin.command:
|
||||
cmd: "udevadm trigger"
|
||||
when: digirig_udev_result.changed
|
||||
@@ -0,0 +1,27 @@
|
||||
# udev rule to provide fixed device name for my Digirig and start/stop services automatically!
|
||||
|
||||
# This information was retrieved by the following. Assuming the radio USB sound card is hooked
|
||||
# up to /dev/ttyUSB0
|
||||
#
|
||||
# craig@scanner:~$ udevadm info /dev/ttyUSB0 | grep ID_SERIAL
|
||||
# E: ID_SERIAL=Silicon_Labs_CP2102N_USB_to_UART_Bridge_Controller_809986b5195bed119acbed165820eef3
|
||||
# E: ID_SERIAL_SHORT=809986b5195bed119acbed165820eef3
|
||||
#
|
||||
|
||||
|
||||
# This creates /dev/radio/digirig-sound which is a USB sound card device
|
||||
# It does not matter what USB port it's plugged into, or how many other USB devices are also plugged in.
|
||||
# ---------------------------------------------------------------------------------------------------
|
||||
SUBSYSTEM=="tty", ENV{ID_SERIAL_SHORT}=="809986b5195bed119acbed165820eef3", SYMLINK+="radio/digirig-sound", MODE="660", GROUP="plugdev"
|
||||
|
||||
|
||||
# Automatically start direwolf when the radio is connected. Identify the radio by the
|
||||
# unique setial number.
|
||||
# - This direwolf instance is only for this radio.
|
||||
# ---------------------------------------------------------------------------------------------------
|
||||
ACTION=="add", SUBSYSTEM=="tty", ENV{ID_SERIAL_SHORT}=="809986b5195bed119acbed165820eef3", TAG+="systemd" ENV{SYSTEMD_WANTS}+="digirig-direwolf.service"
|
||||
|
||||
|
||||
# Automatically stop direwolf when the radio is connected.
|
||||
# ---------------------------------------------------------------------------------------------------
|
||||
ACTION=="remove", SUBSYSTEM=="tty", ENV{ID_SERIAL_SHORT}=="809986b5195bed119acbed165820eef3",TAG+="systemd" ENV{SYSTEMD_WANTS}-="digirig-direwolf.service"
|
||||
@@ -0,0 +1,24 @@
|
||||
# This file is managed by BusNet Ansible
|
||||
#
|
||||
# This is the Direwolf configuration for connecting Direwolf to the Digirig USB sound card.
|
||||
#
|
||||
# There us a udev rule which creates "/dev/radio/digirig-sound" so that we do not have to worry about
|
||||
# what USB port or tty number is assigned when this device is connected to the computer.
|
||||
|
||||
ADEVICE plughw:Device,0
|
||||
|
||||
# The custom udev rule makes this device available by name.
|
||||
PTT /dev/radio/digirig-sound RTS
|
||||
|
||||
MYCALL K0BIT
|
||||
|
||||
MODEM 1200
|
||||
|
||||
# Enable FX.25 with fallback to regular AX.25
|
||||
FX25TX 1
|
||||
|
||||
AGWPORT 8000
|
||||
KISSPORT 8001
|
||||
|
||||
# In the future, I might set up a RV BBS! I would beacon it here.
|
||||
#PBEACON every=1 overlay=S symbol="bus" lat=29.958260914551104 long=-90.05442788530239 comment="I'm like testing APRS, man" via=WIDE1-1,WIDE2-1
|
||||
@@ -0,0 +1,24 @@
|
||||
# This file is managed by BusNet Ansible.
|
||||
#
|
||||
# This service starts Direwolf when the Digirig device is connected to this computer.
|
||||
#
|
||||
# There is a corresponding udev rule that triggers this service automatically when it detects that
|
||||
# the radio's USB devices are connected. There is also a udev rule that shuts it down when the USB
|
||||
# is disconnected.
|
||||
|
||||
[Unit]
|
||||
Description=Direwolf TNC for Digirig
|
||||
|
||||
# Automatically start these other services to complete the Linux AX25 stack.
|
||||
Requires=digirig-socat.service
|
||||
Requires=digirig-kissattach.service
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/local/bin/direwolf -q hdx -t 0 -X 1 -c /opt/busnet/direwolf/config/digirig.conf
|
||||
Restart=on-failure
|
||||
RestartSec=5
|
||||
User=busnet
|
||||
Group=busnet
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -0,0 +1,26 @@
|
||||
[Unit]
|
||||
Description=AX.25 Interface Setup via kissattach for Digirig
|
||||
|
||||
# We must start AFTER the socat service has created the virtual TNC link.
|
||||
#Requires=digirig-socat.service
|
||||
After=digirig-socat.service
|
||||
|
||||
[Service]
|
||||
Type=Forking # kissattach will fork itself and run as a daemon in the background
|
||||
User=root
|
||||
Restart=always
|
||||
RestartSec=10s
|
||||
|
||||
# Wait 6 seconds to give both direwolf and socat time to start.
|
||||
ExecStartPre=/bin/sleep 6
|
||||
|
||||
# This PTY is created by the digirg-socat service, which is a pipe between this device and
|
||||
# Direwolf's KISS port for the digirig. Kissattach cannot use KISS over TCP directly to Direwolf
|
||||
# so it needs the extra step of using socat.
|
||||
ExecStart=/usr/sbin/kissattach /dev/radio/digirig-tnc digirig
|
||||
|
||||
# We must do this because it forked itself.
|
||||
ExecStop=/usr/bin/pkill -f 'kissattach /dev/radio/digirig-tnc digirig'
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -0,0 +1,22 @@
|
||||
[Unit]
|
||||
Description=SOCAT Virtual Serial Port Bridge to Digirig Direwolf
|
||||
|
||||
# This ensures socat only starts AFTER the main Dire Wolf service is active.
|
||||
#Requires=digirig-direwolf.service
|
||||
After=digirig-direwolf.service
|
||||
|
||||
[Service]
|
||||
User=root
|
||||
Restart=always
|
||||
RestartSec=5s
|
||||
|
||||
# Wait 3 seconds to give Direwolf time to start.
|
||||
ExecStartPre=/bin/sleep 3
|
||||
|
||||
# socat creates a full duplex/bidirectional pipe between a serial port /dev/radio/digirig-tnc and
|
||||
# Direwolf's KISS TCP interface, which is running on localhost:8001. The kissattach program needs
|
||||
# a serial port to work, and this is how we accomplish connecting kissattach to direwolf.
|
||||
ExecStart=/usr/bin/socat PTY,raw,echo=0,link=/dev/radio/digirig-tnc TCP4:127.0.0.1:8001
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -30,6 +30,7 @@ show_help()
|
||||
echo
|
||||
echo "scanner.busnet:"
|
||||
echo "---------------------------------------------------------------------------------------------------------------"
|
||||
echo " --scanner-digirig Set up udev rules, AX25, etc for the Digirig connected to the dedicated 2m radio"
|
||||
echo " --scanner-ft991a Set up udev rules, rigctld and direwolf for the Yaesu FT-991a radio"
|
||||
echo " --scanner-pat Install and configure pat winlink client on scanner.busnet"
|
||||
echo " --scanner-hamlib Install and configure direwolf on scanner.busnet"
|
||||
|
||||
Reference in New Issue
Block a user