mirror of
https://github.com/dustinkirkland/byobu
synced 2025-08-20 05:23:20 -07:00
* usr/lib/byobu/wifi_quality:
- prefer iwconfig over iw for now, iw is not working for me
This commit is contained in:
parent
23d2a62a19
commit
79202a934d
2 changed files with 15 additions and 13 deletions
2
debian/changelog
vendored
2
debian/changelog
vendored
|
@ -18,6 +18,8 @@ byobu (5.128) unreleased; urgency=medium
|
||||||
commands when going back by history.
|
commands when going back by history.
|
||||||
All colors in command prompt should be escaped with [ ]
|
All colors in command prompt should be escaped with [ ]
|
||||||
- https://github.com/dustinkirkland/byobu/pull/30
|
- https://github.com/dustinkirkland/byobu/pull/30
|
||||||
|
* usr/lib/byobu/wifi_quality:
|
||||||
|
- prefer iwconfig over iw for now, iw is not working for me
|
||||||
|
|
||||||
[ Jeffery To ]
|
[ Jeffery To ]
|
||||||
* usr/bin/byobu-disable-prompt.in,
|
* usr/bin/byobu-disable-prompt.in,
|
||||||
|
|
|
@ -42,7 +42,19 @@ __wifi_quality_detail() {
|
||||||
|
|
||||||
__wifi_quality() {
|
__wifi_quality() {
|
||||||
local out bitrate quality
|
local out bitrate quality
|
||||||
if eval $BYOBU_TEST iw >/dev/null 2>&1; then
|
if eval $BYOBU_TEST iwconfig >/dev/null 2>&1; then
|
||||||
|
# iwconfig is expected to output lines like:
|
||||||
|
# Bit Rate=54 Mb/s Tx-Power=15 dBm
|
||||||
|
# Link Quality=60/70 Signal level=-50 dBm
|
||||||
|
# the awk below tokenizes the output and prints shell evalable results
|
||||||
|
out=`iwconfig $MONITORED_NETWORK 2>/dev/null |
|
||||||
|
awk '$0 ~ /[ ]*Link Quality./ {
|
||||||
|
sub(/.*=/,"",$2); split($2,a,"/");
|
||||||
|
printf "quality=%.0f\n", 100*a[1]/a[2] };
|
||||||
|
$0 ~ /[ ]*Bit Rate/ { sub(/.*[:=]/,"",$2); printf("bitrate=%s\n", $2); }
|
||||||
|
'`
|
||||||
|
eval "$out"
|
||||||
|
elif eval $BYOBU_TEST iw >/dev/null 2>&1; then
|
||||||
local dev
|
local dev
|
||||||
for dev in $(___get_dev_list); do
|
for dev in $(___get_dev_list); do
|
||||||
# iw is expected to output lines like:
|
# iw is expected to output lines like:
|
||||||
|
@ -57,18 +69,6 @@ __wifi_quality() {
|
||||||
eval "$out"
|
eval "$out"
|
||||||
[ -z "$bitrate" ] || [ -z "$quality" ] || break
|
[ -z "$bitrate" ] || [ -z "$quality" ] || break
|
||||||
done
|
done
|
||||||
elif eval $BYOBU_TEST iwconfig >/dev/null 2>&1; then
|
|
||||||
# iwconfig is expected to output lines like:
|
|
||||||
# Bit Rate=54 Mb/s Tx-Power=15 dBm
|
|
||||||
# Link Quality=60/70 Signal level=-50 dBm
|
|
||||||
# the awk below tokenizes the output and prints shell evalable results
|
|
||||||
out=`iwconfig $MONITORED_NETWORK 2>/dev/null |
|
|
||||||
awk '$0 ~ /[ ]*Link Quality./ {
|
|
||||||
sub(/.*=/,"",$2); split($2,a,"/");
|
|
||||||
printf "quality=%.0f\n", 100*a[1]/a[2] };
|
|
||||||
$0 ~ /[ ]*Bit Rate/ { sub(/.*[:=]/,"",$2); printf("bitrate=%s\n", $2); }
|
|
||||||
'`
|
|
||||||
eval "$out"
|
|
||||||
fi
|
fi
|
||||||
[ -n "$bitrate" ] || bitrate=0
|
[ -n "$bitrate" ] || bitrate=0
|
||||||
[ -n "$quality" ] || quality=0
|
[ -n "$quality" ] || quality=0
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue