Tuesday, March 13, 2007

ibapplet-kde.sh fix

The script to check the signal strength that comes with standard ibdriver 1.3.2 (iBurst Wireless Internet Modem Driver) sometimes doesn't work. Error about invalid arguments etc.

This is my modified version of ibapplet-kde.sh
added: level=`echo "scale=0; $level / 1" | bc -l`

============= myib.sh ===============
#!/bin/sh

ifname=${1:-ib0}
dcopref=`kdialog --title "ibApplet" --progressbar "iBurst Signal Strength" 100`
prev=""
while true ; do
if [ `dcop $dcopref wasCancelled` = "true" ] ; then
break
fi
curr=`cat /proc/net/wireless`
if [ "$curr" != "$prev" ] ; then
prev=$curr
level=`echo "$curr" | awk "/$ifname:/ {print \\$4}"`
level=`echo "scale=0; $level / 1" | bc -l`
dcop $dcopref setProgress $level
fi
sleep 1
done
dcop $dcopref close

============= end ===============

No comments: