[luci] Store ssid
Jo-Philipp Wich
xm at subsignal.org
Fri Apr 16 00:23:09 CEST 2010
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi.
> I am using the mini module and I want to store the ssid. I tried
> everything uci:section uci:set wireless.ssid, etc.. Could someone help
> me with this?
The SSID option is stored within a anonymous "wifi-iface" section. Since
you cannot address those sections directly, you have to use the
foreach() iterator to loop over them:
local new_ssid = "my_ssid"
-- loop over sections of the type "wifi-iface" in config "wireless"
uci:foreach("wireless", "wifi-iface",
-- the iterator callback, receives a section table as only argument
function(s)
-- the ".name" attribute in the "s" table holds the uci section id
-- needed to address options within the section, use it to set the
-- new ssid
uci:set("wireless", s[".name"], "ssid", new_ssid)
-- returning false here aborts the iteration, ommit this if you
-- want to re-invoke this function for further wifi-iface sections
return false
end
)
-- save & commit
uci:save("wireless")
uci:commit("wireless")
~ J.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAkvHkcwACgkQdputYINPTPNRqgCgjnMG8vL/P/WZCdyz68AsBFvV
gWEAn0jV/1D7aRUU9JQ0xhZZ2EyM4HDM
=2Jkb
-----END PGP SIGNATURE-----
More information about the luci
mailing list