diag.sh 779 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #!/bin/sh
  2. # Copyright (C) 2016 Henryk Heisig hyniu@o2.pl
  3. . /lib/functions/leds.sh
  4. . /lib/ipq806x.sh
  5. boot="$(ipq806x_get_dt_led boot)"
  6. failsafe="$(ipq806x_get_dt_led failsafe)"
  7. running="$(ipq806x_get_dt_led running)"
  8. upgrade="$(ipq806x_get_dt_led upgrade)"
  9. set_state() {
  10. status_led="$boot"
  11. case "$1" in
  12. preinit)
  13. status_led_blink_preinit
  14. ;;
  15. failsafe)
  16. status_led_off
  17. [ -n "$running" ] && {
  18. status_led="$running"
  19. status_led_off
  20. }
  21. status_led="$failsafe"
  22. status_led_blink_failsafe
  23. ;;
  24. preinit_regular)
  25. status_led_blink_preinit_regular
  26. ;;
  27. upgrade)
  28. [ -n "$running" ] && {
  29. status_led="$upgrade"
  30. status_led_blink_preinit_regular
  31. }
  32. ;;
  33. done)
  34. status_led_off
  35. [ -n "$running" ] && {
  36. status_led="$running"
  37. status_led_on
  38. }
  39. ;;
  40. esac
  41. }