n810: Add firmware generator hotplug scripts
[openwrt.git] / package / linux-atm / files / br2684ctl
1 #!/bin/sh /etc/rc.common
2 START=50
3
4 start_daemon() {
5 local cfg="$1"
6
7 local atmdev
8 config_get atmdev "$cfg" atmdev 0
9
10 local unit
11 config_get unit "$cfg" unit 0
12
13 local vpi
14 config_get vpi "$cfg" vpi 8
15
16 local vci
17 config_get vci "$cfg" vci 35
18
19 local encaps
20 config_get encaps "$cfg" encaps
21
22 case "$encaps" in
23 1|vc) encaps=1;;
24 *) encaps=0;;
25 esac
26
27 local payload
28 config_get payload "$cfg" payload
29
30 case "$payload" in
31 0|routed) payload=0;;
32 *) payload=1;;
33 esac
34
35 local qos
36 config_get qos "$cfg" qos
37
38 local circuit="$atmdev.$vpi.$vci"
39 local pid="/var/run/br2684ctl-$circuit.pid"
40
41 start-stop-daemon -S -b -x /usr/sbin/br2684ctl -m -p "$pid" -- \
42 -c "$unit" -e "$encaps" -p "$payload" \
43 -a "$circuit" ${qos:+-q "$qos"}
44 }
45
46 start() {
47 insmod br2684 >/dev/null 2>/dev/null
48 config_load network
49 config_foreach start_daemon atm-bridge
50 }
51
52 stop() {
53 local pid
54 for pid in /var/run/br2684ctl-*.pid; do
55 if [ -f "$pid" ]; then
56 service_kill br2684ctl "$pid"
57 rm -f "$pid"
58 fi
59 done
60 }
This page took 0.079988 seconds and 5 git commands to generate.