@@ -82,7 +82,6 @@ extern rsi_semaphore_handle_t sl_rs_ble_init_sem;
82
82
*/
83
83
static uint8_t wfx_rsi_drv_buf [WFX_RSI_BUF_SZ ];
84
84
wfx_wifi_scan_ext_t * temp_reset ;
85
- uint8_t security ;
86
85
87
86
/******************************************************************
88
87
* @fn int32_t wfx_rsi_get_ap_info(wfx_wifi_scan_result_t *ap)
@@ -96,7 +95,7 @@ int32_t wfx_rsi_get_ap_info(wfx_wifi_scan_result_t * ap)
96
95
{
97
96
int32_t status ;
98
97
uint8_t rssi ;
99
- ap -> security = security ;
98
+ ap -> security = wfx_rsi . sec . security ;
100
99
ap -> chan = wfx_rsi .ap_chan ;
101
100
memcpy (& ap -> bssid [0 ], & wfx_rsi .ap_mac .octet [0 ], BSSID_MAX_STR_LEN );
102
101
status = rsi_wlan_get (RSI_RSSI , & rssi , sizeof (rssi ));
@@ -435,7 +434,7 @@ void wfx_show_err(char * msg)
435
434
* @return
436
435
* None
437
436
*******************************************************************************************/
438
- static void wfx_rsi_save_ap_info ()
437
+ static void wfx_rsi_save_ap_info () // translation
439
438
{
440
439
int32_t status ;
441
440
rsi_rsp_scan_t rsp ;
@@ -450,22 +449,36 @@ static void wfx_rsi_save_ap_info()
450
449
}
451
450
else
452
451
{
453
- wfx_rsi .sec .security = rsp . scan_info -> security_mode ;
452
+ wfx_rsi .sec .security = WFX_SEC_UNSPECIFIED ;
454
453
wfx_rsi .ap_chan = rsp .scan_info -> rf_channel ;
455
454
memcpy (& wfx_rsi .ap_mac .octet [0 ], & rsp .scan_info -> bssid [0 ], BSSID_MAX_STR_LEN );
456
455
}
457
- if ((wfx_rsi .sec .security == RSI_WPA ) || (wfx_rsi .sec .security == RSI_WPA2 ))
458
- {
459
- // saving the security before changing into mixed mode
460
- security = wfx_rsi .sec .security ;
461
- wfx_rsi .sec .security = RSI_WPA_WPA2_MIXED ;
462
- }
463
- if (wfx_rsi .sec .security == SME_WPA3 )
456
+
457
+ switch (rsp .scan_info -> security_mode )
464
458
{
465
- // returning 3 for WPA3 when DGWIFI read security-type is called
466
- security = WPA3_SECURITY ;
467
- wfx_rsi .sec .security = RSI_WPA3 ;
459
+ case SME_OPEN :
460
+ wfx_rsi .sec .security = WFX_SEC_NONE ;
461
+ break ;
462
+ case SME_WPA :
463
+ case SME_WPA_ENTERPRISE :
464
+ wfx_rsi .sec .security = WFX_SEC_WPA ;
465
+ break ;
466
+ case SME_WPA2 :
467
+ case SME_WPA2_ENTERPRISE :
468
+ wfx_rsi .sec .security = WFX_SEC_WPA2 ;
469
+ break ;
470
+ case SME_WEP :
471
+ wfx_rsi .sec .security = WFX_SEC_WEP ;
472
+ break ;
473
+ case SME_WPA3 :
474
+ case SME_WPA3_TRANSITION :
475
+ wfx_rsi .sec .security = WFX_SEC_WPA3 ;
476
+ break ;
477
+ default :
478
+ wfx_rsi .sec .security = WFX_SEC_UNSPECIFIED ;
479
+ break ;
468
480
}
481
+
469
482
WFX_RSI_LOG ("%s: WLAN: connecting to %s==%s, sec=%d, status=%02x" , __func__ , & wfx_rsi .sec .ssid [0 ], & wfx_rsi .sec .passkey [0 ],
470
483
wfx_rsi .sec .security , status );
471
484
}
@@ -480,13 +493,35 @@ static void wfx_rsi_save_ap_info()
480
493
static void wfx_rsi_do_join (void )
481
494
{
482
495
int32_t status ;
496
+ rsi_security_mode_t connect_security_mode ;
483
497
484
498
if (wfx_rsi .dev_state & (WFX_RSI_ST_STA_CONNECTING | WFX_RSI_ST_STA_CONNECTED ))
485
499
{
486
500
WFX_RSI_LOG ("%s: not joining - already in progress" , __func__ );
487
501
}
488
502
else
489
503
{
504
+
505
+ switch (wfx_rsi .sec .security )
506
+ {
507
+ case WFX_SEC_WEP :
508
+ connect_security_mode = RSI_WEP ;
509
+ break ;
510
+ case WFX_SEC_WPA :
511
+ case WFX_SEC_WPA2 :
512
+ connect_security_mode = RSI_WPA_WPA2_MIXED ;
513
+ break ;
514
+ case WFX_SEC_WPA3 :
515
+ connect_security_mode = RSI_WPA3 ;
516
+ break ;
517
+ case WFX_SEC_NONE :
518
+ connect_security_mode = RSI_OPEN ;
519
+ break ;
520
+ default :
521
+ WFX_RSI_LOG ("%s: error: unknown security type." );
522
+ return ;
523
+ }
524
+
490
525
WFX_RSI_LOG ("%s: WLAN: connecting to %s==%s, sec=%d" , __func__ , & wfx_rsi .sec .ssid [0 ], & wfx_rsi .sec .passkey [0 ],
491
526
wfx_rsi .sec .security );
492
527
@@ -511,8 +546,8 @@ static void wfx_rsi_do_join(void)
511
546
/* Call rsi connect call with given ssid and password
512
547
* And check there is a success
513
548
*/
514
- if ((status = rsi_wlan_connect_async ((int8_t * ) & wfx_rsi .sec .ssid [0 ], ( rsi_security_mode_t ) wfx_rsi .sec .security ,
515
- & wfx_rsi . sec . passkey [ 0 ], wfx_rsi_join_cb )) != RSI_SUCCESS )
549
+ if ((status = rsi_wlan_connect_async ((int8_t * ) & wfx_rsi .sec .ssid [0 ], connect_security_mode , & wfx_rsi .sec .passkey [ 0 ] ,
550
+ wfx_rsi_join_cb )) != RSI_SUCCESS )
516
551
{
517
552
518
553
wfx_rsi .dev_state &= ~WFX_RSI_ST_STA_CONNECTING ;
0 commit comments