Skip to content

Commit 8346781

Browse files
committed
modules: hostap: add support for OKC settings
- Added support for OKC settings Signed-off-by: Gang Li <gang.li_1@nxp.com>
1 parent 87b4940 commit 8346781

File tree

3 files changed

+38
-0
lines changed

3 files changed

+38
-0
lines changed

modules/hostap/src/supp_api.c

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2336,3 +2336,31 @@ int supplicant_dpp_dispatch(const struct device *dev, struct wifi_dpp_params *pa
23362336
return 0;
23372337
}
23382338
#endif /* CONFIG_WIFI_NM_WPA_SUPPLICANT_DPP */
2339+
2340+
int supplicant_config_params(const struct device *dev, struct wifi_config_params *params)
2341+
{
2342+
struct wpa_supplicant *wpa_s;
2343+
int ret = 0;
2344+
2345+
k_mutex_lock(&wpa_supplicant_mutex, K_FOREVER);
2346+
2347+
wpa_s = get_wpa_s_handle(dev);
2348+
if (!wpa_s) {
2349+
ret = -ENOENT;
2350+
wpa_printf(MSG_ERROR, "Device %s not found", dev->name);
2351+
goto out;
2352+
}
2353+
2354+
if (params->type & WIFI_CONFIG_PARAM_OKC) {
2355+
if (!wpa_cli_cmd_v("set okc %d", params->okc)) {
2356+
ret = -EINVAL;
2357+
wpa_printf(MSG_ERROR, "Failed to set OKC");
2358+
goto out;
2359+
}
2360+
wpa_printf(MSG_INFO, "Set OKC: %d", params->okc);
2361+
}
2362+
2363+
out:
2364+
k_mutex_unlock(&wpa_supplicant_mutex);
2365+
return ret;
2366+
}

modules/hostap/src/supp_api.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,4 +350,13 @@ int dpp_params_to_cmd(struct wifi_dpp_params *params, char *cmd, size_t max_len)
350350
*/
351351
int supplicant_dpp_dispatch(const struct device *dev, struct wifi_dpp_params *params);
352352
#endif /* CONFIG_WIFI_NM_WPA_SUPPLICANT_DPP */
353+
354+
/**
355+
* @brief Wi-Fi STA configuration parameter.
356+
*
357+
* @param dev Wi-Fi interface handle to use
358+
* @param params STA parameters
359+
* @return 0 for OK; -1 for ERROR
360+
*/
361+
int supplicant_config_params(const struct device *dev, struct wifi_config_params *params);
353362
#endif /* ZEPHYR_SUPP_MGMT_H */

modules/hostap/src/supp_main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ static const struct wifi_mgmt_ops mgmt_ops = {
9595
#ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE
9696
.enterprise_creds = supplicant_add_enterprise_creds,
9797
#endif
98+
.config_params = supplicant_config_params,
9899
};
99100

100101
DEFINE_WIFI_NM_INSTANCE(wifi_supplicant, &mgmt_ops);

0 commit comments

Comments
 (0)