convert luci.fs users to nixio.fs api
[project/luci.git] / modules / admin-full / luasrc / model / cbi / admin_network / wifi.lua
index 3499227..6e92492 100644 (file)
@@ -11,7 +11,10 @@ You may obtain a copy of the License at
 
 $Id$
 ]]--
-require("luci.tools.webadmin")
+
+local wa = require "luci.tools.webadmin"
+local fs = require "nixio.fs"
+
 arg[1] = arg[1] or ""
 
 m = Map("wireless", translate("networks"), translate("a_w_networks1"))
@@ -143,7 +146,7 @@ network = s:option(Value, "network", translate("network"), translate("a_w_networ
 network.rmempty = true
 network:value("")
 network.combobox_manual = translate("a_w_netmanual")
-luci.tools.webadmin.cbi_add_networks(network)
+wa.cbi_add_networks(network)
 
 function network.write(self, section, value)
        if not m.uci:get("network", value) then
@@ -173,7 +176,7 @@ bssid = s:option(Value, "bssid", translate("wifi_bssid"))
 -------------------- MAC80211 Interface ----------------------
 
 if hwtype == "mac80211" then
-       if luci.fs.mtime("/usr/sbin/iw") then
+       if fs.access("/usr/sbin/iw") then
                mode:value("mesh", "802.11s")
        end
 
@@ -322,8 +325,8 @@ encr:value("none", "No Encryption")
 encr:value("wep", "WEP")
 
 if hwtype == "atheros" or hwtype == "mac80211" or hwtype == "prism2" then
-       local supplicant = luci.fs.mtime("/usr/sbin/wpa_supplicant")
-       local hostapd = luci.fs.mtime("/usr/sbin/hostapd")
+       local supplicant = fs.access("/usr/sbin/wpa_supplicant")
+       local hostapd = fs.access("/usr/sbin/hostapd")
 
        if hostapd and supplicant then
                encr:value("psk", "WPA-PSK")