]> git.ipfire.org Git - people/ms/network.git/blobdiff - src/functions/functions.phy
wireless-ap: Enable ACS only for ath* devices
[people/ms/network.git] / src / functions / functions.phy
index 96287a524de6141305728093184527af46502e29..ee0f2a2eb10d0affb44694941a348014a6cc6906 100644 (file)
@@ -188,3 +188,47 @@ phy_supports_ht_capability() {
 
        list_match "${capability}" $(__phy_list_ht_capabilities "${phy}")
 }
+
+# Returns TRUE if the PHY supports ACS
+phy_supports_acs() {
+       local phy="${1}"
+       assert isset phy
+
+       local driver="$(phy_get_driver "${phy}")"
+       if ! isset driver; then
+               return ${EXIT_ERROR}
+       fi
+
+       # This is basically a whilelist of drivers which support this
+       # There is no better detection
+       case "${driver}" in
+               ath10k_*|ath9k|ath5k)
+                       return ${EXIT_TRUE}
+                       ;;
+               *)
+                       return ${EXIT_FALSE}
+                       ;;
+       esac
+}
+
+# Returns TRUE if the PHY supports DFS
+phy_supports_dfs() {
+       local phy="${1}"
+       assert isset phy
+
+       local driver="$(phy_get_driver "${phy}")"
+       if ! isset driver; then
+               return ${EXIT_ERROR}
+       fi
+
+       # This is basically a whilelist of drivers which support this
+       # There is no better detection
+       case "${driver}" in
+               ath10k_*|ath9k|ath5k)
+                       return ${EXIT_TRUE}
+                       ;;
+               *)
+                       return ${EXIT_FALSE}
+                       ;;
+       esac
+}