This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 07247be9f665d0691b6676bd1876e3dd1620f648
Author: wangchen <[email protected]>
AuthorDate: Tue Dec 17 15:10:36 2024 +0800

    wifi_sim.c:resolve issue in wapi save_config & wapi reconnect command
    
    resolve issue in wapi save_config & wapi reconnect command in qemu
    
    Signed-off-by: wangchen <[email protected]>
---
 drivers/net/wifi_sim.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wifi_sim.c b/drivers/net/wifi_sim.c
index 06c86be8ccb..4f5168fa738 100644
--- a/drivers/net/wifi_sim.c
+++ b/drivers/net/wifi_sim.c
@@ -218,6 +218,7 @@ struct wifi_sim_s
   int      key_mgmt;
   int      proto;
   int      auth_alg;
+  int      auth_type;
   int      pairwise_chiper;
   int      group_cipher;
 
@@ -1628,8 +1629,9 @@ static int wifidriver_set_auth(FAR struct wifi_sim_s 
*wifidev,
           /* record the value */
 
           wifidev->proto = value >> 1;
+          wifidev->auth_type = value;
 
-          ninfo("proto=%s\n", get_authstr(value));
+          ninfo("auth_type=%s\n", get_authstr(value));
         }
         break;
 
@@ -1654,14 +1656,19 @@ static int wifidriver_set_auth(FAR struct wifi_sim_s 
*wifidev,
 static int wifidriver_get_auth(FAR struct wifi_sim_s *wifidev,
                                FAR struct iwreq *pwrq)
 {
-  switch (wifidev->mode)
+  int flag = pwrq->u.param.flags & IW_AUTH_INDEX;
+
+  switch (flag)
     {
-      case IW_MODE_INFRA:
+      case IW_AUTH_WPA_VERSION:
+        pwrq->u.param.value = wifidev->auth_type;
         break;
-      case IW_MODE_MASTER:
+      case IW_AUTH_CIPHER_PAIRWISE:
+        pwrq->u.param.value = wifidev->pairwise_chiper;
         break;
       default:
-        break;
+        nerr("ERROR: Unknown cmd %d\n", flag);
+        return -ENOSYS;
     }
 
   return OK;

Reply via email to