Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
ffho-packages
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Freifunk Hochstift
ffho-packages
Commits
5b77946a
Commit
5b77946a
authored
9 years ago
by
Michael Schwarz
Browse files
Options
Downloads
Patches
Plain Diff
Don't check current txpower but determine correct txpower step
parent
7c093075
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
ffho/ffho-txpower-fix/files/lib/gluon/upgrade/310-ffho-txpower-fix
+59
-0
59 additions, 0 deletions
...-txpower-fix/files/lib/gluon/upgrade/310-ffho-txpower-fix
with
59 additions
and
0 deletions
ffho/ffho-txpower-fix/files/lib/gluon/upgrade/
60
0-ffho-txpower-fix
→
ffho/ffho-txpower-fix/files/lib/gluon/upgrade/
31
0-ffho-txpower-fix
+
59
−
0
View file @
5b77946a
...
@@ -27,46 +27,33 @@ if not interface24 and uci:get('wireless', 'radio1', 'hwmode') then
...
@@ -27,46 +27,33 @@ if not interface24 and uci:get('wireless', 'radio1', 'hwmode') then
interface24
=
'radio1'
interface24
=
'radio1'
end
end
end
end
if
not
interface24
then
os.exit
(
0
)
-- something went wrong
end
--- check if txpower is already set. if so, we have nothing to do
--- check if txpower is already set. if so, we have nothing to do
if
uci
:
get
(
'wireless'
,
interface24
,
'txpower'
)
then
if
uci
:
get
(
'wireless'
,
interface24
,
'txpower'
)
then
os.exit
(
0
)
os.exit
(
0
)
end
end
--- get corresponding wifi interface
--- get maximum available power and step
configuredInterface
=
''
t
=
cmd
(
'iwinfo '
..
interface24
..
' txpowerlist | tail -n 1 | awk \'
{
print
$
1
}
\
''
)
interfaceList
=
uci
:
get_all
(
'wireless'
)
maximumTxPowerDb
=
string.gsub
(
t
,
"
\n
"
,
""
)
for
interface
,
value
in
pairs
(
interfaceList
)
do
maximumTxPowerDb
=
tonumber
(
maximumTxPowerDb
)
if
uci
:
get
(
'wireless'
,
interface
,
'device'
)
==
interface24
and
uci
:
get
(
'wireless'
,
interface
,
'disabled'
)
==
'0'
then
configuredInterface
=
uci
:
get
(
'wireless'
,
interface
,
'ifname'
)
break
end
end
if
configuredInterface
==
''
then
exit
(
0
)
-- we didn't find an active wifi interface
end
--- get current txpower
if
maximumTxPowerDb
<
20
then
t
=
cmd
(
'iwinfo '
..
configuredInterface
..
' info | grep Tx-Power | awk \'
{
print
$
2
}
\
''
)
t
=
cmd
(
'iwinfo '
..
interface24
..
' txpowerlist | wc -l'
)
currentTxPower
=
string.gsub
(
t
,
"
\n
"
,
""
)
maximumTxPower
=
string.gsub
(
t
,
"
\n
"
,
""
)
currentTxPower
=
tonumber
(
currentTxPower
)
maximumTxPower
=
tonumber
(
maximumTxPower
)
-
1
else
--- get maximum possible Tx-Power
t
=
cmd
(
'iwinfo '
..
interface24
..
' txpowerlist | grep -n "20 dBm" | cut -f1 -d\'
:
\
''
)
t
=
cmd
(
'iwinfo '
..
configuredInterface
..
' txpowerlist | tail -n 1 | sed -e \'
s
/
\\\
*//
\
' | awk \'
{
print
$
1
}
\
''
)
maximumTxPower
=
string.gsub
(
t
,
"
\n
"
,
""
)
maximumTxPower
=
string.gsub
(
t
,
"
\n
"
,
""
)
maximumTxPower
=
tonumber
(
maximumTxPower
)
-
1
maximumTxPower
=
tonumber
(
maximumTxPower
)
--- if current and maximum power differs, apply workaround
if
maximumTxPower
>
20
then
maximumTxPower
=
20
-- we are in Germany!
end
end
if
currentTxPower
<
maximumTxPower
then
--- set values
uci
:
set
(
'wireless'
,
interface24
,
'country'
,
'00'
)
uci
:
set
(
'wireless'
,
interface24
,
'country'
,
'00'
)
uci
:
set
(
'wireless'
,
interface24
,
'txpower'
,
maximumTxPower
)
uci
:
set
(
'wireless'
,
interface24
,
'txpower'
,
maximumTxPower
)
uci
:
save
(
'wireless'
)
uci
:
save
(
'wireless'
)
uci
:
commit
(
'wireless'
)
uci
:
commit
(
'wireless'
)
cmd
(
'wifi'
)
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