about summary refs log tree commit diff
path: root/src/platform/wifi/wifi-utils-wext.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/platform/wifi/wifi-utils-wext.c')
-rw-r--r--src/platform/wifi/wifi-utils-wext.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/platform/wifi/wifi-utils-wext.c b/src/platform/wifi/wifi-utils-wext.c
index e0331de7..8428010a 100644
--- a/src/platform/wifi/wifi-utils-wext.c
+++ b/src/platform/wifi/wifi-utils-wext.c
@@ -569,6 +569,7 @@ wifi_wext_init (const char *iface, int ifindex, gboolean check_scan)
 	guint32 response_len = 0;
 	struct iw_range_with_scan_capa *scan_capa_range;
 	int i;
+	gboolean freq_valid = FALSE, has_5ghz = FALSE, has_2ghz = FALSE;
 
 	wext = wifi_data_new (iface, ifindex, sizeof (*wext));
 	wext->parent.get_mode = wifi_wext_get_mode;
@@ -609,8 +610,14 @@ wifi_wext_init (const char *iface, int ifindex, gboolean check_scan)
 	wext->max_qual.updated = range.max_qual.updated;
 
 	wext->num_freqs = MIN (range.num_frequency, IW_MAX_FREQUENCIES);
-	for (i = 0; i < wext->num_freqs; i++)
+	for (i = 0; i < wext->num_freqs; i++) {
 		wext->freqs[i] = iw_freq_to_uint32 (&range.freq[i]);
+		freq_valid = TRUE;
+		if (wext->freqs[i] > 2400 && wext->freqs[i] < 2500)
+			has_2ghz = TRUE;
+		else if (wext->freqs[i] > 4900 && wext->freqs[i] < 6000)
+			has_5ghz = TRUE;
+	}
 
 	/* Check for scanning capability; cards that can't scan are not supported */
 	if (check_scan && (wext_can_scan (wext) == FALSE)) {
@@ -638,6 +645,12 @@ wifi_wext_init (const char *iface, int ifindex, gboolean check_scan)
 	}
 
 	wext->parent.caps = wext_get_caps (wext, &range);
+	if (freq_valid)
+		wext->parent.caps |= NM_WIFI_DEVICE_CAP_FREQ_VALID;
+	if (has_2ghz)
+		wext->parent.caps |= NM_WIFI_DEVICE_CAP_FREQ_2GHZ;
+	if (has_5ghz)
+		wext->parent.caps |= NM_WIFI_DEVICE_CAP_FREQ_5GHZ;
 
 	nm_log_info (LOGD_HW | LOGD_WIFI,
 	             "(%s): using WEXT for WiFi device control",