]> err.no Git - linux-2.6/commitdiff
mac80211: add phy information to giwname
authorTomas Winkler <tomas.winkler@intel.com>
Tue, 24 Jun 2008 12:50:17 +0000 (15:50 +0300)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 27 Jun 2008 13:09:20 +0000 (09:09 -0400)
This patch add phy information to giwname.

Quoting:
It's not useless, it's supposed to tell you about the protocol
capability of the device, like "IEEE 802.11b" or "IEEE 802.11abg"

Jean

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
net/mac80211/wext.c

index 5e76ab120cd60822e6f4096fe6c96cdc5c816334..df0531c28141e99fcfb33f0f9362295e9eb22f6a 100644 (file)
@@ -135,7 +135,39 @@ static int ieee80211_ioctl_giwname(struct net_device *dev,
                                   struct iw_request_info *info,
                                   char *name, char *extra)
 {
+       struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
+       struct ieee80211_supported_band *sband;
+       u8 is_ht = 0, is_a = 0, is_b = 0, is_g = 0;
+
+
+       sband = local->hw.wiphy->bands[IEEE80211_BAND_5GHZ];
+       if (sband) {
+               is_a = 1;
+               is_ht |= sband->ht_info.ht_supported;
+       }
+
+       sband = local->hw.wiphy->bands[IEEE80211_BAND_2GHZ];
+       if (sband) {
+               int i;
+               /* Check for mandatory rates */
+               for (i = 0; i < sband->n_bitrates; i++) {
+                       if (sband->bitrates[i].bitrate == 10)
+                               is_b = 1;
+                       if (sband->bitrates[i].bitrate == 60)
+                               is_g = 1;
+               }
+               is_ht |= sband->ht_info.ht_supported;
+       }
+
        strcpy(name, "IEEE 802.11");
+       if (is_a)
+               strcat(name, "a");
+       if (is_b)
+               strcat(name, "b");
+       if (is_g)
+               strcat(name, "g");
+       if (is_ht)
+               strcat(name, "n");
 
        return 0;
 }