summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorMilind Murhekar <m.murhekar@samsung.com>2018-09-21 19:36:20 +0530
committerMilind Murhekar <m.murhekar@samsung.com>2018-10-05 14:30:51 +0530
commit3c5d316b64f60ee6fb7b2bb85c22fad385cb0f91 (patch)
tree4eabf0d0bfb9780fdecb13938ff16660d6652e06 /plugins
parent071fe548f78efbfa84ee6841c013713903a7e28c (diff)
downloadconnman-3c5d316b64f60ee6fb7b2bb85c22fad385cb0f91.tar.gz
connman-3c5d316b64f60ee6fb7b2bb85c22fad385cb0f91.tar.bz2
connman-3c5d316b64f60ee6fb7b2bb85c22fad385cb0f91.zip
Add IEEE 802.11 protocol(b/g/n/a/ac) Modes of APs
This patch appends the IEEE 802.11b/g/n/a/ac PHY protocol modes of scanned Access Points using internal logic. Following logic is used to determine WLAN HW protocol:- 1) If “Supported rates” is only till 11 Mbps, and frequency is in 2.4GHz band, then protocol is 802.11B. 2) If “Supported rates” is till 54Mbps or “Extended supported rates” are present, and frequency is in 2.4GHz band, then protocol is 802.11G. 3) If “Supported rates” is only till 54 Mbps, frequency is in 5GHz band , then protocol is 802.11A. 4) If “HT capabilities” is supported , then protocol is 802.11N. 5) If “HT capabilities” & “VHT” is supported and frequency is in 5 GHz band, then protocol is 802.11AC. Change-Id: I1156ef249cf4a8052a883d31da66788c7d2de22f
Diffstat (limited to 'plugins')
-rw-r--r--plugins/wifi.c81
1 files changed, 80 insertions, 1 deletions
diff --git a/plugins/wifi.c b/plugins/wifi.c
index 92e70f42..33425e02 100644
--- a/plugins/wifi.c
+++ b/plugins/wifi.c
@@ -3429,6 +3429,77 @@ static int network_disconnect(struct connman_network *network)
#if defined TIZEN_EXT
static unsigned int automaxspeed_timeout = 0;
+static void set_connection_mode(struct connman_network *network,
+ int linkspeed)
+{
+ ieee80211_modes_e phy_mode;
+ connection_mode_e conn_mode;
+
+ phy_mode = connman_network_get_phy_mode(network);
+ switch (phy_mode) {
+ case IEEE80211_MODE_B:
+ if (linkspeed > 0 && linkspeed <= 11)
+ conn_mode = CONNECTION_MODE_IEEE80211B;
+ else
+ conn_mode = CONNECTION_MODE_IEEE80211_UNKNOWN;
+
+ break;
+ case IEEE80211_MODE_BG:
+ if (linkspeed > 0 && linkspeed <= 11)
+ conn_mode = CONNECTION_MODE_IEEE80211B;
+ else if (linkspeed > 11 && linkspeed <= 54)
+ conn_mode = CONNECTION_MODE_IEEE80211G;
+ else
+ conn_mode = CONNECTION_MODE_IEEE80211_UNKNOWN;
+
+ break;
+ case IEEE80211_MODE_BGN:
+ if (linkspeed > 0 && linkspeed <= 11)
+ conn_mode = CONNECTION_MODE_IEEE80211B;
+ else if (linkspeed > 11 && linkspeed <= 54)
+ conn_mode = CONNECTION_MODE_IEEE80211G;
+ else if (linkspeed > 54 && linkspeed <= 450)
+ conn_mode = CONNECTION_MODE_IEEE80211N;
+ else
+ conn_mode = CONNECTION_MODE_IEEE80211_UNKNOWN;
+
+ break;
+ case IEEE80211_MODE_A:
+ if (linkspeed > 0 && linkspeed <= 54)
+ conn_mode = CONNECTION_MODE_IEEE80211A;
+ else
+ conn_mode = CONNECTION_MODE_IEEE80211_UNKNOWN;
+
+ break;
+ case IEEE80211_MODE_AN:
+ if (linkspeed > 0 && linkspeed <= 54)
+ conn_mode = CONNECTION_MODE_IEEE80211A;
+ else if (linkspeed > 54 && linkspeed <= 450)
+ conn_mode = CONNECTION_MODE_IEEE80211N;
+ else
+ conn_mode = CONNECTION_MODE_IEEE80211_UNKNOWN;
+
+ break;
+ case IEEE80211_MODE_ANAC:
+ if (linkspeed > 0 && linkspeed <= 54)
+ conn_mode = CONNECTION_MODE_IEEE80211A;
+ else if (linkspeed > 54 && linkspeed <= 450)
+ conn_mode = CONNECTION_MODE_IEEE80211N;
+ else if (linkspeed > 450 && linkspeed <= 1300)
+ conn_mode = CONNECTION_MODE_IEEE80211AC;
+ else
+ conn_mode = CONNECTION_MODE_IEEE80211_UNKNOWN;
+
+ break;
+ default:
+ conn_mode = CONNECTION_MODE_IEEE80211_UNKNOWN;
+ break;
+ }
+
+ DBG("connection mode(%d)", conn_mode);
+ connman_network_set_connection_mode(network, conn_mode);
+}
+
static void signalpoll_callback(int result, int maxspeed, void *user_data)
{
struct connman_network *network = user_data;
@@ -3439,8 +3510,10 @@ static void signalpoll_callback(int result, int maxspeed, void *user_data)
}
DBG("maxspeed = %d", maxspeed);
- if (network)
+ if (network) {
connman_network_set_maxspeed(network, maxspeed);
+ set_connection_mode(network, maxspeed);
+ }
}
static int network_signalpoll(struct connman_network *network)
@@ -4256,6 +4329,7 @@ static void network_added(GSupplicantNetwork *supplicant_network)
#if defined TIZEN_EXT
GSList *vsie_list = NULL;
const unsigned char *country_code;
+ ieee80211_modes_e phy_mode;
#endif
mode = g_supplicant_network_get_mode(supplicant_network);
@@ -4320,6 +4394,8 @@ static void network_added(GSupplicantNetwork *supplicant_network)
DBG("vsie_list is NULL");
country_code = g_supplicant_network_get_countrycode(supplicant_network);
connman_network_set_countrycode(network, country_code);
+ phy_mode = g_supplicant_network_get_phy_mode(supplicant_network);
+ connman_network_set_phy_mode(network, phy_mode);
#endif
connman_network_set_string(network, "WiFi.Security", security);
connman_network_set_strength(network,
@@ -4453,6 +4529,7 @@ static void network_changed(GSupplicantNetwork *network, const char *property)
uint16_t frequency;
bool wps;
const unsigned char *country_code;
+ ieee80211_modes_e phy_mode;
GSList *bssid_list;
#endif
@@ -4481,6 +4558,7 @@ static void network_changed(GSupplicantNetwork *network, const char *property)
maxrate = g_supplicant_network_get_maxrate(network);
frequency = g_supplicant_network_get_frequency(network);
wps = g_supplicant_network_get_wps(network);
+ phy_mode = g_supplicant_network_get_phy_mode(network);
connman_network_set_bssid(connman_network, bssid);
connman_network_set_maxrate(connman_network, maxrate);
@@ -4490,6 +4568,7 @@ static void network_changed(GSupplicantNetwork *network, const char *property)
connman_network_set_countrycode(connman_network, country_code);
bssid_list = (GSList *)g_supplicant_network_get_bssid_list(network);
connman_network_set_bssid_list(connman_network, bssid_list);
+ connman_network_set_phy_mode(connman_network, phy_mode);
#endif
}