@@ -141,6 +141,7 @@ static int handle_response(char *buffer, char *response)
141141
142142static int run_qt_command (const char * cmd )
143143{
144+ struct wpa_supplicant * wpa_s ;
144145 char buffer [64 ] = { 0 }, response [16 ] = { 0 };
145146 size_t resp_len = sizeof (response );
146147 int ret = 0 ;
@@ -152,8 +153,9 @@ static int run_qt_command(const char *cmd)
152153 goto done ;
153154 }
154155
155- if (ctrl_conn ) {
156- ret = wpa_ctrl_request (ctrl_conn , buffer , sizeof (buffer ),
156+ wpa_s = zephyr_get_handle_by_ifname (CONFIG_WFA_QT_DEFAULT_INTERFACE );
157+ if (wpa_s && wpa_s -> ctrl_conn ) {
158+ ret = wpa_ctrl_request (wpa_s -> ctrl_conn , buffer , sizeof (buffer ),
157159 response , & resp_len , NULL );
158160 if (ret ) {
159161 indigo_logger (LOG_LEVEL_ERROR ,
@@ -169,7 +171,13 @@ static int run_qt_command(const char *cmd)
169171 if (ret < 0 ) {
170172 goto done ;
171173 }
174+ } else {
175+ indigo_logger (LOG_LEVEL_ERROR ,
176+ "WPA Supplicant ready event received, but no handle found for %s" ,
177+ CONFIG_WFA_QT_DEFAULT_INTERFACE );
178+ return -1 ;
172179 }
180+
173181 indigo_logger (LOG_LEVEL_DEBUG , "Response: %s" , response );
174182 return 0 ;
175183done :
0 commit comments