It also allows you to write a watchdog driver in shell :-)
#!/bin/sh
# Padraig@antefacto.com
# This supports both the Ibase MB700 and Advantech PCM9576
usage() {
echo "Usage: `basename $0` [pat] [playdead]"
exit 1
}
if [ $# != 1 ]; then usage; fi;
if [ $1 != "pat" ]; then
if [ $1 != "playdead" ]; then
usage
fi
fi
HW_VERSION=`cat /var/run/HW_VERSION`
if [ "$HW_VERSION" == "IBASE MB700" ];
ENABLE_PORT=`printf %d 0x443`
DISABLE_PORT=`printf %d 0x441`
if [ $1 == "pat" ]; then
TIMEOUT='\x5' #20 seconds (0=30s, 1=28s, ..., F=0s)
printf "$TIMEOUT" | dd bs=1 seek=$ENABLE_PORT of=/dev/port
else
#write any value to port to disable
printf "\001" | dd bs=1 seek=$DISABLE_PORT of=/dev/port
fi
elif [ "$HW_VERSION" == "Advantech PCM9576" ]; then
DISENABLE_PORT=`printf %d 0x443`
if [ $1 == "pat" ]; then
TIMEOUT='\x14' #20 seconds (1=1s, 2=2s, ..., 3E=62s)
printf "$TIMEOUT" | dd bs=1 seek=$DISENABLE_PORT of=/dev/port
else
#read from port to disable
dd bs=1 count=1 skip=$DISENABLE_PORT if=/dev/port of=/dev/null
fi
fi
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/