mirror of
git://projects.qi-hardware.com/openwrt-packages.git
synced 2024-12-22 05:44:15 +02:00
milkymist files: update m1-wireless script files
This commit is contained in:
parent
a9bac6cda9
commit
b9e5598999
@ -73,8 +73,12 @@ function iwscan(iface)
|
||||
elseif wpa then enc = "psk"
|
||||
else enc = "wep" end
|
||||
end
|
||||
|
||||
local a = Q:match("(%d-)/")
|
||||
local b = Q:match("/(%d-)$")
|
||||
Q = math.floor(tonumber(a)/tonumber(b)*100)
|
||||
|
||||
local r = Q .. "\t" .. ESSID .. "\t" .. enc
|
||||
local r = Q .. "%," .. ESSID .. "," .. enc
|
||||
|
||||
table.insert(iws, r)
|
||||
end
|
||||
@ -84,4 +88,9 @@ function iwscan(iface)
|
||||
end
|
||||
|
||||
local t = iwscan("wlan0")
|
||||
for k,v in pairs(t) do print(v) end
|
||||
if t == {} then
|
||||
print();
|
||||
else
|
||||
for k,v in pairs(t) do print(v) end
|
||||
end
|
||||
|
@ -51,9 +51,22 @@ if [ "$1" == "get" ]; then
|
||||
fi
|
||||
|
||||
if [ "$1" == "status" ]; then
|
||||
ifconfig wlan0
|
||||
sleep 1
|
||||
IP=`ifconfig wlan0 2>/dev/null | grep "inet addr" | \
|
||||
sed -e 's/^ *//g' | cut -d":" -f2 | cut -d" " -f1`
|
||||
if [ "$?" != 0 ] || [ "${IP}" == "" ]; then
|
||||
echo "Disconnected"
|
||||
echo "0.0.0.0"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ESSID=`iwconfig wlan0 2>/dev/null | grep ESSID | cut -d":" -f 2 | sed -e 's/\"//g'`
|
||||
|
||||
echo "${ESSID}"
|
||||
echo "${IP}"
|
||||
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "Usage: $0 [get/set/status] PARAMS..."
|
||||
exit 1
|
Loading…
Reference in New Issue
Block a user