summaryrefslogtreecommitdiff
path: root/package/iwinfo/src/iwinfo_utils.c
diff options
context:
space:
mode:
authorjow <jow@3c298f89-4303-0410-b956-a3cf2f4a3e73>2012-08-15 16:25:38 +0000
committerjow <jow@3c298f89-4303-0410-b956-a3cf2f4a3e73>2012-08-15 16:25:38 +0000
commit1110c121f9730b89ced2f9313f5f54ab84a3cf42 (patch)
tree9705fc83b6bc133ab08fefa46d94813c62b2f9fc /package/iwinfo/src/iwinfo_utils.c
parent30ea4fa0fbe4e3692114e8b742256751f6bc3fff (diff)
iwinfo: add hw info support for Rt3xxx SoCs
This takes the device_id and subsystem_id from the EEPROM, I'll add the info for other Rt3xxx chips in the next days. [jow: minor whitespace changes] Signed-off-by: Daniel Golle <dgolle@allnet.de> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@33199 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/iwinfo/src/iwinfo_utils.c')
-rw-r--r--package/iwinfo/src/iwinfo_utils.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/package/iwinfo/src/iwinfo_utils.c b/package/iwinfo/src/iwinfo_utils.c
index 514f34bf9b..164e51f847 100644
--- a/package/iwinfo/src/iwinfo_utils.c
+++ b/package/iwinfo/src/iwinfo_utils.c
@@ -165,7 +165,8 @@ 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, "\"EEPROM\"")))
+ (strcmp(buf, "\"boardconfig\"") && strcmp(buf, "\"EEPROM\"") &&
+ strcmp(buf, "\"factory\"")))
{
off = -1;
continue;
@@ -212,6 +213,26 @@ int iwinfo_hardware_id_from_mtd(struct iwinfo_hardware_id *id)
id->subsystem_device_id = bc[off + 0x14];
break;
}
+
+ /* Rt3xxx SoC */
+ else if ((bc[off] == 0x3352) || (bc[off] == 0x5233) ||
+ (bc[off] == 0x3350) || (bc[off] == 0x5033) ||
+ (bc[off] == 0x3050) || (bc[off] == 0x5030) ||
+ (bc[off] == 0x3052) || (bc[off] == 0x5230))
+ {
+ /* vendor: RaLink */
+ id->vendor_id = 0x1814;
+ id->subsystem_vendor_id = 0x1814;
+
+ /* device */
+ if (bc[off] & 0xf0 == 0x30)
+ id->device_id = (bc[off] >> 8) | (bc[off] & 0x00ff) << 8;
+ else
+ id->device_id = bc[off];
+
+ /* subsystem from EEPROM_NIC_CONF0_RF_TYPE */
+ id->subsystem_device_id = (bc[off + 0x1a] & 0x0f00) >> 8;
+ }
}
munmap(bc, len);