Hier dokumentiere ich, wie man ein 20×4-LC-Display an den WRT54GL frickelt.
Übel zusammengehackt, aber funktioniert. ;)
#!/bin/sh
myinterface=ppp0
rx=1
tx=1
starttime=`date +%s`
actualip=`ifconfig ${myinterface} | grep inet | cut -d: -f2 | awk '{ print $1}'`
while true; do
oldrx=$rx
oldtx=$tx
rx=`cat /proc/net/dev | grep br-lan | awk '{print $2}'`
tx=`cat /proc/net/dev | grep br-lan | awk '{print $10}'`
ip=`ifconfig ${myinterface} | grep inet | cut -d: -f2 | awk '{ print $1}'`
if [ "${actualip}" != ${ip} ]; then
starttime=`date +%s`
actualip=$ip
fi
actualtime=`date +%s`
myuptime=$((${actualtime}-${starttime}))
mymods=$((${myuptime} % 60))
mymodm=$((((${myuptime}-${mymods}) % 3600)/60))
mymodh=$((((${myuptime}-${mymodm}) % 86400)/3600))
mydate=`date +%d.%m.%y`
mytime=`date +%k:%M`
avrx=$(((${rx}-${oldrx})/1024/10))
avtx=$(((${tx}-${oldtx})/1024/10))
printf "%s %sIP up: %02dh %02dm %02ds IP: %s%$((16-${#ip}))sIN:%3dkbs OUT:%3dkbs" ${mydate} ${mytime} ${mymodh} ${mymodm} ${mymods} ${ip} " " ${avrx} ${avtx} > /dev/tts/1
sleep 10
done