Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Gluon SSID Changer
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
firmware
Gluon SSID Changer
Commits
b008c424
Commit
b008c424
authored
Jun 11, 2017
by
rubo77
Browse files
Options
Downloads
Patches
Plain Diff
tq settings from ffac-version implemented
parent
5e548c87
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
README.md
+0
-1
0 additions, 1 deletion
README.md
gluon-ssid-changer/files/lib/gluon/ssid-changer/ssid-changer.sh
+43
-6
43 additions, 6 deletions
...ssid-changer/files/lib/gluon/ssid-changer/ssid-changer.sh
with
43 additions
and
7 deletions
README.md
+
0
−
1
View file @
b008c424
...
...
@@ -22,7 +22,6 @@ ssid_changer = {
tq_limit_enabled = 0, -- if false, the offline SSID will only be set if there is no gateway reacheable
-- upper and lower limit to turn the offline_ssid on and off
-- in-between these two values the SSID will never be changed to prevent it from toggeling every minute.
-- TODO: enabled=1 still has to be implemented
tq_limit_max = '55', -- upper limit, above that the online SSID will be used
tq_limit_min = '45' -- lower limit, below that the offline SSID will be used
},
...
...
This diff is collapsed.
Click to expand it.
gluon-ssid-changer/files/lib/gluon/ssid-changer/ssid-changer.sh
+
43
−
6
View file @
b008c424
...
...
@@ -10,7 +10,7 @@ FIRST="$(uci -q get ssid-changer.settings.first)"
:
${
FIRST
:
=5
}
PREFIX
=
"
$(
uci
-q
get ssid-changer.settings.prefix
)
"
#
generate the ssid with either 'nodename', 'mac' or to use only
th
e
prefix
: 'none'
#
the Offline-SSID will start with
th
is
prefix
:
${
PREFIX
:
=
'FF_OFFLINE_'
}
if
[
"
$(
uci
-q
get ssid-changer.settings.enabled
)
"
=
'0'
]
;
then
...
...
@@ -20,6 +20,8 @@ else
fi
SETTINGS_SUFFIX
=
"
$(
uci
-q
get ssid-changer.settings.suffix
)
"
# generate the ssid with either 'nodename', 'mac' or to use only the prefix set to 'none'
:
${
SETTINGS_SUFFIX
:
=
'nodename'
}
if
[
$SETTINGS_SUFFIX
=
'nodename'
]
;
then
SUFFIX
=
"
$(
uname
-n
)
"
...
...
@@ -41,13 +43,48 @@ fi
OFFLINE_SSID
=
"
$PREFIX$SUFFIX
"
# TODO: ffac tq limits has to be implemented here if enabled
ONLINE_SSID
=
"
$(
uci
-q
get wireless.client_radio0.ssid
)
"
# if for whatever reason ONLINE_SSID is NULL
:
${
ONLINE_SSID
:
=
"FREIFUNK"
}
TQ_LIMIT_ENABLED
=
"
$(
uci
-q
get ssid-changer.settings.tq_limit_enabled
)
"
# if true, the offline ssid will only be set if there is no gateway reacheable
# upper and lower limit to turn the offline_ssid on and off
# in-between these two values the SSID will never be changed to preven it from toggeling every Minute.
:
${
TQ_LIMIT_ENABLED
:
=
'0'
}
if
[
$TQ_LIMIT_ENABLED
=
1
]
;
then
TQ_LIMIT_MAX
=
"
$(
uci
-q
get ssid-changer.settings.tq_limit_max
)
"
# upper limit, above that the online SSID will be used
:
${
TQ_LIMIT_MAX
:
=
'55'
}
TQ_LIMIT_MIN
=
"
$(
uci
-q
get ssid-changer.settings.tq_limit_min
)
"
# lower limit, below that the offline SSID will be used
:
${
TQ_LIMIT_MIN
:
=
'45'
}
# grep the connection quality of the currently used gateway
GATEWAY_TQ
=
$(
batctl gwl |
grep
-e
"^=>"
-e
"^
\*
"
|
awk
-F
'[('')]'
'{print $2}'
|
tr
-d
" "
)
if
[
!
$GATEWAY_TQ
]
;
then
# there is no gateway
GATEWAY_TQ
=
0
fi
MSG
=
"TQ is
$GATEWAY_TQ
, "
if
[
$GATEWAY_TQ
-gt
$TQ_LIMIT_MAX
]
;
then
CHECK
=
1
elif
[
$GATEWAY_TQ
-lt
$TQ_LIMIT_MIN
]
;
then
CHECK
=
0
else
# this is just get a clean run if we are in-between the grace periode
echo
"TQ is
$GATEWAY_TQ
, do nothing"
exit
fi
else
MSG
=
""
CHECK
=
"
$(
batctl gwl
-H
|grep
-v
"gateways in range"
|wc
-l
)
"
fi
HUP_NEEDED
=
0
if
[
"
$CHECK
"
-gt
0
]
||
[
"
$DISABLED
"
=
'1'
]
;
then
echo
"node is online"
...
...
@@ -60,7 +97,7 @@ if [ "$CHECK" -gt 0 ] || [ "$DISABLED" = '1' ]; then
fi
CURRENT_SSID
=
"
$(
grep
"^ssid=
$OFFLINE_SSID
"
$HOSTAPD
|
cut
-d
"="
-f2
)
"
if
[
"
$CURRENT_SSID
"
=
"
$OFFLINE_SSID
"
]
;
then
logger
-s
-t
"gluon-ssid-changer"
-p
5
"SSID is
$CURRENT_SSID
, change to
$ONLINE_SSID
"
logger
-s
-t
"gluon-ssid-changer"
-p
5
$MSG
"SSID is
$CURRENT_SSID
, change to
$ONLINE_SSID
"
sed
-i
"s~^ssid=
$CURRENT_SSID
~ssid=
$ONLINE_SSID
~"
$HOSTAPD
# HUP here would be to early for dualband devices
HUP_NEEDED
=
1
...
...
@@ -80,7 +117,7 @@ elif [ "$CHECK" -eq 0 ]; then
fi
CURRENT_SSID
=
"
$(
grep
"^ssid=
$ONLINE_SSID
"
$HOSTAPD
|
cut
-d
"="
-f2
)
"
if
[
"
$CURRENT_SSID
"
=
"
$ONLINE_SSID
"
]
;
then
logger
-s
-t
"gluon-ssid-changer"
-p
5
"SSID is
$CURRENT_SSID
, change to
$OFFLINE_SSID
"
logger
-s
-t
"gluon-ssid-changer"
-p
5
$MSG
"SSID is
$CURRENT_SSID
, change to
$OFFLINE_SSID
"
sed
-i
"s~^ssid=
$ONLINE_SSID
~ssid=
$OFFLINE_SSID
~"
$HOSTAPD
HUP_NEEDED
=
1
else
...
...
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