+ /* Look for a model identifier */
+
+ /* Based on "model_name" */
+ if (buf = nvram_get("model_name")) {
+ if (!strcmp(buf, "DIR-130"))
+ return &platforms[DIR130];
+ if (!strcmp(buf, "DIR-330"))
+ return &platforms[DIR330];
+ }
+
+ /* Based on "model_no" */
+ if (buf = nvram_get("model_no")) {
+ if (startswith(buf,"WL700")) /* WL700* */
+ return &platforms[WL700GE];
+ }
+
+ /* Based on "hardware_version" */
+ if (buf = nvram_get("hardware_version")) {
+ if (startswith(buf,"WL500GPV2-")) /* WL500GPV2-* */
+ return &platforms[WL500GPV2];
+ if (startswith(buf,"WL520GU-")) /* WL520GU-* */
+ return &platforms[WL520GU];
+ }
+
+ /* Based on "ModelId" */
+ if (buf = nvram_get("ModelId")) {
+ if (!strcmp(buf, "WR850GP"))
+ return &platforms[WR850GP];
+ if (!strcmp(buf,"WX-5565"))
+ return &platforms[TM2300];
+ if (startswith(buf,"WE800G")) /* WE800G* */
+ return &platforms[WE800G];
+ }
+
+ /* Buffalo */
+ if ((buf = (nvram_get("melco_id") ?: nvram_get("buffalo_id")))) {
+ /* Buffalo hardware, check id for specific hardware matches */
+ if (!strcmp(buf, "29bb0332"))
+ return &platforms[WBR2_G54];
+ if (!strcmp(buf, "29129"))
+ return &platforms[WLA2_G54L];
+ if (!strcmp(buf, "30189"))
+ return &platforms[WHR_HP_G54];
+ if (!strcmp(buf, "32093"))
+ return &platforms[WHR_G125];
+ if (!strcmp(buf, "30182"))
+ return &platforms[WHR_G54S];
+ if (!strcmp(buf, "290441dd"))
+ return &platforms[WHR2_A54G54];
+ if (!strcmp(buf, "31120"))
+ return &platforms[WZR_G300N];
+ if (!strcmp(buf, "30083"))
+ return &platforms[WZR_RS_G54];
+ if (!strcmp(buf, "30103"))
+ return &platforms[WZR_RS_G54HP];
+ }
+
+ /* no easy model number, attempt to guess */
+ boardnum = getvar("boardnum");
+ boardtype = getvar("boardtype");
+
+ if (startswith(getvar("pmon_ver"), "CFE")) {