wifi 958 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #!/bin/sh
  2. # Copyright (C) 2006 OpenWrt.org
  3. . /etc/functions.sh
  4. config_get_bool() {
  5. local _tmp
  6. config_get "$1" "$2" "$3"
  7. eval "_tmp=\$$1"
  8. case "$_tmp" in
  9. 1|on|enabled) eval "$1=1";;
  10. 0|off|disabled) eval "$1=0";;
  11. *) eval "$1=${4:-0}";;
  12. esac
  13. }
  14. config_cb() {
  15. config_get TYPE "$CONFIG_SECTION" TYPE
  16. case "$TYPE" in
  17. wifi-device)
  18. append DEVICES "$CONFIG_SECTION"
  19. ;;
  20. wifi-iface)
  21. config_get device "$CONFIG_SECTION" device
  22. config_get vifs "$device" vifs
  23. append vifs "$CONFIG_SECTION"
  24. config_set "$device" vifs "$vifs"
  25. ;;
  26. esac
  27. }
  28. config_load wireless
  29. include /lib/wifi
  30. for device in $DEVICES; do (
  31. config_get iftype "$device" type
  32. eval "type setup_$iftype" 2>/dev/null >/dev/null && {
  33. eval "scan_$iftype '$device'"
  34. eval "setup_$iftype '$device'" && {
  35. # TODO: set up network settings
  36. /bin/true
  37. } || echo "$device($iftype): Setup failed" || true
  38. } || echo "$device($iftype): Interface type not supported"
  39. ); done