summaryrefslogtreecommitdiff
path: root/package/iwinfo/src/iwinfo_wl.c
diff options
context:
space:
mode:
authorjow <jow@3c298f89-4303-0410-b956-a3cf2f4a3e73>2011-12-04 03:42:17 +0000
committerjow <jow@3c298f89-4303-0410-b956-a3cf2f4a3e73>2011-12-04 03:42:17 +0000
commitc02a9bd7aaf1e6fbfa829ec2e1b66cefce3268c5 (patch)
treea6a2ff8f2ef405ee8a79e1e5ba92689d9d485512 /package/iwinfo/src/iwinfo_wl.c
parentec376e8870e7adc1b6fb76913cf007b336e7f546 (diff)
[package] iwinfo: add initial hardware detection capabilities
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@29421 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/iwinfo/src/iwinfo_wl.c')
-rw-r--r--package/iwinfo/src/iwinfo_wl.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/package/iwinfo/src/iwinfo_wl.c b/package/iwinfo/src/iwinfo_wl.c
index b3227918d4..76984de336 100644
--- a/package/iwinfo/src/iwinfo_wl.c
+++ b/package/iwinfo/src/iwinfo_wl.c
@@ -135,6 +135,7 @@ int wl_get_frequency(const char *ifname, int *buf)
int wl_get_txpower(const char *ifname, int *buf)
{
+ /* WLC_GET_VAR "qtxpower" */
return wext_get_txpower(ifname, buf);
}
@@ -556,3 +557,31 @@ int wl_get_mbssid_support(const char *ifname, int *buf)
return -1;
}
+
+int wl_get_hardware_id(const char *ifname, char *buf)
+{
+ wlc_rev_info_t revinfo;
+ struct iwinfo_hardware_id *ids = (struct iwinfo_hardware_id *)buf;
+
+ if (wl_ioctl(ifname, WLC_GET_REVINFO, &revinfo, sizeof(revinfo)))
+ return -1;
+
+ ids->vendor_id = revinfo.vendorid;
+ ids->device_id = revinfo.deviceid;
+ ids->subsystem_vendor_id = revinfo.boardvendor;
+ ids->subsystem_device_id = revinfo.boardid;
+
+ return 0;
+}
+
+int wl_get_hardware_name(const char *ifname, char *buf)
+{
+ struct iwinfo_hardware_id ids;
+
+ if (wl_get_hardware_id(ifname, (char *)&ids))
+ return -1;
+
+ sprintf(buf, "Broadcom BCM%04X", ids.device_id);
+
+ return 0;
+}