###########################################################
# identification of the device
#
device_name=$(nvram get device_name)
[ -z "$device_name" ] && [ -f "/proc/diag/model" ] && device_name=$(cat "/proc/diag/model")
while [ -z "$device_name" ]; do
dd bs=1024 skip=212 count=16 if=/dev/mtd/0 2>/dev/null | strings | grep -q W54G
[ $? = "0" ] && {
device_name="Linksys WRT54G"
break
}
dd bs=1024 count=1 skip=5 if=/dev/mtd/0 2>/dev/null | strings | grep "WL500gp"
[ $? = "0" ] && {
device_name="ASUS WL-500gp"
break
}
break
if [ -e $(nvram get hardware_version) ]; then
device_name=$(nvram get hardware_version)
fi
break
done
nvram set "device_name=$device_name"
# do not commit changes:
# our id code is fast, we'll do it every boot until user does a commit for some other reason.
echo "Device: $device_name"