diff options
author | Sravanthi Palakonda <srapal@codeaurora.org> | 2014-12-03 19:57:37 +0530 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2015-01-21 20:16:37 -0800 |
commit | 27bec7199696bebc2d6d08c6a819cf4fe811a5fc (patch) | |
tree | 23cb6e553b2d0a4a85215e0f669b85b1a107f941 /src | |
parent | 1c081245caf97def1581ab055d33fe2f6f8eff30 (diff) | |
download | android_external_wpa_supplicant_8-27bec7199696bebc2d6d08c6a819cf4fe811a5fc.tar.gz android_external_wpa_supplicant_8-27bec7199696bebc2d6d08c6a819cf4fe811a5fc.tar.bz2 android_external_wpa_supplicant_8-27bec7199696bebc2d6d08c6a819cf4fe811a5fc.zip |
eap_proxy: UI support to get the SIM information.
Framework sends an event GET_SIM_INFO to get the sim card
information such as type of the SIM (2G/3G) and No. of SIMs
supported by the build.
Based on this, the framework will decide which sim supports
what type of EAP methods (SIM/AKA)
msg format: no_of_sims=x sim1=a sim2=b
Change-Id: I32ed7d3a719da2e222a49f8a100046f32028c8e9
CRs-Fixed: 775948
Diffstat (limited to 'src')
-rw-r--r-- | src/eap_peer/eap_proxy.h | 1 | ||||
-rw-r--r-- | src/eap_peer/eap_proxy_qmi.c | 58 |
2 files changed, 59 insertions, 0 deletions
diff --git a/src/eap_peer/eap_proxy.h b/src/eap_peer/eap_proxy.h index 23cdbe69..a737f557 100644 --- a/src/eap_peer/eap_proxy.h +++ b/src/eap_peer/eap_proxy.h @@ -45,5 +45,6 @@ int eap_proxy_get_imsi(struct eap_proxy_sm *eap_proxy, char *imsi_buf, int eap_proxy_notify_config(struct eap_proxy_sm *sm, struct eap_peer_config *config); +size_t eap_proxy_get_sim_info(char *reply_buf, int buf_len); #endif /* EAP_PROXY_H */ diff --git a/src/eap_peer/eap_proxy_qmi.c b/src/eap_peer/eap_proxy_qmi.c index 912b252a..21ee4547 100644 --- a/src/eap_peer/eap_proxy_qmi.c +++ b/src/eap_peer/eap_proxy_qmi.c @@ -162,6 +162,9 @@ static Boolean wpa_qmi_read_card_status(int sim_num); #define EAP_SUB_TYPE_AKA_IDENTITY 0x05 #define EAP_RESP_TYPE_NAK 3 +#define EAP_PROXY_APP_TYPE_SIM BIT(0) +#define EAP_PROXY_APP_TYPE_AKA BIT(1) + /* Call-back function to process QMI system events */ void handle_qmi_sys_events(qmi_sys_event_type eventId, const qmi_sys_event_info_type *eventInfo, void *userData) @@ -2055,4 +2058,59 @@ int eap_proxy_allowed_method (struct eap_peer_config *config, int vendor, return 0; } +size_t eap_proxy_get_sim_info (char *reply_buf, int buf_len) +{ + char *pos, *end; + int i, ret; + int sim_app_type; + + if (buf_len == 0) + return 0; + + pos = reply_buf; + end = pos + buf_len; + + ret = os_snprintf(pos, end - pos, "no_of_sims=%d", MAX_NO_OF_SIM_SUPPORTED); + if (ret < 0 || ret >= end - pos) + return ret; + pos += ret; + + for (i = 0; i < MAX_NO_OF_SIM_SUPPORTED; i++) + { + if (wpa_qmi_read_card_status(i)) { + sim_app_type = 0; + if (wpa_uim[i].card_info[i].app_type == UIM_APP_TYPE_SIM_V01) { + wpa_printf(MSG_ERROR, "eap_proxy: sim%d type is 2G", i+1); + sim_app_type |= EAP_PROXY_APP_TYPE_SIM; + } else if (wpa_uim[i].card_info[i].app_type == UIM_APP_TYPE_USIM_V01) { + wpa_printf(MSG_ERROR, "eap_proxy: sim%d type is 3G", i+1); + sim_app_type |= EAP_PROXY_APP_TYPE_SIM; + sim_app_type |= EAP_PROXY_APP_TYPE_AKA; + } else { + wpa_printf(MSG_ERROR, "eap_proxy: Unknown SIM type!!!"); + continue; + } + + wpa_printf(MSG_ERROR, "eap_proxy: SIM %d is of type %d", i+1, sim_app_type); + ret = os_snprintf(pos, end - pos, " sim%d=%d", i+1, sim_app_type); + if (ret < 0 || ret >= end - pos) + break; + + pos += ret; + } else { + sim_app_type = 0; + ret = os_snprintf(pos, end - pos, " sim%d=%d", i+1, sim_app_type); + if (ret < 0 || ret >= end - pos) + break; + pos += ret; + } + } + + reply_buf[buf_len - 1] = '\0'; + ret = pos - reply_buf; + wpa_printf(MSG_ERROR, "eap_proxy: reply_buf_len = %d", ret); + wpa_printf(MSG_ERROR, "eap_proxy: reply_buf = %s\n", reply_buf); + return ret; +} + #endif /* CONFIG_EAP_PROXY */ |