rfkill 526 B

1234567891011121314151617181920212223242526272829303132
  1. #!/bin/sh
  2. [ "${ACTION}" = "released" -o -n "${TYPE}" ] || exit 0
  3. . /lib/functions.sh
  4. rfkill_state=0
  5. wifi_rfkill_set() {
  6. uci set wireless.$1.disabled=$rfkill_state
  7. }
  8. wifi_rfkill_check() {
  9. local disabled
  10. config_get disabled $1 disabled
  11. [ "$disabled" = "1" ] || rfkill_state=1
  12. }
  13. config_load wireless
  14. case "${TYPE}" in
  15. "switch")
  16. [ "${ACTION}" = "released" ] && rfkill_state=1
  17. ;;
  18. *)
  19. config_foreach wifi_rfkill_check wifi-device
  20. ;;
  21. esac
  22. config_foreach wifi_rfkill_set wifi-device
  23. uci commit wireless
  24. wifi up
  25. return 0