mirror of
https://github.com/thetechprepper/emcomm-tools-os-community.git
synced 2026-09-17 15:41:44 -04:00
modem73 - Changed the command line interface to support only the mode and optional --headless argument
This commit is contained in:
@@ -13,49 +13,56 @@
|
|||||||
MODEM73_CONF_FILE="${HOME}/.config/modem73/settings"
|
MODEM73_CONF_FILE="${HOME}/.config/modem73/settings"
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
echo "usage: $(basename $0) <command> <type>"
|
echo "usage: $(basename $0) <mode> [options]"
|
||||||
echo " <command>"
|
echo " <mode>"
|
||||||
echo " start - Start modem73 in selected mode"
|
echo " reliability - Max reliability (Slower Speed) [BPSK]"
|
||||||
echo " update-config - Update configuration for selected mode"
|
echo " balanced - Balanced (Reliability and Speed) [QPSK]"
|
||||||
|
echo " speed - Max speed (Lower Reliability) [8PSK]"
|
||||||
echo ""
|
echo ""
|
||||||
echo " <type>"
|
echo " [options]"
|
||||||
echo " default - QPSK, normal frames, 1/2 code rate (recommended)"
|
echo " --headless - Run modem73 headless"
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ $# -ne 2 ]]; then
|
HEADLESS=""
|
||||||
usage
|
MODE=""
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
MODE=$2
|
for arg in "$@"; do
|
||||||
case "${MODE}" in
|
case "$arg" in
|
||||||
default)
|
--headless)
|
||||||
et-log "Configuration updates not yet implemented."
|
HEADLESS="--headless"
|
||||||
;;
|
;;
|
||||||
*)
|
reliability|balanced|speed)
|
||||||
et-log "Can't started modem73. Mode '${MODE}' not supported"
|
if [[ -n "${MODE}" ]]; then
|
||||||
|
et-log "Only one mode may be specified."
|
||||||
|
usage
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
MODE="$arg"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Unknown argument: $arg"
|
||||||
|
usage
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ -z "${MODE}" ]]; then
|
||||||
|
et-log "Can't started modem73. Mode not specified."
|
||||||
usage
|
usage
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
fi
|
||||||
esac
|
|
||||||
|
|
||||||
notify_user() {
|
[[ -z ${ET_LOG_DIR} ]] && ET_LOG_DIR="${HOME}/.local/share/emcomm-tools"
|
||||||
notify-send \
|
[[ ! -e ${ET_LOG_DIR} ]] && mkdir -p ${ET_LOG_DIR}
|
||||||
-t 10000 \
|
|
||||||
--app-name="EmComm Tools" \
|
|
||||||
"$1"
|
|
||||||
}
|
|
||||||
|
|
||||||
[ -z ${ET_LOG_DIR} ] && ET_LOG_DIR="${HOME}/.local/share/emcomm-tools"
|
|
||||||
[ ! -e ${ET_LOG_DIR} ] && mkdir -p ${ET_LOG_DIR}
|
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
update_config
|
update_config
|
||||||
|
|
||||||
if [ $? -eq 0 ]; then
|
if [[ $? -eq 0 ]]; then
|
||||||
|
|
||||||
systemctl is-active --quiet rigctld
|
systemctl is-active --quiet rigctld
|
||||||
if [ $? -ne 0 ]; then
|
if [[ $? -ne 0 ]]; then
|
||||||
et-log "Can't start modem73. rigctld not running. Ensure radio is selected."
|
et-log "Can't start modem73. rigctld not running. Ensure radio is selected."
|
||||||
notify_user "Can't start modem73. rigctld not running."
|
notify_user "Can't start modem73. rigctld not running."
|
||||||
exit 1
|
exit 1
|
||||||
@@ -65,7 +72,7 @@ start() {
|
|||||||
INPUT_AUDIO=$(modem73 --list-audio | grep input | grep $ALSA_DEVICE | cut -d":" -f3)
|
INPUT_AUDIO=$(modem73 --list-audio | grep input | grep $ALSA_DEVICE | cut -d":" -f3)
|
||||||
OUTPUT_AUDIO=$(modem73 --list-audio | grep output| grep $ALSA_DEVICE | cut -d":" -f3)
|
OUTPUT_AUDIO=$(modem73 --list-audio | grep output| grep $ALSA_DEVICE | cut -d":" -f3)
|
||||||
|
|
||||||
CMD="modem73 --input-device ${INPUT_AUDIO} --output-device ${OUTPUT_AUDIO} --ptt rigctl --headless"
|
CMD="modem73 --input-device ${INPUT_AUDIO} --output-device ${OUTPUT_AUDIO} --ptt rigctl ${HEADLESS}"
|
||||||
et-log "Starting modem73 with: '${CMD}'"
|
et-log "Starting modem73 with: '${CMD}'"
|
||||||
echo
|
echo
|
||||||
${CMD}
|
${CMD}
|
||||||
@@ -114,16 +121,4 @@ update_config () {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
case $1 in
|
start
|
||||||
start)
|
|
||||||
start
|
|
||||||
;;
|
|
||||||
update-config)
|
|
||||||
update_config
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "Invalid command."
|
|
||||||
usage
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|||||||
Reference in New Issue
Block a user