iwinfo: recognize AR5416 EEPROMs as seen on the Ubiquiti Picostation M2
authorJo-Philipp Wich <jow@openwrt.org>
Mon, 20 Feb 2012 21:17:59 +0000 (21:17 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Mon, 20 Feb 2012 21:17:59 +0000 (21:17 +0000)
SVN-Revision: 30663

package/iwinfo/Makefile
package/iwinfo/src/iwinfo_utils.c

index 721de49543e13f7a12bbb94762692b451de0b097..d58d62d4696064af7d939ce8824db5656faa7108 100644 (file)
@@ -7,7 +7,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=libiwinfo
-PKG_RELEASE:=27
+PKG_RELEASE:=28
 
 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
 PKG_CONFIG_DEPENDS := \
index ec6aa2233f38ac38cc6e1ea752785fde964cad44..78ea52b4abb319f685eaabb84f2a79025896cd1c 100644 (file)
@@ -165,7 +165,7 @@ int iwinfo_hardware_id_from_mtd(struct iwinfo_hardware_id *id)
        while (fgets(buf, sizeof(buf), mtd) > 0)
        {
                if (fscanf(mtd, "mtd%d: %*x %x %127s", &off, &len, buf) < 3 ||
-                   strcmp(buf, "\"boardconfig\""))
+                   strcmp(buf, "\"boardconfig\"") || strcmp(buf, "\"EEPROM\""))
                {
                        off = -1;
                        continue;
@@ -193,6 +193,7 @@ int iwinfo_hardware_id_from_mtd(struct iwinfo_hardware_id *id)
 
                for (off = len / 2 - 0x800; off >= 0; off -= 0x800)
                {
+                       /* AR531X board data magic */
                        if ((bc[off] == 0x3533) && (bc[off + 1] == 0x3131))
                        {
                                id->vendor_id = bc[off + 0x7d];
@@ -201,6 +202,16 @@ int iwinfo_hardware_id_from_mtd(struct iwinfo_hardware_id *id)
                                id->subsystem_device_id = bc[off + 0x83];
                                break;
                        }
+
+                       /* AR5416 EEPROM magic */
+                       else if ((bc[off] == 0xA55A) || (bc[off] == 0x5AA5))
+                       {
+                               id->vendor_id = bc[off + 0x0D];
+                               id->device_id = bc[off + 0x0E];
+                               id->subsystem_vendor_id = bc[off + 0x13];
+                               id->subsystem_device_id = bc[off + 0x14];
+                               break;
+                       }
                }
 
                munmap(bc, len);