| 1 | #!/bin/sh /etc/rc.common |
| 2 | START=80 |
| 3 | |
| 4 | SERVICE_WRITE_PID=1 |
| 5 | SERVICE_DAEMONIZE=1 |
| 6 | SERVICE_PID_FILE=/var/run/owsip.pid |
| 7 | |
| 8 | . /lib/functions.sh |
| 9 | |
| 10 | relay_set () { |
| 11 | local cfg="$1" |
| 12 | local gpio value |
| 13 | |
| 14 | config_get gpio "$cfg" gpio |
| 15 | config_get value "$cfg" value |
| 16 | [ -n "gpio" ] || return 0 |
| 17 | [ ! -f "/sys/class/gpio/gpio$gpio/direction" ] && |
| 18 | echo "$gpio" > /sys/class/gpio/export |
| 19 | [ -f "/sys/class/gpio/gpio$gpio/direction" ] && { |
| 20 | echo "out" > /sys/class/gpio/gpio$gpio/direction |
| 21 | echo "$value" > /sys/class/gpio/gpio$gpio/value |
| 22 | } |
| 23 | } |
| 24 | |
| 25 | start() { |
| 26 | config_load telephony |
| 27 | config_foreach relay_set relay |
| 28 | service_start /usr/bin/owsip_ua |
| 29 | } |
| 30 | |
| 31 | stop() { |
| 32 | service_stop /usr/bin/owsip_ua |
| 33 | } |
| 34 | |