Commit 228197f6 authored by Karel Hanák's avatar Karel Hanák

Debian package: additional UART and GWID postinst actions

Signed-off-by: Karel Hanák's avatarKarel Hanák <karel.hanak@microrisc.com>
parent bb2b2b92
......@@ -9,20 +9,20 @@ if [ "$1" = "configure" ]; then
then
gwProduct=$(jq -r '.gwProduct' /etc/iqrf-gateway.json)
if [[ $gwProduct == "IQD-GW-01" || $gwProduct == "IQD-GW-01A" || $gwProduct == "IQD-GW-01B" ]]; then
gwId=$(jq -r '.gwId' /etc/iqrf-gateway.json)
gwId=$(jq -r '.gwId' /etc/iqrf-gateway.json | awk '{print tolower($0)}')
if [[ $gwProduct == "IQD-GW-01" || $gwProduct == "IQD-GW-01A" ]]; then
if [ -f "${confDir}iqrf__IqrfSpi.json" ]; then
jq --unbuffered '.instance = "iqrf::IqrfSpi-/dev/spidev1.0" | .IqrfInterface = "/dev/spidev1.0" | .powerEnableGpioPin = 19 | .busEnableGpioPin = 10 | .pgmSwitchGpioPin = 3' "${confDir}iqrf__IqrfSpi.json" > tmp.json && mv tmp.json "${confDir}iqrf__IqrfSpi.json"
fi
if [ -f "${confDir}iqrf__IqrfUart.json" ]; then
jq --unbuffered '.instance = "iqrf::IqrfUart-/dev/ttyS1" | .IqrfInterface = "/dev/ttyS1" | .powerEnableGpioPin = 19 | .busEnableGpioPin = 10 | .pgmSwitchGpioPin = -1 | .+ {spiReset: false}' "${confDir}iqrf__IqrfUart.json" > tmp.json && mv tmp.json "${confDir}iqrf__IqrfUart.json"
jq --unbuffered '.instance = "iqrf::IqrfUart-/dev/ttyS1" | .IqrfInterface = "/dev/ttyS1" | .powerEnableGpioPin = 19 | .busEnableGpioPin = 10 | .pgmSwitchGpioPin = -1 | .+ {uartReset: true}' "${confDir}iqrf__IqrfUart.json" > tmp.json && mv tmp.json "${confDir}iqrf__IqrfUart.json"
fi
elif [[ $gwProduct == "IQD-GW-01B" ]]; then
if [ -f "${confDir}iqrf__IqrfSpi.json" ]; then
jq --unbuffered '.instance = "iqrf::IqrfSpi-/dev/spidev1.0" | .IqrfInterface = "/dev/spidev1.0" | .powerEnableGpioPin = 19 | .busEnableGpioPin = -1 | .pgmSwitchGpioPin = 3 | .+ {spiEnableGpioPin: 10, uartEnableGpioPin: 6, i2cEnableGpioPin: 7}' "${confDir}iqrf__IqrfSpi.json" > tmp.json && mv tmp.json "${confDir}iqrf__IqrfSpi.json"
fi
if [ -f "${confDir}iqrf__IqrfUart.json" ]; then
jq --unbuffered '.instance = "iqrf::IqrfUart-/dev/ttyS1" | .IqrfInterface = "/dev/ttyS1" | .powerEnableGpioPin = 19 | .busEnableGpioPin = -1 | .pgmSwitchGpioPin = -1 | .+ {uartEnableGpioPin: 6, spiEnableGpioPin: 10, i2cEnableGpioPin: 7, uartReset: true,}' "${confDir}iqrf__IqrfUart.json" > tmp.json && mv tmp.json "${confDir}iqrf__IqrfUart.json"
jq --unbuffered '.instance = "iqrf::IqrfUart-/dev/ttyS1" | .IqrfInterface = "/dev/ttyS1" | .powerEnableGpioPin = 19 | .busEnableGpioPin = -1 | .pgmSwitchGpioPin = -1 | .+ {uartEnableGpioPin: 6, spiEnableGpioPin: 10, i2cEnableGpioPin: 7, uartReset: true}' "${confDir}iqrf__IqrfUart.json" > tmp.json && mv tmp.json "${confDir}iqrf__IqrfUart.json"
fi
fi
if [ -f "${confDir}iqrf__JsonSplitter.json" ]; then
......
......@@ -38,20 +38,20 @@ configure_gateway() {
then
gwProduct=$(jq -r '.gwProduct' /etc/iqrf-gateway.json)
if [[ $gwProduct == "IQD-GW-01" || $gwProduct == "IQD-GW-01A" || $gwProduct == "IQD-GW-01B" ]]; then
gwId=$(jq -r '.gwId' /etc/iqrf-gateway.json)
gwId=$(jq -r '.gwId' /etc/iqrf-gateway.json | awk '{print tolower($0)}')
if [[ $gwProduct == "IQD-GW-01" || $gwProduct == "IQD-GW-01A" ]]; then
if [ -f "${confDir}iqrf__IqrfSpi.json" ]; then
jq --unbuffered '.instance = "iqrf::IqrfSpi-/dev/spidev1.0" | .IqrfInterface = "/dev/spidev1.0" | .powerEnableGpioPin = 19 | .busEnableGpioPin = 10 | .pgmSwitchGpioPin = 3' "${confDir}iqrf__IqrfSpi.json" > tmp.json && mv tmp.json "${confDir}iqrf__IqrfSpi.json"
fi
if [ -f "${confDir}iqrf__IqrfUart.json" ]; then
jq --unbuffered '.instance = "iqrf::IqrfUart-/dev/ttyS1" | .IqrfInterface = "/dev/ttyS1" | .powerEnableGpioPin = 19 | .busEnableGpioPin = 10 | .pgmSwitchGpioPin = -1 | .+ {spiReset: false}' "${confDir}iqrf__IqrfUart.json" > tmp.json && mv tmp.json "${confDir}iqrf__IqrfUart.json"
jq --unbuffered '.instance = "iqrf::IqrfUart-/dev/ttyS1" | .IqrfInterface = "/dev/ttyS1" | .powerEnableGpioPin = 19 | .busEnableGpioPin = 10 | .pgmSwitchGpioPin = -1 | .+ {uartReset: true}' "${confDir}iqrf__IqrfUart.json" > tmp.json && mv tmp.json "${confDir}iqrf__IqrfUart.json"
fi
elif [[ $gwProduct == "IQD-GW-01B" ]]; then
if [ -f "${confDir}iqrf__IqrfSpi.json" ]; then
jq --unbuffered '.instance = "iqrf::IqrfSpi-/dev/spidev1.0" | .IqrfInterface = "/dev/spidev1.0" | .powerEnableGpioPin = 19 | .busEnableGpioPin = -1 | .pgmSwitchGpioPin = 3 | .+ {spiEnableGpioPin: 10, uartEnableGpioPin: 6, i2cEnableGpioPin: 7}' "${confDir}iqrf__IqrfSpi.json" > tmp.json && mv tmp.json "${confDir}iqrf__IqrfSpi.json"
fi
if [ -f "${confDir}iqrf__IqrfUart.json" ]; then
jq --unbuffered '.instance = "iqrf::IqrfUart-/dev/ttyS1" | .IqrfInterface = "/dev/ttyS1" | .powerEnableGpioPin = 19 | .busEnableGpioPin = -1 | .pgmSwitchGpioPin = -1 | .+ {uartEnableGpioPin: 6, spiEnableGpioPin: 10, i2cEnableGpioPin: 7, uartReset: true,}' "${confDir}iqrf__IqrfUart.json" > tmp.json && mv tmp.json "${confDir}iqrf__IqrfUart.json"
jq --unbuffered '.instance = "iqrf::IqrfUart-/dev/ttyS1" | .IqrfInterface = "/dev/ttyS1" | .powerEnableGpioPin = 19 | .busEnableGpioPin = -1 | .pgmSwitchGpioPin = -1 | .+ {uartEnableGpioPin: 6, spiEnableGpioPin: 10, i2cEnableGpioPin: 7, uartReset: true}' "${confDir}iqrf__IqrfUart.json" > tmp.json && mv tmp.json "${confDir}iqrf__IqrfUart.json"
fi
fi
if [ -f "${confDir}iqrf__JsonSplitter.json" ]; then
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment