60ghz: ap/sta

This commit is contained in:
Maciej Krüger 2022-04-13 15:19:47 +02:00 committed by Alexander List
parent fc00f32c6a
commit 6f60e4c20f
2 changed files with 13 additions and 26 deletions

View File

@ -220,24 +220,9 @@ local function configure_p2p(config, radio, index, suffix, disabled)
return
end
local master = uci:get('wireless', radio_name, '_p2pid') or string.sub(string.gsub(sysconfig.primary_mac, ':', ''), 8)
local mode = uci:get('wireless', radio_name, '_p2pmode') or 'master'
local ssid = uci:get('wireless', name, 'ssid') or string.sub(string.gsub(sysconfig.primary_mac, ':', ''), 8)
local mode = uci:get('wireless', name, 'mode') or 'ap'
local p2pmode = nil
if mode == 'master' then
p2pmode = 'p2p-go'
end
if mode == 'slave' then
p2pmode = 'p2p-client'
end
if p2pmode == nil then
return
end
-- FIXME: id
-- FIXME: static ip stuffs
uci:section('network', 'interface', name, {
@ -248,7 +233,8 @@ local function configure_p2p(config, radio, index, suffix, disabled)
uci:section('wireless', 'wifi-iface', name, {
device = radio_name,
network = name,
mode = p2pmode,
ssid = ssid,
mode = mode,
macaddr = macaddr,
mcast_rate = config.mcast_rate,
ifname = suffix and 'p2p' .. suffix,

View File

@ -109,25 +109,26 @@ uci:foreach('wireless', 'wifi-device', function(config)
end
if is_60ghz then
local name6 = 'p2p_' .. radio
-- leftover todos for 60ghz
-- - since client AP on 60ghz makes no sense (and additional APs can't be created due to limit of 1 device)
-- a function would be needed to say "device.supports_access_points()" or "device.client_facing()" or similar
-- that would return a bool whether to setup & show private AP, client AP, etc options
-- - 802.11s on 60ghz may or may not become a thing
-- could be handeled dynamically. a toggle to switch between p2p and mesh if driver supports it.
local vif = vif_option('p2p', {'p2p'}, translate('Enable point-to-point mesh'))
local id = p:option(Value, radio .. '_p2pid', translate('Master ID'))
local vif = vif_option('p2p', {'p2p'}, translate('Enable point-to-point AP/STA mesh'))
local id = p:option(Value, radio .. '_p2pid', translate('SSID'))
id.datatype = "maxlength(32)"
id.default = uci:get('wireless', radio, '_p2pid') or 'g-' .. string.sub(string.gsub(sysconfig.primary_mac, ':', ''), 8)
id.default = uci:get('wireless', name6, 'ssid') or 'g-' .. string.sub(string.gsub(sysconfig.primary_mac, ':', ''), 8)
id:depends(vif, true)
function id:write(data)
uci:set('wireless', radio, '_p2pid', data)
uci:set('wireless', name6, 'ssid', data)
end
local mode = p:option(ListValue, radio .. '_p2pmode', translate("P2P Mode (master/GO - slave/client)"))
mode.default = uci:get('wireless', radio, '_p2pmode') or 'master'
mode:value('master', translate('Master'))
mode:value('slave', translate('Slave'))
local mode = p:option(ListValue, radio .. '_p2pmode', translate("P2P Mode (master/ap - slave/station)"))
mode.default = uci:get('wireless', name6, 'mode') or 'ap'
mode:value('ap', translate('Master'))
mode:value('station', translate('Slave'))
mode:depends(vif, true)
function mode:write(data)
uci:set('wireless', radio, '_p2pmode', data)