blob: 8e8f6a1c541209182dfc5cf2bfcd19acda332622 [file] [log] [blame]
Jan Kundrát55fb0642020-03-27 18:44:19 +01001#!/bin/sh
2
3set -ex
4
5# Green LED for "we're getting some signal"
6
7if grep -q '\<czechlight=sdn-inline\>' /proc/cmdline; then
8 # LEDs have different labels on this HW
9 STAGE1_LED=uid:green
10 STAGE2_LED=line:green
11else
12 # Line/Degree: signal present at Line IN
13 # WSS A/D and Coherent A/D: signal present at some Express IN
14 STAGE1_LED=line:green
15fi
16
17if [[ -n "${STAGE1_LED+set}" ]]; then
18 cd /sys/class/leds/${STAGE1_LED}
19 echo gpio > trigger
20 GPIO=$(sed -En 's/.*gpio-(.*) \(EDFA1_ST1_IN_LOS_A .*/\1/p' /sys/kernel/debug/gpio)
21 echo $GPIO > gpio
22fi
23
24if [[ -n "${STAGE2_LED+set}" ]]; then
25 cd /sys/class/leds/${STAGE2_LED}
26 echo gpio > trigger
27 GPIO=$(sed -En 's/.*gpio-(.*) \(EDFA1_ST2_IN_LOS_A .*/\1/p' /sys/kernel/debug/gpio)
28 echo $GPIO > gpio
29fi