|
27 | 27 | # SIGNAL-handler |
28 | 28 | term_handler() { |
29 | 29 |
|
| 30 | + #remove cifx0 interface from system if created by the container |
| 31 | + if ps -A | grep -q "cifx0daemon" ; then |
| 32 | + killall cifx0deamon |
| 33 | + ip link delete cifx0 |
| 34 | + fi |
| 35 | + |
30 | 36 | if [ -f /etc/init.d/edgegateway ] |
31 | 37 | then |
32 | 38 | echo "Terminating CODESYS Edge Gateway ..." |
|
58 | 64 | #check presence of device spi0.0 and net device register |
59 | 65 | if [[ -e "/dev/spidev0.0" ]]&& [[ -e "/dev/net/tun" ]]; then |
60 | 66 |
|
61 | | - echo "cifx0 hardware support (TCP/IP over RTE LAN ports) configured." |
| 67 | + #check if cifx0 interface is not running already |
| 68 | + if ! ip addr show | grep -q "cifx0" ; then |
62 | 69 |
|
63 | | - #pre-configure GPIO 24 to serve as interrupt pin between netX chip and BCM CPU |
64 | | - if [[ ! -e "/sys/class/gpio/gpio24" ]]; then |
65 | | - echo 24 > /sys/class/gpio/export |
66 | | - fi |
67 | | - echo rising > /sys/class/gpio/gpio24/edge |
68 | | - echo in > /sys/class/gpio/gpio24/direction |
69 | | - echo 1 > /sys/class/gpio/gpio24/active_low |
| 70 | + echo "cifx0 hardware support (TCP/IP over RTE LAN ports) configured." |
| 71 | + |
| 72 | + #pre-configure GPIO 24 to serve as interrupt pin between netX chip and BCM CPU |
| 73 | + if [[ ! -e "/sys/class/gpio/gpio24" ]]; then |
| 74 | + echo 24 > /sys/class/gpio/export |
| 75 | + fi |
| 76 | + echo rising > /sys/class/gpio/gpio24/edge |
| 77 | + echo in > /sys/class/gpio/gpio24/direction |
| 78 | + echo 1 > /sys/class/gpio/gpio24/active_low |
70 | 79 |
|
71 | | - # create netx "cifx0" ethernet network interface |
72 | | - /opt/cifx/cifx0daemon |
| 80 | + # create netx "cifx0" ethernet network interface |
| 81 | + /opt/cifx/cifx0daemon |
73 | 82 |
|
74 | | - # bring interface up first of all |
75 | | - ip link set cifx0 up |
| 83 | + # bring interface up first of all |
| 84 | + ip link set cifx0 up |
76 | 85 |
|
| 86 | + fi |
77 | 87 | else |
78 | 88 | echo "cifx0 hardware support (TCP/IP over RTE LAN ports) not configured." |
79 | 89 | fi |
|
0 commit comments