HI,

I'm newbie on Luci  interface and quickly viewed the Luci/Lua document  .
I met the problem with Luci under Openwrt and hope get your help .

Following is my setup process but i don't know how to do in next step .


Step 1. I add the wifi device and driver on Openwrt platform and can
use the private command( such as iwxxx) to let it works .
            I can't use iwconfig/iwpriv to set it since it has private
command iwxxx.
Step 2. I add the the "wireless' file under /etc/config
root@OpenWrt:/usr/lib/lua/luci# cat /etc/config/wireless

config 'wifi-iface'
        option 'type' 'xxxx'
        option 'device' 'wlan0'
        option 'network' 'lan'
        option 'mode' 'sta'
        option 'bssid' 'MyWifiAP'
        option 'enabled' '1'
        option 'channel' '6'

Step 3 I add wifi.lua under /usr/lib/lua/luci/controller

root@OpenWrt:/usr/lib/lua/luci/controller# cat mywifi.lua
--[[
LuCI - Lua Configuration Interface
Just Peter Meng test my wifi
]]--

module("luci.controller.mywifi", package.seeall)

function index()
        if not nixio.fs.access("/etc/config/wireless") then
                return
        end
        local page
        page = entry({"admin", "network", "wirelss"},
cbi("admin_network/mywifi"), _("Wireless"))
        page.i18n = "mywifi"
        page.dependent = true
        entry({"admin", "network", "wireless", "enable"},
call("wifi_enable")).leaf = true
end

function wifi_enable()
        luci.sys.call("iwxxx wlan0 up")
end


Step 4. I add mywifi.lua  under  /usr/lib/lua/luci/model/cbi/admin_network
root@OpenWrt:/usr/lib/lua/luci/model/cbi/admin_network# cat mywifi.lua
--[[
LuCI - Lua Configuration Interface
Just for Peter Meng test wifi

]]--

m = Map("wireless", translate("Wifi Setup"),
        translate("Peter Meng test wifi under openwrt."))

s = m:section(TypedSection, "wifi-iface", translate("Wifi Setup"),
        translate("Peter Meng test wifi under openwrt hh"))
s.addremove = false
e = s:option(Flag, "enabled", translate("Enable"))
e.rmempty = true

s:option(Value, "channel", translate("Set wifi channel"))

return m


I can see the /etc/config/wireless file changed after i select
"enable" and input 11 for "channel"  and click "save &apply" from
webpage .
I want to invoke the "iwxxx wlan0 channel 11" to set to new channel  11.
How can i don in this case ? In which place to add such as "
luci.sys.call("iwxxx wlan0 channel 11 ")   " ?



Best Regards .
Peter Meng
[email protected]
_______________________________________________
openwrt-users mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-users

Reply via email to