@@ -80,20 +80,19 @@ static void supp_shell_connect_status(struct k_work *work);
80
80
static K_WORK_DELAYABLE_DEFINE (wpa_supp_status_work ,
81
81
supp_shell_connect_status ) ;
82
82
83
- #define wpa_cli_cmd_v (cmd , ...) ({ \
84
- bool status; \
85
- \
86
- if (zephyr_wpa_cli_cmd_v(cmd, ##__VA_ARGS__) < 0) { \
87
- wpa_printf(MSG_ERROR, \
88
- "Failed to execute wpa_cli command: %s", \
89
- cmd); \
90
- status = false; \
91
- } else { \
92
- status = true; \
93
- } \
94
- \
95
- status; \
96
- })
83
+ #define wpa_cli_cmd_v (cmd , ...) \
84
+ ({ \
85
+ bool status; \
86
+ \
87
+ if (zephyr_wpa_cli_cmd_v(wpa_s->ctrl_conn, cmd, ##__VA_ARGS__) < 0) { \
88
+ wpa_printf(MSG_ERROR, "Failed to execute wpa_cli command: %s", cmd); \
89
+ status = false; \
90
+ } else { \
91
+ status = true; \
92
+ } \
93
+ \
94
+ status; \
95
+ })
97
96
98
97
static struct wpa_supplicant * get_wpa_s_handle (const struct device * dev )
99
98
{
@@ -622,7 +621,7 @@ static int wpas_add_and_config_network(struct wpa_supplicant *wpa_s,
622
621
goto out ;
623
622
}
624
623
625
- ret = z_wpa_ctrl_add_network (& resp );
624
+ ret = z_wpa_ctrl_add_network (wpa_s -> ctrl_conn , & resp );
626
625
if (ret ) {
627
626
wpa_printf (MSG_ERROR , "Failed to add network" );
628
627
goto out ;
@@ -1313,7 +1312,7 @@ int supplicant_status(const struct device *dev, struct wifi_iface_status *status
1313
1312
status -> channel = channel ;
1314
1313
1315
1314
if (ssid_len == 0 ) {
1316
- int _res = z_wpa_ctrl_status (& cli_status );
1315
+ int _res = z_wpa_ctrl_status (wpa_s -> ctrl_conn , & cli_status );
1317
1316
1318
1317
if (_res < 0 ) {
1319
1318
ssid_len = 0 ;
@@ -1342,7 +1341,7 @@ int supplicant_status(const struct device *dev, struct wifi_iface_status *status
1342
1341
1343
1342
status -> rssi = - WPA_INVALID_NOISE ;
1344
1343
if (status -> iface_mode == WIFI_MODE_INFRA ) {
1345
- ret = z_wpa_ctrl_signal_poll (& signal_poll );
1344
+ ret = z_wpa_ctrl_signal_poll (wpa_s -> ctrl_conn , & signal_poll );
1346
1345
if (!ret ) {
1347
1346
status -> rssi = signal_poll .rssi ;
1348
1347
status -> current_phy_tx_rate = signal_poll .current_txrate ;
@@ -1492,6 +1491,7 @@ int supplicant_11k_cfg(const struct device *dev, struct wifi_11k_params *params)
1492
1491
int supplicant_11k_neighbor_request (const struct device * dev , struct wifi_11k_params * params )
1493
1492
{
1494
1493
int ssid_len = strlen (params -> ssid );
1494
+ struct wpa_supplicant * wpa_s = get_wpa_s_handle (dev );
1495
1495
1496
1496
if (params != NULL && ssid_len > 0 ) {
1497
1497
if (ssid_len > WIFI_SSID_MAX_LEN ) {
@@ -1758,6 +1758,7 @@ int supplicant_bss_ext_capab(const struct device *dev, int capab)
1758
1758
int supplicant_legacy_roam (const struct device * dev )
1759
1759
{
1760
1760
int ret = -1 ;
1761
+ struct wpa_supplicant * wpa_s = get_wpa_s_handle (dev );
1761
1762
1762
1763
k_mutex_lock (& wpa_supplicant_mutex , K_FOREVER );
1763
1764
if (!wpa_cli_cmd_v ("scan" )) {
@@ -1866,7 +1867,7 @@ static int supplicant_wps_pin(const struct device *dev, struct wifi_wps_config_p
1866
1867
}
1867
1868
1868
1869
if (params -> oper == WIFI_WPS_PIN_GET ) {
1869
- if (zephyr_wpa_cli_cmd_resp (get_pin_cmd , params -> pin )) {
1870
+ if (zephyr_wpa_cli_cmd_resp (wpa_s -> ctrl_conn , get_pin_cmd , params -> pin )) {
1870
1871
goto out ;
1871
1872
}
1872
1873
} else if (params -> oper == WIFI_WPS_PIN_SET ) {
@@ -2299,6 +2300,7 @@ int supplicant_dpp_dispatch(const struct device *dev, struct wifi_dpp_params *pa
2299
2300
{
2300
2301
int ret ;
2301
2302
char * cmd = NULL ;
2303
+ struct wpa_supplicant * wpa_s = get_wpa_s_handle (dev );
2302
2304
2303
2305
if (params == NULL ) {
2304
2306
return - EINVAL ;
@@ -2317,7 +2319,7 @@ int supplicant_dpp_dispatch(const struct device *dev, struct wifi_dpp_params *pa
2317
2319
}
2318
2320
2319
2321
wpa_printf (MSG_DEBUG , "wpa_cli %s" , cmd );
2320
- if (zephyr_wpa_cli_cmd_resp (cmd , params -> resp )) {
2322
+ if (zephyr_wpa_cli_cmd_resp (wpa_s -> ctrl_conn , cmd , params -> resp )) {
2321
2323
os_free (cmd );
2322
2324
return - ENOEXEC ;
2323
2325
}
0 commit comments