[PATCH 1/3] ichannel and frequency added in interface capability properties on dbus

Avichal Agarwal avichal.a at samsung.com
Mon Dec 19 05:57:15 PST 2016


function will help to extract the supported channels and frequencies

Signed-off-by: Avichal Agarwal <avichal.a at samsung.com>
Signed-off-by: Mayank Haarit <mayank.h at samsung.com>
Signed-off-by: Kyeong-Chae Lim <kcya.lim at samsung.com>
---
 wpa_supplicant/wpa_supplicant.c   | 39 +++++++++++++++++++++++++++++++++++++++
 wpa_supplicant/wpa_supplicant_i.h |  3 ++-
 2 files changed, 41 insertions(+), 1 deletion(-)

diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index 214b9b3..a188476 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -6936,3 +6936,42 @@ int wpa_is_bss_tmp_disallowed(struct wpa_supplicant *wpa_s, const u8 *bssid)
 		   MAC2STR(bss->bssid), age.sec, age.usec);
 	return 1;
 }
+
+int  wpas_get_channel_freq(struct wpa_supplicant *wpa_s, int *buff,int flag)
+{
+	struct hostapd_channel_data *chnl;
+	int i, j,k=0;
+
+	for (j = 0; j < wpa_s->hw.num_modes; j++) {
+		switch (wpa_s->hw.modes[j].mode) {
+		case HOSTAPD_MODE_IEEE80211B:
+			break;
+		case HOSTAPD_MODE_IEEE80211G:
+			break;
+		case HOSTAPD_MODE_IEEE80211A:
+			break;
+		case HOSTAPD_MODE_IEEE80211AD:
+			break;
+		default:
+			continue;
+		}
+		chnl = wpa_s->hw.modes[j].channels;
+		for (i = 0; i < wpa_s->hw.modes[j].num_channels; i++) {
+			if (chnl[i].flag & HOSTAPD_CHAN_DISABLED)
+				continue;
+			if(k<1024){
+				if(flag==1)
+					buff[k] =chnl[i].chan;
+				else if(flag==2)
+					buff[k] = chnl[i].freq;
+				else{
+
+				}
+				k++;
+			}
+
+		}
+	}
+	return k;
+
+}
diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h
index f03d51a..c344220 100644
--- a/wpa_supplicant/wpa_supplicant_i.h
+++ b/wpa_supplicant/wpa_supplicant_i.h
@@ -1078,7 +1078,6 @@ struct wpa_supplicant {
 	struct os_reltime lci_time;
 };
 
-
 /* wpa_supplicant.c */
 void wpa_supplicant_apply_ht_overrides(
 	struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid,
@@ -1307,4 +1306,6 @@ struct wpa_ssid * wpa_scan_res_match(struct wpa_supplicant *wpa_s,
 				     struct wpa_ssid *group,
 				     int only_first_ssid, int debug_print);
 
+int  wpas_get_channel_freq(struct wpa_supplicant *wpa_s, int *buff,int flag);
+
 #endif /* WPA_SUPPLICANT_I_H */
-- 
2.7.4




More information about the Hostap mailing list