mirror of
https://github.com/Doodle3D/doodle3d-firmware.git
synced 2025-01-03 08:13:49 +01:00
Add option to create protected access point.
This commit is contained in:
parent
369866ce60
commit
9d86ed2aac
@ -43,6 +43,12 @@ M.network_ap_address = {
|
|||||||
regex = '%d+\.%d+\.%d+\.%d+'
|
regex = '%d+\.%d+\.%d+\.%d+'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
M.network_ap_key = {
|
||||||
|
default = '',
|
||||||
|
type = 'string',
|
||||||
|
description = 'Access Point security key'
|
||||||
|
}
|
||||||
|
|
||||||
M.network_ap_netmask = {
|
M.network_ap_netmask = {
|
||||||
default = '255.255.255.0',
|
default = '255.255.255.0',
|
||||||
type = 'string',
|
type = 'string',
|
||||||
|
@ -107,16 +107,19 @@ end
|
|||||||
function reconf.apnet_add_noreload(dirtyList) reconf.apnet_add(dirtyList, true) end
|
function reconf.apnet_add_noreload(dirtyList) reconf.apnet_add(dirtyList, true) end
|
||||||
function reconf.apnet_add(dirtyList, noReload)
|
function reconf.apnet_add(dirtyList, noReload)
|
||||||
local ourSsid = wifi.getSubstitutedSsid(settings.get('network.ap.ssid'))
|
local ourSsid = wifi.getSubstitutedSsid(settings.get('network.ap.ssid'))
|
||||||
|
local networkKey = settings.get('network.ap.key')
|
||||||
local sname = nil
|
local sname = nil
|
||||||
uci:foreach('wireless', 'wifi-iface', function(s)
|
uci:foreach('wireless', 'wifi-iface', function(s)
|
||||||
if s.ssid == ourSsid then sname = s['.name']; return false end
|
if s.ssid == ourSsid then sname = s['.name']; return false end
|
||||||
end)
|
end)
|
||||||
if sname == nil then sname = uci:add('wireless', 'wifi-iface') end
|
if sname == nil then sname = uci:add('wireless', 'wifi-iface') end
|
||||||
|
|
||||||
|
local encType = networkKey == '' and 'none' or 'psk2'
|
||||||
M.uciTableSet('wireless', sname, {
|
M.uciTableSet('wireless', sname, {
|
||||||
network = wifi.NET,
|
network = wifi.NET,
|
||||||
ssid = ourSsid,
|
ssid = ourSsid,
|
||||||
encryption = 'none',
|
encryption = encType,
|
||||||
|
key = networkKey,
|
||||||
device = 'radio0',
|
device = 'radio0',
|
||||||
mode = 'ap',
|
mode = 'ap',
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user