From 2637f4da22c207226229bdb7e81d3a5d63da87a3 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Tue, 3 Mar 2020 22:02:33 +0100 Subject: [PATCH] contrib: Add owhw-event-script.sh for osmo-remsim-client This is a sample event-script that can be used in conjunction with osmo-resim-client to trigger certain board-specific functions such as modem reset on the OWHW. Change-Id: I69f7f9b0c09421b8c14b909627ffe7b9f1acec77 --- contrib/owhw-event-script.sh | 64 ++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100755 contrib/owhw-event-script.sh diff --git a/contrib/owhw-event-script.sh b/contrib/owhw-event-script.sh new file mode 100755 index 0000000..8d4a33f --- /dev/null +++ b/contrib/owhw-event-script.sh @@ -0,0 +1,64 @@ +#!/bin/bash -e + +# Helper script for osmo-remsim-client-st2 on OWHW hardware. It performs the hardware-specific +# functions required by remsim-client. + +# environment variables available: +# REMSIM_CLIENT_VERSION +# REMSIM_SERVER_ADDR +# REMSIM_SERVER_STATE +# REMSIM_BANKD_ADDR +# REMSIM_BANKD_STATE +# REMSIM_CLIENT_SLOT +# REMSIM_BANKD_SLOT +# REMSIM_SIM_VCC +# REMSIM_SIM_RST +# REMSIM_CAUSE +# REMSIM_USB_PATH +# REMSIM_USB_INTERFACE + +CAUSE="$1" + +# derive the modem (1/2) from the USB interface of the SIMTRACE2 firmware (0/1) +case "${REMSIM_USB_INTERFACE}" in + 0) + MODEM=1 + ;; + 1) + MODEM=2 + ;; + *) + echo "Unknown REMSIM_USB_INTERFACE ${REMSIM_USB_INTERFACE}" + exit 1 + ;; +esac + + + +case "${CAUSE}" in + event-server-connect) + ;; + event-bankd-connect) + ;; + event-config-bankd) + ;; + event-modem-status) + ;; + request-card-insert) + echo "Enabling Remote SIM for ${MODEM}" + echo "1" > "/dev/gpio/connect_st_usim${MODEM}/value" + ;; + request-card-remove) + echo "Disabling Remote SIM for ${MODEM}" + echo "0" > "/dev/gpio/connect_st_usim${MODEM}/value" + ;; + request-modem-reset) + echo "Resetting Modem ${MODEM}" + echo "1" > "/dev/gpio/mdm${MODEM}_rst/value" + sleep 1 + echo "0" > "/dev/gpio/mdm${MODEM}_rst/value" + ;; + *) + echo "Unknown CAUSE ${CAUSE}: ignoring" + ;; +esac