Root/package/owsip/files/telephony.init

1#!/bin/sh /etc/rc.common
2START=80
3
4SERVICE_WRITE_PID=1
5SERVICE_DAEMONIZE=1
6SERVICE_PID_FILE=/var/run/owsip.pid
7
8. /lib/functions.sh
9
10relay_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
25start() {
26    config_load telephony
27    config_foreach relay_set relay
28    service_start /usr/bin/owsip_ua
29}
30
31stop() {
32    service_stop /usr/bin/owsip_ua
33}
34

Archive Download this file



interactive