diag.sh 1012 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #!/bin/sh
  2. # Copyright (C) 2012-2013 OpenWrt.org
  3. . /lib/functions/leds.sh
  4. status_led=power
  5. [ ! -d /sys/class/leds/power/ ] && [ ! -d /sys/class/leds/power1/ ] && [ ! -d /sys/class/leds/power2/ ] && [ -d /sys/class/leds/wps/ ] && status_led=wps
  6. set_state() {
  7. case "$1" in
  8. preinit)
  9. if [ -d /sys/class/leds/power2/ ]; then
  10. status_led_on
  11. status_led=power2
  12. status_led_blink_preinit
  13. status_led=power
  14. else
  15. status_led_blink_preinit
  16. fi
  17. ;;
  18. failsafe)
  19. if [ -d /sys/class/leds/power2/ ]; then
  20. led_off power2
  21. status_led_blink_failsafe
  22. elif [ -d /sys/class/leds/power1/ ]; then
  23. status_led_off
  24. status_led=power1
  25. status_led_blink_failsafe
  26. status_led=power
  27. else
  28. status_led_blink_failsafe
  29. fi
  30. ;;
  31. preinit_regular)
  32. if [ -d /sys/class/leds/power2/ ]; then
  33. status_led_on
  34. status_led=power2
  35. status_led_blink_preinit_regular
  36. status_led=power
  37. else
  38. status_led_blink_preinit_regular
  39. fi
  40. ;;
  41. done)
  42. status_led_on
  43. led_off power1
  44. led_off power2
  45. ;;
  46. esac
  47. }