um-service-config: Added new um-ports. Added differation between old and new um software.

BugzID: 58298

Signed-off-by: Lucien Mueller <lucien.mueller@netmodule.com>
This commit is contained in:
Lucien Mueller 2019-08-19 16:36:55 +02:00
parent 5da0e352b1
commit c17db4a11a
5 changed files with 40 additions and 23 deletions

View File

@ -0,0 +1,6 @@
USER_MODULE_kline_port="2202"
USER_MODULE_lin_port="2200"
USER_MODULE_uart_port="2204"
USER_MODULE_cannellonie_port_remote="20000"
USER_MODULE_cannellonie_port_local="20000"
USER_MODULE_remote_gpio_port="6666"

View File

@ -0,0 +1,7 @@
USER_MODULE_at_cmd_handler_port="7000"
USER_MODULE_kline_port="7050"
USER_MODULE_lin_port="7060"
USER_MODULE_uart_port="7040"
USER_MODULE_cannellonie_port_remote="7010 7011"
USER_MODULE_cannellonie_port_local="7010 7011"
USER_MODULE_remote_gpio_port="7020"

View File

@ -3,7 +3,8 @@
UM_CONFIG_PATH=/etc/user-module
UM_CONFIG_FILE=network.conf
UM_CONFIG=$UM_CONFIG_PATH/$UM_CONFIG_FILE
UM_PORTS=$UM_CONFIG_PATH/ports
UM_PORTS_V1=$UM_CONFIG_PATH/ports-v1
UM_PORTS_V2=$UM_CONFIG_PATH/ports-v2
UM_DTS_NODE=/proc/device-tree/user_module
@ -21,7 +22,16 @@ for f in $UM_DTS_NODE/*; do
echo "USER_MODULE_${f##*/}=\"`cat $f | tr -d '\0' `\"" | sed -E "s/,|-/_/g" >> $UM_CONFIG
done
cat $UM_PORTS >> $UM_CONFIG
source $UM_CONFIG
# Decide which config to load depending on the sw revision
if `nc -z $USER_MODULE_ipv4_addr 7000` ; then
echo "New UM software detected"
cat $UM_PORTS_V2 >> $UM_CONFIG
else
echo "Old UM software detected"
cat $UM_PORTS_V1 >> $UM_CONFIG
fi
# source all fetched informations
source $UM_CONFIG

View File

@ -5,37 +5,27 @@ LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
FILESEXTRAPATHS_prepend := "${THISDIR}/config:"
ALTERNATIVE_PRIORITY[netcat] = "100"
RDEPENDS_${PN} = "netcat"
SRC_URI = " \
file://um-service-config.service \
file://um-service-config.sh \
file://user-module.target \
file://um-service-config.service \
file://um-service-config.sh \
file://user-module.target \
file://um-rgpio-config.sh \
file://um-rgpio-config.service \
file://ports \
"
file://ports-v1 \
file://ports-v2 \
"
FILES_${PN} = "${systemd_unitdir}/system ${bindir} /etc/user-module"
SYSTEMD_SERVICE_${PN} =" \
SYSTEMD_SERVICE_${PN} =" \
um-service-config.service \
um-rgpio-config.service \
user-module.target \
"
do_install_append() {
# port config
echo "USER_MODULE_kline_port=\"2202\"" >> ${WORKDIR}/ports
echo "USER_MODULE_lin_port=\"2200\"" >> ${WORKDIR}/ports
echo "USER_MODULE_uart_port=\"2204\"" >> ${WORKDIR}/ports
echo "USER_MODULE_cannellonie_port_remote=\"20000\"" >> ${WORKDIR}/ports
echo "USER_MODULE_cannellonie_port_local=\"20000\"" >> ${WORKDIR}/ports
echo "USER_MODULE_remote_gpio_port=\"6666\"" >> ${WORKDIR}/ports
install -d ${D}/etc/user-module
install -m 644 ${WORKDIR}/ports ${D}/etc/user-module/ports
}
do_install() {
install -d ${D}${systemd_unitdir}/system
@ -49,10 +39,14 @@ do_install() {
install -d ${D}${bindir}
install -m 744 ${WORKDIR}/um-service-config.sh ${D}${bindir}/um-service-config
install -d ${D}${systemd_unitdir}/system
install -m 644 ${WORKDIR}/um-rgpio-config.service ${D}${systemd_unitdir}/system/
install -d ${D}${bindir}
install -m 744 ${WORKDIR}/um-rgpio-config.sh ${D}${bindir}/um-rgpio-config
install -d ${D}/etc/user-module
install -m 644 ${WORKDIR}/ports-v1 ${D}/etc/user-module/ports-v1
install -m 644 ${WORKDIR}/ports-v2 ${D}/etc/user-module/ports-v2
}