99-ath9k_disable_ani 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #!/bin/sh
  2. #
  3. # "ANI-thing is better than no WiFi"-Workaround
  4. #
  5. # In order to avoid further WiFi-Blackouts that *might* be caused by a buggy
  6. # ANI feature in the ath9k kernel module, we disable ANI for nodes using the
  7. # "stable" firmware branch until it got fixed in OpenWRT completely.
  8. # Don't need to do anything, unless the script gets triggered by an "ifup"
  9. # event.
  10. [[ "$ACTION" != "ifup" ]] && exit 0;
  11. [[ "$INTERFACE" != "mesh_radio0" && "$INTERFACE" != "client" ]] && exit 0;
  12. # Test whether disabling ANI is applicable or not
  13. if [ ! -e "/sys/kernel/debug/ieee80211/phy0/ath9k/ani" ] ; then
  14. logger -s -t ath9k-disable-ani -p local0.notice \
  15. "Not an ath9k device with ANI. Aborting."
  16. exit 0
  17. fi
  18. # Load helper functions and determine the current branch
  19. . /lib/functions.sh
  20. config_load autoupdater
  21. # Test whether this devices has the stable or the testing firmware
  22. config_get fw_branch "settings" "branch"
  23. new_ani_state=1
  24. log_msg="Current firmware branch is: ${fw_branch}"
  25. if [ "$fw_branch" == "stable" ] ; then
  26. new_ani_state=0
  27. log_msg="${log_msg} (disabling ANI)"
  28. else
  29. log_msg="${log_msg} (enabling ANI)"
  30. fi
  31. # enable/disable feature
  32. logger -s -t ath9k-disable-ani -p local0.info $log_msg
  33. /bin/echo ${new_ani_state} > /sys/kernel/debug/ieee80211/phy0/ath9k/ani