2010-04-11 17:47:23 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Copyright (C) 2010 OpenWrt.org
|
|
|
|
#
|
|
|
|
|
2011-12-05 17:27:03 +00:00
|
|
|
ramips_get_mac_binary()
|
|
|
|
{
|
|
|
|
local mtdname="$1"
|
|
|
|
local seek="$2"
|
|
|
|
local part
|
|
|
|
|
|
|
|
. /lib/functions.sh
|
|
|
|
|
|
|
|
part=$(find_mtd_part "$mtdname")
|
|
|
|
if [ -z "$part" ]; then
|
|
|
|
echo "ramips_get_mac_binary: partition $mtdname not found!" >&2
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
|
|
|
dd bs=1 skip=$seek count=6 if=$part 2>/dev/null | /usr/sbin/maccalc bin2mac
|
|
|
|
}
|
|
|
|
|
|
|
|
ramips_get_mac_nvram()
|
|
|
|
{
|
|
|
|
local mtdname="$1"
|
|
|
|
local key="$2"
|
|
|
|
local part
|
|
|
|
local mac_dirty
|
|
|
|
|
|
|
|
. /lib/functions.sh
|
|
|
|
|
|
|
|
part=$(find_mtd_part "$mtdname")
|
|
|
|
if [ -z "$part" ]; then
|
|
|
|
echo "ramips_get_mac_nvram: partition $mtdname not found!" >&2
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
|
|
|
mac_dirty=$(strings "$part" | sed -n 's/'"$key"'=//p')
|
|
|
|
# "canonicalize" mac
|
|
|
|
/usr/sbin/maccalc add "$mac_dirty" 0
|
|
|
|
}
|
|
|
|
|
2010-04-11 17:47:23 +00:00
|
|
|
ramips_board_name() {
|
|
|
|
local machine
|
|
|
|
local name
|
|
|
|
|
|
|
|
machine=$(awk 'BEGIN{FS="[ \t]+:[ \t]"} /machine/ {print $2}' /proc/cpuinfo)
|
|
|
|
|
|
|
|
case "$machine" in
|
2012-07-12 13:29:46 +00:00
|
|
|
*"Edimax 3g-6200n")
|
|
|
|
name="3g-6200n"
|
|
|
|
;;
|
2012-01-24 11:48:47 +00:00
|
|
|
*"Allnet ALL0256N")
|
|
|
|
name="all0256n"
|
|
|
|
;;
|
2012-03-29 16:03:04 +00:00
|
|
|
*"ARC FreeStation5")
|
|
|
|
name="freestation5"
|
|
|
|
;;
|
2011-08-15 14:11:45 +00:00
|
|
|
*"Argus ATP-52B")
|
|
|
|
name="argus-atp52b"
|
|
|
|
;;
|
2012-03-27 19:29:57 +00:00
|
|
|
*"Asus WL-330N")
|
|
|
|
name="wl-330n"
|
|
|
|
;;
|
2012-04-23 16:56:05 +00:00
|
|
|
*"Asus WL-330N3G")
|
|
|
|
name="wl-330n3g"
|
|
|
|
;;
|
2011-07-03 15:01:56 +00:00
|
|
|
*"Aztech HW550-3G")
|
|
|
|
name="hw550-3g"
|
|
|
|
;;
|
2011-07-28 10:56:22 +00:00
|
|
|
*"DIR-300 B1")
|
2010-04-11 17:47:23 +00:00
|
|
|
name="dir-300-b1"
|
|
|
|
;;
|
2011-07-28 10:56:24 +00:00
|
|
|
*"DIR-600 B1")
|
|
|
|
name="dir-600-b1"
|
|
|
|
;;
|
|
|
|
*"DIR-600 B2")
|
|
|
|
name="dir-600-b2"
|
|
|
|
;;
|
2011-12-23 14:27:10 +00:00
|
|
|
*"ESR-9753")
|
|
|
|
name="esr-9753"
|
|
|
|
;;
|
2011-12-28 08:43:43 +00:00
|
|
|
*"F5D8235 v1")
|
|
|
|
name="f5d8235-v1"
|
|
|
|
;;
|
2011-07-03 15:01:56 +00:00
|
|
|
*"F5D8235 v2")
|
|
|
|
name="f5d8235-v2"
|
|
|
|
;;
|
2010-04-11 17:47:23 +00:00
|
|
|
*"La Fonera 2.0N")
|
|
|
|
name="fonera20n"
|
|
|
|
;;
|
2011-07-03 15:01:56 +00:00
|
|
|
*"MoFi Network MOFI3500-3GN")
|
|
|
|
name="mofi3500-3gn"
|
|
|
|
;;
|
2011-08-22 20:41:49 +00:00
|
|
|
*"NBG-419N")
|
|
|
|
name="nbg-419n"
|
|
|
|
;;
|
2011-10-24 21:49:36 +00:00
|
|
|
*"NexAira BC2")
|
|
|
|
name="bc2"
|
|
|
|
;;
|
2011-07-28 10:56:32 +00:00
|
|
|
*"NW718")
|
|
|
|
name="nw718"
|
|
|
|
;;
|
2011-12-14 20:51:26 +00:00
|
|
|
*"Omnima MiniEMBWiFi")
|
|
|
|
name="omni-emb"
|
|
|
|
;;
|
2012-06-19 09:52:15 +00:00
|
|
|
*"Petatel PSR-680W"*)
|
|
|
|
name="psr-680w"
|
|
|
|
;;
|
2011-07-03 15:01:56 +00:00
|
|
|
*"PWH2004")
|
|
|
|
name="pwh2004"
|
|
|
|
;;
|
2011-07-28 10:56:30 +00:00
|
|
|
*"RT-G32 B1")
|
|
|
|
name="rt-g32-b1"
|
|
|
|
;;
|
2012-03-04 16:09:11 +00:00
|
|
|
*"RT-N10+")
|
|
|
|
name="rt-n10-plus"
|
|
|
|
;;
|
2011-07-03 15:01:56 +00:00
|
|
|
*"RT-N15")
|
|
|
|
name="rt-n15"
|
|
|
|
;;
|
2012-02-13 15:18:04 +00:00
|
|
|
*"RT-N56U")
|
|
|
|
name="rt-n56u"
|
|
|
|
;;
|
2012-02-19 16:44:49 +00:00
|
|
|
*"Skyline SL-R7205"*)
|
|
|
|
name="sl-r7205"
|
|
|
|
;;
|
2012-01-23 10:23:32 +00:00
|
|
|
*"Sparklan WCR-150GN")
|
2011-07-03 15:01:56 +00:00
|
|
|
name="wcr-150gn"
|
|
|
|
;;
|
2010-04-11 17:47:23 +00:00
|
|
|
*"V22RW-2X2")
|
|
|
|
name="v22rw-2x2"
|
|
|
|
;;
|
2011-12-28 08:43:32 +00:00
|
|
|
*"W502U")
|
|
|
|
name="w502u"
|
|
|
|
;;
|
2010-04-11 17:47:23 +00:00
|
|
|
*"WHR-G300N")
|
|
|
|
name="whr-g300n"
|
|
|
|
;;
|
2012-01-26 10:44:23 +00:00
|
|
|
*"Sitecom WL-341 v3")
|
|
|
|
name="wl341v3"
|
|
|
|
;;
|
2011-12-23 14:27:16 +00:00
|
|
|
*"Sitecom WL-351 v1 002")
|
|
|
|
name="wl-351"
|
|
|
|
;;
|
2012-04-21 12:30:40 +00:00
|
|
|
*"Tenda W306R V2.0")
|
|
|
|
name="w306r-v20"
|
|
|
|
;;
|
2012-02-15 21:13:11 +00:00
|
|
|
*"Ralink V11ST-FE")
|
|
|
|
name="v11st-fe"
|
|
|
|
;;
|
2011-12-27 16:56:30 +00:00
|
|
|
*"WLI-TX4-AG300N")
|
|
|
|
name="wli-tx4-ag300n"
|
|
|
|
;;
|
2011-07-03 15:01:56 +00:00
|
|
|
*"WZR-AGL300NH")
|
|
|
|
name="wzr-agl300nh"
|
2011-04-04 08:43:07 +00:00
|
|
|
;;
|
2011-08-22 18:08:45 +00:00
|
|
|
*"WR512-3GN-like router")
|
2011-08-19 15:55:10 +00:00
|
|
|
name="wr512-3gn"
|
|
|
|
;;
|
2012-04-23 16:56:06 +00:00
|
|
|
*"UR-336UN Wireless N router")
|
|
|
|
name="ur-336un"
|
|
|
|
;;
|
2012-02-11 15:11:36 +00:00
|
|
|
*"AWB WR6202")
|
|
|
|
name="wr6202"
|
|
|
|
;;
|
2012-03-04 16:09:13 +00:00
|
|
|
*"XDX RN502J")
|
|
|
|
name="xdxrn502j"
|
|
|
|
;;
|
2010-04-11 17:47:23 +00:00
|
|
|
*)
|
|
|
|
name="generic"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
echo $name
|
|
|
|
}
|