Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FFS Gluon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
firmware
FFS Gluon
Commits
fadfc64e
Commit
fadfc64e
authored
9 years ago
by
Matthias Schiffer
Browse files
Options
Downloads
Patches
Plain Diff
gluon-luci-wifi-config: don't use luci.sys.wifi.getiwinfo()
Directly using libiwinfo is more reliable.
parent
f4a3f73f
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
package/gluon-luci-wifi-config/files/usr/lib/lua/luci/model/cbi/admin/wifi-config.lua
+13
-15
13 additions, 15 deletions
...ig/files/usr/lib/lua/luci/model/cbi/admin/wifi-config.lua
with
13 additions
and
15 deletions
package/gluon-luci-wifi-config/files/usr/lib/lua/luci/model/cbi/admin/wifi-config.lua
+
13
−
15
View file @
fadfc64e
local
uci
=
luci
.
model
.
uci
.
cursor
()
local
uci
=
luci
.
model
.
uci
.
cursor
()
local
fs
=
require
'nixio.fs'
local
fs
=
require
'nixio.fs'
local
iwinfo
=
require
'iwinfo'
local
function
find_phy_by_path
(
path
)
local
function
find_phy_by_path
(
path
)
...
@@ -17,9 +18,9 @@ local function find_phy_by_macaddr(macaddr)
...
@@ -17,9 +18,9 @@ local function find_phy_by_macaddr(macaddr)
end
end
end
end
local
function
txpower_list
(
iw
)
local
function
txpower_list
(
phy
)
local
list
=
iw
.
txpwrlist
or
{
}
local
list
=
iw
info
.
nl80211
.
txpwrlist
(
phy
)
or
{
}
local
off
=
tonumber
(
iw
.
txpower_offset
)
or
0
local
off
=
tonumber
(
iw
info
.
nl80211
.
txpower_offset
(
phy
)
)
or
0
local
new
=
{
}
local
new
=
{
}
local
prev
=
-
1
local
prev
=
-
1
local
_
,
val
local
_
,
val
...
@@ -93,22 +94,19 @@ for _, radio in ipairs(radios) do
...
@@ -93,22 +94,19 @@ for _, radio in ipairs(radios) do
end
end
if
phy
then
if
phy
then
local
iw
=
luci
.
sys
.
wifi
.
getiwinfo
(
phy
)
local
txpowers
=
txpower_list
(
phy
)
if
iw
then
local
txpowers
=
txpower_list
(
iw
)
if
#
txpowers
>
1
then
if
#
txpowers
>
1
then
local
tp
=
p
:
option
(
ListValue
,
radio
..
'_txpower'
,
translate
(
"Transmission power"
))
local
tp
=
p
:
option
(
ListValue
,
radio
..
'_txpower'
,
translate
(
"Transmission power"
))
tp
.
rmempty
=
true
tp
.
rmempty
=
true
tp
.
default
=
uci
:
get
(
'wireless'
,
radio
,
'txpower'
)
or
'default'
tp
.
default
=
uci
:
get
(
'wireless'
,
radio
,
'txpower'
)
or
'default'
tp
:
value
(
'default'
,
translate
(
"(default)"
))
tp
:
value
(
'default'
,
translate
(
"(default)"
))
table.sort
(
txpowers
,
function
(
a
,
b
)
return
a
.
driver_dbm
>
b
.
driver_dbm
end
)
table.sort
(
txpowers
,
function
(
a
,
b
)
return
a
.
driver_dbm
>
b
.
driver_dbm
end
)
for
_
,
entry
in
ipairs
(
txpowers
)
do
for
_
,
entry
in
ipairs
(
txpowers
)
do
tp
:
value
(
entry
.
driver_dbm
,
"%i dBm (%i mW)"
%
{
entry
.
display_dbm
,
entry
.
display_mw
})
tp
:
value
(
entry
.
driver_dbm
,
"%i dBm (%i mW)"
%
{
entry
.
display_dbm
,
entry
.
display_mw
})
end
end
end
end
end
end
end
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment