Skip to content

Commit

Permalink
Merge pull request #6 from lnls-sirius/master
Browse files Browse the repository at this point in the history
procServ unix socket fallback
  • Loading branch information
edupcoelho authored Oct 13, 2022
2 parents e7b4ab0 + 189312c commit 1cde11f
Show file tree
Hide file tree
Showing 26 changed files with 49 additions and 715 deletions.
10 changes: 2 additions & 8 deletions install/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,12 @@ INSTALL_PREFIX ?= /opt/epics/startup/ioc
export IOC_NAME
export INSTALL_PREFIX

install: scripts_install
install:
$(TOP)/install/install.sh ${INSTALL_PREFIX}/${IOC_NAME} $(TOP)

uninstall: scripts_uninstall
uninstall:
$(TOP)/install/uninstall.sh ${INSTALL_PREFIX}/${IOC_NAME} $(TOP)

scripts_install:
$(MAKE) -C ${SCRIPTS_FOLDER} install

scripts_uninstall:
$(MAKE) -C ${SCRIPTS_FOLDER} uninstall

realuninstall: uninstall

clean:
Expand Down
9 changes: 0 additions & 9 deletions iocBoot/ioctiming/README

This file was deleted.

27 changes: 6 additions & 21 deletions iocBoot/ioctiming/event_alias.cmd
Original file line number Diff line number Diff line change
@@ -1,21 +1,6 @@
########################################################################################
##### This file was generated automatically by $(TOP)/scripts/setup/event_alias.py #####
##### DO NOT DELETE OR MODIFY IT #####
########################################################################################

dbLoadRecords "${TOP}/db/HLEvents.db","P=${P}, R=${R}, num=0, alias='Linac', code='01'"
dbLoadRecords "${TOP}/db/HLEvents.db","P=${P}, R=${R}, num=1, alias='InjBO', code='02'"
dbLoadRecords "${TOP}/db/HLEvents.db","P=${P}, R=${R}, num=2, alias='InjSI', code='03'"
dbLoadRecords "${TOP}/db/HLEvents.db","P=${P}, R=${R}, num=3, alias='RmpBO', code='04'"
dbLoadRecords "${TOP}/db/HLEvents.db","P=${P}, R=${R}, num=4, alias='MigSI', code='05'"
dbLoadRecords "${TOP}/db/HLEvents.db","P=${P}, R=${R}, num=5, alias='DigLI', code='06'"
dbLoadRecords "${TOP}/db/HLEvents.db","P=${P}, R=${R}, num=6, alias='DigTB', code='07'"
dbLoadRecords "${TOP}/db/HLEvents.db","P=${P}, R=${R}, num=7, alias='DigBO', code='08'"
dbLoadRecords "${TOP}/db/HLEvents.db","P=${P}, R=${R}, num=8, alias='DigTS', code='09'"
dbLoadRecords "${TOP}/db/HLEvents.db","P=${P}, R=${R}, num=9, alias='DigSI', code='10'"
dbLoadRecords "${TOP}/db/HLEvents.db","P=${P}, R=${R}, num=10, alias='OrbSI', code='11'"
dbLoadRecords "${TOP}/db/HLEvents.db","P=${P}, R=${R}, num=11, alias='CplSI', code='12'"
dbLoadRecords "${TOP}/db/HLEvents.db","P=${P}, R=${R}, num=12, alias='TunSI', code='13'"
dbLoadRecords "${TOP}/db/HLEvents.db","P=${P}, R=${R}, num=13, alias='Study', code='14'"
dbLoadRecords "${TOP}/db/HLEvents.db","P=${P}, R=${R}, num=14, alias='OrbBO', code='15'"
dbLoadRecords "${TOP}/db/HLEvents.db","P=${P}, R=${R}, num=15, alias='Cycle', code='16'"
#############################################################################
##### This file content is automatically generated by ./event_alias.py #####
##### at IOC startup based on High-Level Events #####
##### #####
##### DO NOT DELETE OR MODIFY IT #####
#############################################################################
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import urllib.request as _urllib_request
import ast
import sys

import os

if (len(sys.argv) == 1):
URL = 'http://10.0.38.42/control-system-constants/timesys/high-level-events.py'
Expand Down Expand Up @@ -39,12 +39,15 @@ def HLEvt_to_LLEvt(HLEvents):

HLEvents = ast.literal_eval(high_level_events(URL))

f = open('../../iocBoot/ioctiming/event_alias.cmd', 'w')
ioc_run_path = os.path.join(os.path.dirname(os.path.abspath(__file__)))
f = open(os.path.join(ioc_run_path,'event_alias.cmd'), 'w')

f.write('########################################################################################\n')
f.write('##### This file was generated automatically by $(TOP)/scripts/setup/event_alias.py #####\n')
f.write('##### DO NOT DELETE OR MODIFY IT #####\n')
f.write('########################################################################################\n\n')
f.write('#############################################################################\n')
f.write('##### This file content is automatically generated by ./event_alias.py #####\n')
f.write('##### at IOC startup based on High-Level Events #####\n')
f.write('##### #####\n')
f.write('##### DO NOT DELETE OR MODIFY IT #####\n')
f.write('#############################################################################\n\n')

if ('Error' in HLEvents):
f.write('# Error reading url "' + URL + '"!')
Expand All @@ -62,4 +65,3 @@ def HLEvt_to_LLEvt(HLEvents):
f.write('dbLoadRecords ' + chr(34) + "${TOP}/db/HLEvents.db" + chr(34) + "," + chr(34) + "P=${P}, R=${R}, num=" + str(i) + ", alias='" + evt_alias[evt_name] + "', code='" + evt_code + "'" + chr(34) + '\n')

f.close()

6 changes: 4 additions & 2 deletions iocBoot/ioctiming/parseCMDOpts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -e

usage () {
echo "Usage:" >&2
echo " $1 -t PROCSERV_TELNET_PORT [-P P_VAL] [-R R_VAL] -i IPADDR -p IPPORT -d DEVICE " >&2
echo " $1 -t PROCSERV_TELNET_PORT [-P P_VAL] [-R R_VAL] [-L HL_EVENTS_LINK] -i IPADDR -p IPPORT -d DEVICE" >&2
echo >&2
echo " Options:" >&2
echo " -t Configure procServ telnet port" >&2
Expand All @@ -13,16 +13,18 @@ usage () {
echo " -i Configure IP address to connect to device" >&2
echo " -p Configure IP port number to connect to device" >&2
echo " -d Configure Sinap Timing device type [EVG<number>|EVR<number>|EVE<number>|FOUT<number>]" >&2
echo " -l Configure High-level events link to load at EVG" >&2
}

while getopts ":t:P:R:i:p:d:" opt; do
while getopts ":t:P:R:i:p:d:l:" opt; do
case $opt in
t) DEVICE_TELNET_PORT="$OPTARG" ;;
P) P="$OPTARG" ;;
R) R="$OPTARG" ;;
i) IPADDR="$OPTARG" ;;
p) IPPORT="$OPTARG" ;;
d) DEVICE_TYPE="$OPTARG" ;;
l) HIGH_LEVEL_LINK="$OPTARG" ;;
\?)
echo "Invalid option: -$OPTARG" >&2
usage $0
Expand Down
27 changes: 0 additions & 27 deletions iocBoot/ioctiming/runEVE.sh

This file was deleted.

27 changes: 0 additions & 27 deletions iocBoot/ioctiming/runEVG.sh

This file was deleted.

27 changes: 0 additions & 27 deletions iocBoot/ioctiming/runEVR.sh

This file was deleted.

27 changes: 0 additions & 27 deletions iocBoot/ioctiming/runFOUT.sh

This file was deleted.

6 changes: 6 additions & 0 deletions iocBoot/ioctiming/runGenericModule.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ fi
case ${TIMING_TYPE} in
EVG)
ST_CMD_FILE=stEVG.cmd
echo "EVG Device: running event_alias.py to generate high-level events alias"
if [ -z "$HIGH_LEVEL_LINK" ]; then
/usr/bin/python3 event_alias.py
else
/usr/bin/python3 event_alias.py ${HIGH_LEVEL_LINK}
fi
;;

EVR)
Expand Down
9 changes: 7 additions & 2 deletions iocBoot/ioctiming/runProcServ.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ set +u
. ./parseCMDOpts.sh "$@"

# Use defaults if not set
UNIX_SOCKET=""
if [ -z "${DEVICE_TELNET_PORT}" ]; then
DEVICE_TELNET_PORT="20000"
UNIX_SOCKET="true"
fi

if [ -z "${DEVICE_TYPE}" ]; then
Expand All @@ -18,4 +19,8 @@ fi
set -u

# Run run*.sh scripts with procServ
/usr/local/bin/procServ -f -n TIMING_${DEVICE_TYPE} -i ^C^D ${DEVICE_TELNET_PORT} ./runGenericModule.sh "$@"
if [ "${UNIX_SOCKET}" ]; then
/usr/local/bin/procServ -f -n TIMING_${DEVICE_TYPE} -i ^C^D unix:./procserv.sock ./runGenericModule.sh "$@"
else
/usr/local/bin/procServ -f -n TIMING_${DEVICE_TYPE} -i ^C^D ${DEVICE_TELNET_PORT} ./runGenericModule.sh "$@"
fi
Loading

0 comments on commit 1cde11f

Please sign in to comment.