+ if (strcmp(getvar("nvram_type"), "cfe") == 0)
+ return &platforms[WGT634U];
+
+ /* 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 "wsc_modelname */
+ if ((buf = nvram_get("wsc_modelname"))) {
+ if (!strcmp(buf, "WRT610N"))
+ return &platforms[WRT610N];
+ }
+
+ /* 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,"WL520GC-")) /* WL520GU-* */
+ return &platforms[WL520GC];
+ if (startswith(buf,"WL520GU-")) /* WL520GU-* */
+ return &platforms[WL520GU];
+ if (startswith(buf,"WL330GE-")) /* WL330GE-* */
+ return &platforms[WL330GE];
+ }
+
+ /* Based on "ModelId" */
+ if ((buf = nvram_get("ModelId"))) {
+ if (!strcmp(buf, "WR850GP"))
+ return &platforms[WR850GP];
+ if (!strcmp(buf, "WR850G"))
+ return &platforms[WR850GV2V3];
+ if (!strcmp(buf, "WX-5565") && !strcmp(getvar("boardtype"),"bcm94710ap"))
+ return &platforms[TM2300]; /* Dell TrueMobile 2300 */
+ 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 */