Jan Kundrát | 55fb064 | 2020-03-27 18:44:19 +0100 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | set -ex |
| 4 | |
| 5 | # Green LED for "we're getting some signal" |
| 6 | |
| 7 | if 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 |
| 11 | else |
| 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 |
| 15 | fi |
| 16 | |
| 17 | if [[ -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 |
| 22 | fi |
| 23 | |
| 24 | if [[ -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 |
| 29 | fi |