iwinfo: implement proper hardware detection for ar23xx SoC devices like the NanoStation 2
[openwrt/staging/chunkeey.git] / package / iwinfo / src / iwinfo_nl80211.c
index e8cfb902f04c5ad20166bbe8b3037b8b2c1f8d01..5c6f7a8ef8dcffe1d4ef7123098d8b696043a2dd 100644 (file)
@@ -1646,7 +1646,7 @@ int nl80211_get_hardware_id(const char *ifname, char *buf)
                /* Reuse existing interface */
                if ((res = nl80211_phy2ifname(ifname)) != NULL)
                {
-                       return wext_get_hardware_id(res, buf);
+                       rv = wext_get_hardware_id(res, buf);
                }
 
                /* Need to spawn a temporary iface for finding IDs */
@@ -1654,11 +1654,20 @@ int nl80211_get_hardware_id(const char *ifname, char *buf)
                {
                        rv = wext_get_hardware_id(res, buf);
                        nl80211_ifdel(res);
-                       return rv;
                }
        }
+       else
+       {
+               rv = wext_get_hardware_id(ifname, buf);
+       }
 
-       return wext_get_hardware_id(ifname, buf);
+       /* Failed to obtain hardware IDs, search board config */
+       if (rv)
+       {
+               rv = iwinfo_hardware_id_from_mtd(buf);
+       }
+
+       return rv;
 }
 
 static const struct iwinfo_hardware_entry *