@@ -80,20 +80,19 @@ static void supp_shell_connect_status(struct k_work *work);
8080static K_WORK_DELAYABLE_DEFINE (wpa_supp_status_work ,
8181 supp_shell_connect_status ) ;
8282
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+ })
9796
9897static struct wpa_supplicant * get_wpa_s_handle (const struct device * dev )
9998{
@@ -626,7 +625,7 @@ static int wpas_add_and_config_network(struct wpa_supplicant *wpa_s,
626625 goto out ;
627626 }
628627
629- ret = z_wpa_ctrl_add_network (& resp );
628+ ret = z_wpa_ctrl_add_network (wpa_s -> ctrl_conn , & resp );
630629 if (ret ) {
631630 wpa_printf (MSG_ERROR , "Failed to add network" );
632631 goto out ;
@@ -1365,7 +1364,7 @@ int supplicant_status(const struct device *dev, struct wifi_iface_status *status
13651364 status -> channel = channel ;
13661365
13671366 if (ssid_len == 0 ) {
1368- int _res = z_wpa_ctrl_status (& cli_status );
1367+ int _res = z_wpa_ctrl_status (wpa_s -> ctrl_conn , & cli_status );
13691368
13701369 if (_res < 0 ) {
13711370 ssid_len = 0 ;
@@ -1394,7 +1393,7 @@ int supplicant_status(const struct device *dev, struct wifi_iface_status *status
13941393
13951394 status -> rssi = - WPA_INVALID_NOISE ;
13961395 if (status -> iface_mode == WIFI_MODE_INFRA ) {
1397- ret = z_wpa_ctrl_signal_poll (& signal_poll );
1396+ ret = z_wpa_ctrl_signal_poll (wpa_s -> ctrl_conn , & signal_poll );
13981397 if (!ret ) {
13991398 status -> rssi = signal_poll .rssi ;
14001399 status -> current_phy_tx_rate = signal_poll .current_txrate ;
@@ -2007,7 +2006,7 @@ static int supplicant_wps_pin(const struct device *dev, struct wifi_wps_config_p
20072006 }
20082007
20092008 if (params -> oper == WIFI_WPS_PIN_GET ) {
2010- if (zephyr_wpa_cli_cmd_resp (get_pin_cmd , params -> pin )) {
2009+ if (zephyr_wpa_cli_cmd_resp (wpa_s -> ctrl_conn , get_pin_cmd , params -> pin )) {
20112010 goto out ;
20122011 }
20132012 } else if (params -> oper == WIFI_WPS_PIN_SET ) {
@@ -2440,6 +2439,7 @@ int supplicant_dpp_dispatch(const struct device *dev, struct wifi_dpp_params *pa
24402439{
24412440 int ret ;
24422441 char * cmd = NULL ;
2442+ struct wpa_supplicant * wpa_s = get_wpa_s_handle (dev );
24432443
24442444 if (params == NULL ) {
24452445 return - EINVAL ;
@@ -2458,7 +2458,7 @@ int supplicant_dpp_dispatch(const struct device *dev, struct wifi_dpp_params *pa
24582458 }
24592459
24602460 wpa_printf (MSG_DEBUG , "wpa_cli %s" , cmd );
2461- if (zephyr_wpa_cli_cmd_resp (cmd , params -> resp )) {
2461+ if (zephyr_wpa_cli_cmd_resp (wpa_s -> ctrl_conn , cmd , params -> resp )) {
24622462 os_free (cmd );
24632463 return - ENOEXEC ;
24642464 }
0 commit comments