You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
770 B
Plaintext
35 lines
770 B
Plaintext
4 years ago
|
#!/bin/sh
|
||
|
|
||
|
. /usr/share/libubox/jshn.sh
|
||
|
|
||
|
case "$1" in
|
||
|
list)
|
||
|
echo '{ "get": { } }'
|
||
|
;;
|
||
|
|
||
|
call)
|
||
|
case "$2" in
|
||
|
get)
|
||
|
# create output with peer stats
|
||
|
# construct json object from ath10k fw_stats
|
||
|
echo "{"
|
||
|
for phy in /sys/kernel/debug/ieee80211/phy*/ath10k/..; do [ -e "$phy" ] && {
|
||
|
phy=$(basename $(readlink -f "$phy"))
|
||
|
echo '"'"${phy/phy/radio}"'"'":"
|
||
|
{ grep Peer /sys/kernel/debug/ieee80211/$phy/ath10k/fw_stats || echo; } |
|
||
|
tr A-Z a-z |
|
||
|
sed -e '{s, *peer ,,;y/ /_/}' \
|
||
|
-e 's,\([^ ]*\).*_\([^ ]*\),"\1":"\2"\,,' \
|
||
|
-e '/mac_/s,\(.*\),\n\1,' \
|
||
|
-e '$s,$,\n}\n},' \
|
||
|
-e '1s,^,{,' |
|
||
|
sed -e '/mac_/{s-"mac_.*":\(.*\),-\1:{-;y/abcdef/ABCDEF/}' \
|
||
|
-e 's-^$-},-'
|
||
|
echo ","
|
||
|
} done
|
||
|
echo "}"
|
||
|
;;
|
||
|
esac
|
||
|
;;
|
||
|
esac
|