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
7c093075
Commit
7c093075
authored
9 years ago
by
Michael Schwarz
Browse files
Options
Downloads
Patches
Plain Diff
First version of txpower-fix to get full txpower back
parent
abff907b
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
ffho/ffho-txpower-fix/Makefile
+40
-0
40 additions, 0 deletions
ffho/ffho-txpower-fix/Makefile
ffho/ffho-txpower-fix/files/lib/gluon/upgrade/600-ffho-txpower-fix
+72
-0
72 additions, 0 deletions
...-txpower-fix/files/lib/gluon/upgrade/600-ffho-txpower-fix
with
112 additions
and
0 deletions
ffho/ffho-txpower-fix/Makefile
0 → 100644
+
40
−
0
View file @
7c093075
include
$(TOPDIR)/rules.mk
PKG_NAME
:=
ffho-txpower-fix
PKG_VERSION
:=
1
PKG_BUILD_DIR
:=
$(
BUILD_DIR
)
/
$(
PKG_NAME
)
include
$(GLUONDIR)/include/package.mk
define
Package/ffho-txpower-fix
SECTION
:=
admin
CATEGORY
:=
Workaround
DEPENDS
:=
+wireless-tools
TITLE
:=
Fixes txpower on some wifi nodes under chaos calmer
(
gluon 2015.2
)
endef
define
Package/ffho-txpower-fix/description
With
chaoscalmer,
wifi
nodes
seemed
to
be
locked
to
less
txpower
than
they
could
do.
First
suggestions
are,
that
this
is
a
mistake
in
the
upstream
OpenWrt-Code.
Even
the
bugtrackers
of
OpenWrt
are
full
of
this.
The
idea
of
this
workaround
is,
to
check
if
the
txpower
could
be
increased
iff
it
isn't
already
set
to
a
special
value.
Unfortunately
this
can
only
be
done
by
setting
the
country
code
to
00.
endef
define
Build/Prepare
mkdir
-p
$(PKG_BUILD_DIR)
endef
define
Build/Configure
endef
define
Build/Compile
endef
define
Package/ffho-txpower-fix/install
$(CP)
./files/*
$(1)/
endef
$(
eval
$(
call BuildPackage,ffho-txpower-fix
))
This diff is collapsed.
Click to expand it.
ffho/ffho-txpower-fix/files/lib/gluon/upgrade/600-ffho-txpower-fix
0 → 100755
+
72
−
0
View file @
7c093075
#!/usr/bin/lua
site
=
require
(
"gluon.site_config"
)
uci
=
require
(
'luci.model.uci'
).
cursor
()
--- wrapper for calling systemcommands
function
cmd
(
_command
)
local
f
=
io.popen
(
_command
)
local
l
=
f
:
read
(
"*a"
)
f
:
close
()
return
l
end
--- first of all, get 2.4GHz wifi interface
local
interface24
=
false
if
uci
:
get
(
'wireless'
,
'radio0'
,
'hwmode'
)
then
hwmode
=
uci
:
get
(
'wireless'
,
'radio0'
,
'hwmode'
)
if
hwmode
==
'11g'
then
interface24
=
'radio0'
end
end
--- try with radio1 if radio0 seems not the correct interface
if
not
interface24
and
uci
:
get
(
'wireless'
,
'radio1'
,
'hwmode'
)
then
hwmode
=
uci
:
get
(
'wireless'
,
'radio1'
,
'hwmode'
)
if
hwmode
==
'11g'
then
interface24
=
'radio1'
end
end
--- check if txpower is already set. if so, we have nothing to do
if
uci
:
get
(
'wireless'
,
interface24
,
'txpower'
)
then
os.exit
(
0
)
end
--- get corresponding wifi interface
configuredInterface
=
''
interfaceList
=
uci
:
get_all
(
'wireless'
)
for
interface
,
value
in
pairs
(
interfaceList
)
do
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
t
=
cmd
(
'iwinfo '
..
configuredInterface
..
' info | grep Tx-Power | awk \'
{
print
$
2
}
\
''
)
currentTxPower
=
string.gsub
(
t
,
"
\n
"
,
""
)
currentTxPower
=
tonumber
(
currentTxPower
)
--- get maximum possible Tx-Power
t
=
cmd
(
'iwinfo '
..
configuredInterface
..
' txpowerlist | tail -n 1 | sed -e \'
s
/
\\\
*//
\
' | awk \'
{
print
$
1
}
\
''
)
maximumTxPower
=
string.gsub
(
t
,
"
\n
"
,
""
)
maximumTxPower
=
tonumber
(
maximumTxPower
)
--- if current and maximum power differs, apply workaround
if
maximumTxPower
>
20
then
maximumTxPower
=
20
-- we are in Germany!
end
if
currentTxPower
<
maximumTxPower
then
uci
:
set
(
'wireless'
,
interface24
,
'country'
,
'00'
)
uci
:
set
(
'wireless'
,
interface24
,
'txpower'
,
maximumTxPower
)
uci
:
save
(
'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