diff --git a/ChangeLog b/ChangeLog index ff8e589c..3b07f01d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -18772,3 +18772,5 @@ * Refactored logging system to use syslog(3) exclusively. * Removed the 'Facility=', 'LogDirectory=', 'CoreDumpDirectory=' and 'LogPattern=' directives from rd.conf(5). +2019-06-17 Fred Gleason + * Removed the sas_shim(1) utility. diff --git a/configure.ac b/configure.ac index 26a04ed7..ef9a8f3c 100644 --- a/configure.ac +++ b/configure.ac @@ -573,7 +573,6 @@ AC_CONFIG_FILES([rivendell.spec \ utils/rdselect_helper/Makefile \ utils/rdsoftkeys/Makefile \ utils/rmlsend/Makefile \ - utils/sas_shim/Makefile \ xdg/Makefile \ xdg/rdalsaconfig-root-consolehelper \ xdg/rddbconfig-root-consolehelper \ diff --git a/rivendell.spec.in b/rivendell.spec.in index 8a8340bb..a690342a 100644 --- a/rivendell.spec.in +++ b/rivendell.spec.in @@ -134,7 +134,6 @@ cp CODINGSTYLE $RPM_BUILD_ROOT/@DOC_PATH@/ cp conf/*.conf $RPM_BUILD_ROOT/@DOC_PATH@/ cp conf/rd.conf-sample $RPM_BUILD_ROOT/@DOC_PATH@/ cp conf/asound.conf-sample $RPM_BUILD_ROOT/@DOC_PATH@/ -cp utils/sas_shim/rc.sas_shim $RPM_BUILD_ROOT/@DOC_PATH@/ mkdir -p $RPM_BUILD_ROOT/@DOC_PATH@/misc cp docs/misc/colors $RPM_BUILD_ROOT/@DOC_PATH@/misc/ cp docs/misc/reports.txt $RPM_BUILD_ROOT/@DOC_PATH@/misc/ @@ -403,7 +402,6 @@ rm -rf $RPM_BUILD_ROOT @LOCAL_PREFIX@/sbin/rdrepld @LOCAL_PREFIX@/sbin/rdpadd @LOCAL_PREFIX@/sbin/rdpadengined -@LOCAL_PREFIX@/sbin/sas_shim @LOCAL_PREFIX@/sbin/rdmarkerset @LOCAL_PREFIX@/sbin/rdcleandirs @LOCAL_PREFIX@/sbin/rddbmgr diff --git a/utils/Makefile.am b/utils/Makefile.am index e6cb45fd..2e0f42ca 100644 --- a/utils/Makefile.am +++ b/utils/Makefile.am @@ -46,8 +46,7 @@ SUBDIRS = $(ALSACONFIG_RD_OPT)\ rdrender\ rdselect_helper\ rdsoftkeys\ - rmlsend\ - sas_shim + rmlsend AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -DQTDIR=\"@QT_DIR@\" @QT_CXXFLAGS@ -I$(top_srcdir)/lib LIBS = @QT_LIBS@ -L$(top_srcdir)/lib diff --git a/utils/sas_shim/Makefile.am b/utils/sas_shim/Makefile.am deleted file mode 100644 index d1a7b4e0..00000000 --- a/utils/sas_shim/Makefile.am +++ /dev/null @@ -1,48 +0,0 @@ -## Makefile.am -## -## (C) Copyright 2002-2006,2016-2018 Fred Gleason -## -## This program is free software; you can redistribute it and/or modify -## it under the terms of the GNU General Public License version 2 as -## published by the Free Software Foundation. -## -## This program is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public -## License along with this program; if not, write to the Free Software -## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -## -## Use automake to process this into a Makefile.in - -AM_CPPFLAGS = -Wall -DPREFIX=\"$(prefix)\" -I$(top_srcdir)/lib @QT4_CFLAGS@ -DQT3_SUPPORT -I/usr/include/Qt3Support -LIBS = -L$(top_srcdir)/lib -MOC = @QT_MOC@ - -# The dependency for qt's Meta Object Compiler (moc) -moc_%.cpp: %.h - $(MOC) $< -o $@ - -sbin_PROGRAMS = sas_shim - -dist_sas_shim_SOURCES = sas_shim.cpp sas_shim.h - -nodist_sas_shim_SOURCES = moc_sas_shim.cpp - -sas_shim_LDADD = @LIB_RDLIBS@ @LIBVORBIS@ @QT4_LIBS@ -lQt3Support - -EXTRA_DIST = rc.sas_shim - -CLEANFILES = *~\ - *.idb\ - *ilk\ - *.obj\ - *.pdb\ - *.qm\ - moc_* - -MAINTAINERCLEANFILES = *~\ - Makefile.in\ - moc_* diff --git a/utils/sas_shim/rc.sas_shim b/utils/sas_shim/rc.sas_shim deleted file mode 100755 index 7b06d385..00000000 --- a/utils/sas_shim/rc.sas_shim +++ /dev/null @@ -1,157 +0,0 @@ -#! /bin/sh -# -# Startup script for the sas_shim Daemon -# (C) Copyright 2003-2004,2016 Fred Gleason -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 2 as -# published by the Free Software Foundation. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public -# License along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# - -### BEGIN INIT INFO -# Provides: sas_shim -# Required-Start: $remote_fs mysql rivendell -# Required-Stop: $remote_fs -# Default-Start: 2 3 5 -# Default-Stop: 0 1 6 -# Description: Start the SAS Shim Daemon -### END INIT INFO - -. /lib/lsb/init-functions - -# -# Package Definitions -# -PACKAGE_BIN=/usr/local/sbin/sas_shim -PACKAGE_CONFIG=/etc/rd.conf -PACKAGE_PID=/var/run/sas_shim.pid -PACKAGE_NAME="SAS Shim Daemon" - -# Check for missing binaries -if [ ! -x $PACKAGE_BIN ] ; then - echo "$PACKAGE_BIN not installed" - exit 5 -fi - -# Check for existence of needed config file and read it -if [ ! -r $PACKAGE_CONFIG ] ; then - echo "Missing $PACKAGE_CONFIG" - exit 6} -fi - -case "$1" in - start) - if test ! -f $PACKAGE_PID ; then - $PACKAGE_BIN - sleep 1 - else - if test ! -d /proc/`cat $PACKAGE_PID` ; then - $PACKAGE_BIN - sleep 1 - fi - fi - if test -f $PACKAGE_PID ; then - if test -d /proc/`cat $PACKAGE_PID` ; then - log_success_msg "Starting $PACKAGE_NAME" - exit 0 - else - log_failure_msg "Starting $PACKAGE_NAME" - exit 1 - fi - else - log_failure_msg "Starting $PACKAGE_NAME" - exit 1 - fi - ;; - stop) - if test -f $PACKAGE_PID ; then - if test -d /proc/`cat $PACKAGE_PID` ; then - kill `cat $PACKAGE_PID` 2> /dev/null - sleep 1 - fi - fi - if test -f $PACKAGE_PID ; then - if test -d /proc/`cat $PACKAGE_PID` ; then - log_failure_msg "Shutting down $PACKAGE_NAME" - exit 1 - else - log_success_msg "Shutting down $PACKAGE_NAME" - exit 0 - fi - else - log_success_msg "Shutting down $PACKAGE_NAME" - exit 0 - fi - ;; - restart) - if test -f $PACKAGE_PID ; then - if test -d /proc/`cat $PACKAGE_PID` ; then - kill `cat $PACKAGE_PID` - sleep 1 - fi - fi - $PACKAGE_BIN - sleep 1 - if test -f $PACKAGE_PID ; then - if test -d /proc/`cat $PACKAGE_PID` ; then - log_success_msg "Restarting $PACKAGE_NAME" - exit 0 - else - log_success_msg "Restarting $PACKAGE_NAME" - exit 1 - fi - else - echo "failed." - exit 1 - fi - ;; - force-reload) - if test -f $PACKAGE_PID ; then - if test -d /proc/`cat $PACKAGE_PID` ; then - kill `cat $PACKAGE_PID` - sleep 1 - fi - fi - $PACKAGE_BIN - sleep 1 - if test -f $PACKAGE_PID ; then - if test -d /proc/`cat $PACKAGE_PID` ; then - log_success_msg "Reloading $PACKAGE_NAME" - exit 0 - else - log_failure_msg "Restarting $PACKAGE_NAME" - exit 1 - fi - else - log_failure_msg "Restarting $PACKAGE_NAME" - exit 1 - fi - ;; - status) - echo -n "Checking for $PACKAGE_NAME..." - if test -f $PACKAGE_PID ; then - if test -d /proc/`cat $PACKAGE_PID` ; then - echo "running." - exit 0 - else - echo "stale PID file." - exit 1 - fi - else - echo "stopped." - exit 3 - fi - ;; -esac - - -# End of rc.sas_shim diff --git a/utils/sas_shim/sas_shim.cpp b/utils/sas_shim/sas_shim.cpp deleted file mode 100644 index 30998073..00000000 --- a/utils/sas_shim/sas_shim.cpp +++ /dev/null @@ -1,218 +0,0 @@ -// sas_shim.cpp -// -// An RDCatch event import shim for the SAS64000 -// -// (C) Copyright 2002-2004,2016-2018 Fred Gleason -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License version 2 as -// published by the Free Software Foundation. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public -// License along with this program; if not, write to the Free Software -// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -// - -#include -#include -#include -#include - -#include -#include - -#include -#include -#include - -#include "sas_shim.h" - -void SigHandler(int signo) -{ - switch(signo) { - case SIGTERM: - unlink("/var/run/sas_shim.pid"); - exit(0); - break; - } -} - - -MainObject::MainObject(QObject *parent) - : QObject(parent) -{ - QString err_msg; - - // - // Open the Database - // - rda=new RDApplication("sas_shim","sas_shim",SAS_SHIM_USAGE,this); - if(!rda->open(&err_msg)) { - fprintf(stderr,"sas_shim: %s\n",(const char *)err_msg); - exit(1); - } - - // - // Read Command Options - // - for(unsigned i=0;icmdSwitch()->keys();i++) { - if(!rda->cmdSwitch()->processed(i)) { - fprintf(stderr,"sas_shim: unknown command option \"%s\"\n", - (const char *)rda->cmdSwitch()->key(i)); - exit(2); - } - } - - // - // Station Configuration - // - shim_address=rda->station()->address(); - - // - // RIPCD Connection - // - rda->ripc()->connectHost("localhost",RIPCD_TCP_PORT,rda->config()->password()); - - // - // TTY Device - // - shim_tty=new RDTTYDevice(); - shim_tty->setName(rda->config()->sasTtyDevice()); - if(!shim_tty->open(QIODevice::ReadOnly)) { - fprintf(stderr,"sas_shim: unabled to open tty device\n"); - exit(1); - } - shim_tty->setSpeed(9600); - shim_tty->setWordLength(8); - shim_tty->setParity(RDTTYDevice::None); - - // - // Poll Timer - // - QTimer *timer=new QTimer(this,"poll_timer"); - connect(timer,SIGNAL(timeout()),this,SLOT(readTtyData())); - timer->start(POLL_INTERVAL); - - // - // Detach - // - RDDetach(""); - FILE *pidfile=fopen("/var/run/sas_shim.pid","w"); - fprintf(pidfile,"%d",getpid()); - fclose(pidfile); - ::signal(SIGTERM,SigHandler); -} - - -void MainObject::readTtyData() -{ - static char cmd[3]; - static int input; - static int output; - static int istate=0; - char buf[256]; - int n; - - while((n=shim_tty->readBlock(buf,255))>0) { - for(int i=0;i='0')&&(buf[i]<='9')) { - cmd[0]=buf[i]; - istate=4; - } - else { - istate=0; - } - break; - - case 4: // Second Input Digit - if((buf[i]>='0')&&(buf[i]<='9')) { - cmd[1]=buf[i]; - cmd[2]=0; - sscanf(cmd,"%d",&input); - istate=5; - } - else { - istate=0; - } - break; - - case 5: // First Output Digit - if((buf[i]>='0')&&(buf[i]<='9')) { - cmd[0]=buf[i]; - istate=6; - } - else { - istate=0; - } - break; - - case 6: // Second Output Digit - if((buf[i]>='0')&&(buf[i]<='9')) { - cmd[1]=buf[i]; - cmd[2]=0; - sscanf(cmd,"%d",&output); - DispatchRml(input,output); - istate=0; - } - else { - istate=0; - } - break; - } - } - } -} - - -void MainObject::DispatchRml(int input,int output) -{ - RDMacro rml; - - rml.setCommand(RDMacro::ST); - rml.setRole(RDMacro::Cmd); - rml.setAddress(shim_address); - rml.setEchoRequested(false); - rml.addArg(rda->config()->sasMatrix()); - rml.addArg(input); - rml.addArg(output); - rda->ripc()->sendRml(&rml); -} - - -int main(int argc,char *argv[]) -{ - QApplication a(argc,argv,false); - new MainObject(); - return a.exec(); -} diff --git a/utils/sas_shim/sas_shim.h b/utils/sas_shim/sas_shim.h deleted file mode 100644 index 1a0c4ea7..00000000 --- a/utils/sas_shim/sas_shim.h +++ /dev/null @@ -1,50 +0,0 @@ -// sas_shim.h -// -// An RDCatch event import shim for the SAS64000 -// -// (C) Copyright 2002-2004,2016-2018 Fred Gleason -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License version 2 as -// published by the Free Software Foundation. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public -// License along with this program; if not, write to the Free Software -// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -// - -#ifndef SAS_SHIM_H -#define SAS_SHIM_H - -#include -#include -#include - -#include - -#define SAS_SHIM_USAGE "\n" -#define POLL_INTERVAL 100 - -class MainObject : public QObject -{ - Q_OBJECT - public: - MainObject(QObject *parent=0); - - private slots: - void readTtyData(); - - private: - void DispatchRml(int input,int output); - QString shim_station; - QHostAddress shim_address; - RDTTYDevice *shim_tty; -}; - - -#endif // SAS_SHIM_H