Skip to content

Commit

Permalink
Merge pull request #33 from Wuth5/master
Browse files Browse the repository at this point in the history
[SDK] update SDK
  • Loading branch information
ambiot authored Oct 3, 2022
2 parents 300d20f + 2dc0ee4 commit 44d5eb0
Show file tree
Hide file tree
Showing 79 changed files with 6,739 additions and 948 deletions.
103 changes: 46 additions & 57 deletions component/common/api/at_cmd/atcmd_bt.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ extern void *bt_mesh_provisioner_multiple_profile_io_queue_handle;
extern void *bt_mesh_device_multiple_profile_evt_queue_handle;
extern void *bt_mesh_device_multiple_profile_io_queue_handle;
#endif
#endif

#if defined(CONFIG_BT_BREEZE) && CONFIG_BT_BREEZE
#include "breeze_hal_ble.h"
Expand All @@ -93,53 +94,53 @@ uint8_t bt_command_type(uint16_t command_type)
{
switch (command_type) {
case BT_COMMAND_CENTRAL: {
if (!((bt_cmd_type & CENTRAL_BIT) >> 7)) {
return 0;
if (!((bt_cmd_type & CENTRAL_BIT) >> 7)) {
return 0;
}
}
}
break;
break;
case BT_COMMAND_PERIPHERAL: {
if (!((bt_cmd_type & PERIPHERAL_BIT) >> 6)) {
return 0;
if (!((bt_cmd_type & PERIPHERAL_BIT) >> 6)) {
return 0;
}
}
}
break;
break;
case BT_COMMAND_SCATTERNET: {
if (!((bt_cmd_type & SCATTERNET_BIT) >> 5)) {
return 0;
if (!((bt_cmd_type & SCATTERNET_BIT) >> 5)) {
return 0;
}
}
}
break;
break;
case BT_COMMAND_BEACON: {
if (!((bt_cmd_type & BEACON_BIT) >> 4)) {
return 0;
if (!((bt_cmd_type & BEACON_BIT) >> 4)) {
return 0;
}
}
}
break;
break;
case BT_COMMAND_CONFIG: {
if (!((bt_cmd_type & CONFIG_BIT) >> 3)) {
return 0;
if (!((bt_cmd_type & CONFIG_BIT) >> 3)) {
return 0;
}
}
}
break;
break;
case BT_COMMAND_AIRSYNC_CONFIG: {
if (!((bt_cmd_type & AIRSYNC_CONFIG_BIT) >> 2)) {
return 0;
if (!((bt_cmd_type & AIRSYNC_CONFIG_BIT) >> 2)) {
return 0;
}
}
}
break;
break;
case BT_COMMAND_MESH: {
if (!((bt_cmd_type & MESH_BIT) >> 1)) {
return 0;
if (!((bt_cmd_type & MESH_BIT) >> 1)) {
return 0;
}
}
}
break;
break;
case BT_COMMAND_STACK: {
if (!(bt_cmd_type & STACK_BIT)) {
return 0;
if (!(bt_cmd_type & STACK_BIT)) {
return 0;
}
}
}
break;
break;
case BT_COMMAND_SCAN:
case BT_COMMAND_CONNECT:
case BT_COMMAND_DISCONNECT:
Expand All @@ -150,40 +151,28 @@ uint8_t bt_command_type(uint16_t command_type)
case BT_COMMAND_MODIFY_WHITELIST:
case BT_COMMAND_SET_SCAN_PARAM:
case BT_COMMAND_SET_PHY: {
if (!((bt_cmd_type & CENTRAL_BIT) >> 7) && !((bt_cmd_type & SCATTERNET_BIT) >> 5) && !((bt_cmd_type & MESH_BIT) >> 1)) {
return 0;
if (!((bt_cmd_type & CENTRAL_BIT) >> 7) && !((bt_cmd_type & SCATTERNET_BIT) >> 5) && !((bt_cmd_type & MESH_BIT) >> 1)) {
return 0;
}
}
}
break;
break;
case BT_COMMAND_SEND_INDI_NOTI:
case BT_COMMAND_MODIFY_ADV_INTERVAL: {
if (!((bt_cmd_type & PERIPHERAL_BIT) >> 6) && !((bt_cmd_type & SCATTERNET_BIT) >> 5) && !((bt_cmd_type & MESH_BIT) >> 1)) {
return 0;
if (!((bt_cmd_type & PERIPHERAL_BIT) >> 6) && !((bt_cmd_type & SCATTERNET_BIT) >> 5) && !((bt_cmd_type & MESH_BIT) >> 1)) {
return 0;
}
}
}
break;
break;
case BT_COMMAND_AUTH:
case BT_COMMAND_SEND_USERCONF:
case BT_COMMAND_UPDATE_CONN_REQUEST:
case BT_COMMAND_BOND_INFORMATION: {
if (!((bt_cmd_type & CENTRAL_BIT) >> 7) && !((bt_cmd_type & PERIPHERAL_BIT) >> 6) && !((bt_cmd_type & SCATTERNET_BIT) >> 5) &&
!((bt_cmd_type & MESH_BIT) >> 1)) {
return 0;
}
}
break;
case BT_COMMAND_RECONFIG: {
if (!((bt_cmd_type & SCATTERNET_BIT) >> 5)) {
return 0;
}
}
break;
case BT_COMMAND_MESH_RECONFIG: {
if (!((bt_cmd_type & SCATTERNET_BIT) >> 5) && !((bt_cmd_type & MESH_BIT) >> 1)) {
return 0;
if (!((bt_cmd_type & CENTRAL_BIT) >> 7) && !((bt_cmd_type & PERIPHERAL_BIT) >> 6) && !((bt_cmd_type & SCATTERNET_BIT) >> 5) &&
!((bt_cmd_type & MESH_BIT) >> 1)) {
return 0;
}
}
}
break;
break;
default:
break;
}
Expand Down
4 changes: 1 addition & 3 deletions component/common/api/at_cmd/atcmd_bt.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,7 @@ typedef enum
BT_COMMAND_SET_SCAN_PARAM,
BT_COMMAND_SET_PHY,
BT_COMMAND_MODIFY_ADV_INTERVAL,
BT_COMMAND_RECONFIG,
BT_COMMAND_SEND_INDI_NOTI,
BT_COMMAND_MESH_RECONFIG
BT_COMMAND_SEND_INDI_NOTI
} BT_COMMAND_TYPE;

#endif /* __ATCMD_BT_H__ */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* See README for more details.
*/

#include "osdep_service.h"
#include "utils/includes.h"
#include "utils/common.h"
#include "tls.h"
Expand Down Expand Up @@ -726,8 +727,11 @@ void tls_deinit(void *ssl_ctx)
if(ssl_ctx != NULL){
struct eap_tls *tls_context = (struct eap_tls *) ssl_ctx;
mbedtls_net_free(tls_context->fd);
os_free(tls_context->fd, 0);
mbedtls_ssl_free(tls_context->ssl);
os_free(tls_context->ssl, 0);
mbedtls_ssl_config_free(tls_context->conf);
os_free(tls_context->conf, 0);
os_free(ssl_ctx, 0);
ssl_ctx = NULL;
}
Expand Down
112 changes: 89 additions & 23 deletions component/common/api/wifi/wifi_conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,86 @@ extern void dhcp6_stop(struct netif *netif);
#endif
#endif

extern u32 rltk_wlan_get_link_err(void);
static void wifi_rssi_report_hdl( char* buf, int buf_len, int flags, void* userdata)
{
printf("%s, rssi: %d\n", __func__, flags);
}

static void wifi_link_err_parse(u16 reason_code)
{
u32 link_err;
link_err = rltk_wlan_get_link_err();

if(link_err != 0U){
printf("wifi link err:%08x\r\n", rltk_wlan_get_link_err());
}

printf("dissconn reason code: %d\n", reason_code);

if(link_err & BIT(0)) {
printf("receive deauth\n");
} else if(link_err & BIT(1)) {
printf("receive deassoc\n");
} else if (link_err & BIT(2)) {
printf("scan stage, no beacon while connecting\n");
} else if(link_err & BIT(3)) {
printf("auth stage, auth timeout\n");
if(reason_code == 65531) {
printf("request has been declined\n");
}
} else if(link_err & BIT(4)) {
printf("assoc stage, assoc timeout\n");
} else if(link_err & (BIT(5) | BIT(6) | BIT(7))) {
printf("4handshake stage, 4-way waiting timeout\n");
} else if(link_err & BIT(8)) {
printf("assoc stage, assoc reject (assoc rsp status > 0)\n");
} else if(link_err & BIT(9)) {
printf("auth stage, auth fail (auth rsp status > 0)\n");
} else if(link_err & BIT(10)){
printf("scan stage, scan timeout\n");
} else if(link_err & BIT(11)) {
printf("auth stage, WPA3 auth fail, ");
if(reason_code == 65531) {
printf("request has been declined\n");
} else {
printf("password error\n");
}
}

if(link_err & (BIT(0) | BIT(1))) {
if(link_err & BIT(20)) {
printf("handshake done, connected stage, recv deauth/deassoc\n");
} else if(link_err & BIT(19)) {
printf("handshake processing, 4handshake stage, recv deauth/deassoc\n");
} else if(link_err & BIT(18)) {
printf("assoc successed, 4handshake stage, recv deauth/deassoc\n");
} else if(link_err & BIT(17)) {
printf("auth successed, assoc stage, recv deauth/deassoc\n");
} else if(link_err & BIT(16)) {
printf("scan done, found ssid, auth stage, recv deauth/deassoc\n");
} else {
printf("connected stage, recv deauth/deassoc\n");
}
}

switch(reason_code) {
case 17:
printf("auth stage, ap auth full\n");
break;
case 65534:
printf("connected stage, ap changed\n");
break;
case 65535:
printf("connected stage, loss beacon\n");
break;
default:
break;
}

rltk_wlan_set_link_err(0);
}

/*
* rltk_wlan_get_link_err(): check wifi link error
*******************************************************
Expand All @@ -451,6 +531,9 @@ extern void dhcp6_stop(struct netif *netif);
* bit 6: waiting 4-3 timeout
* bit 7: waiting 2-1 timeout (WPA needs GTK handshake after 4-way immediately)
* bit 8: assoc reject (assoc rsp status > 0)
* bit 9: auth reject (auth rsp status > 0)
* bit 10: scan timeout
* bit 11: WPA3 auth fail
*******************************************************
* link status bit:
* bit 16: found ssid
Expand All @@ -474,12 +557,8 @@ static void wifi_disconn_hdl( char* buf, int buf_len, int flags, void* userdata)
/* buf detail: mac addr + disconn_reason, buf_len = ETH_ALEN+2*/
disconn_reason =*(u16*)(buf+6);
cnnctfail_reason = *(signed char*)(buf+6+2);

extern u32 rltk_wlan_get_link_err(void);

if(rltk_wlan_get_link_err() != 0U){
DBG_8710C("wifi link err:%08x\r\n", rltk_wlan_get_link_err());
}

wifi_link_err_parse(disconn_reason);

if(join_user_data != NULL){
if(join_user_data->network_info.security_type == RTW_SECURITY_OPEN){
Expand Down Expand Up @@ -819,6 +898,7 @@ int wifi_connect(
wifi_reg_event_handler(WIFI_EVENT_CONNECT, wifi_connected_hdl, NULL);
wifi_reg_event_handler(WIFI_EVENT_DISCONNECT, wifi_disconn_hdl, NULL);
wifi_reg_event_handler(WIFI_EVENT_FOURWAY_HANDSHAKE_DONE, wifi_handshake_done_hdl, NULL);
wifi_reg_event_handler(WIFI_EVENT_TARGET_SSID_RSSI, wifi_rssi_report_hdl, NULL);

// if is connected to ap, would trigger disconn_hdl but need to make sure it is invoked before setting join_user_data
#if CONFIG_WIFI_IND_USE_THREAD
Expand Down Expand Up @@ -905,6 +985,7 @@ int wifi_connect(
wifi_unreg_event_handler(WIFI_EVENT_CONNECT, wifi_connected_hdl);
wifi_unreg_event_handler(WIFI_EVENT_NO_NETWORK,wifi_no_network_hdl);
wifi_unreg_event_handler(WIFI_EVENT_FOURWAY_HANDSHAKE_DONE, wifi_handshake_done_hdl);
wifi_unreg_event_handler(WIFI_EVENT_TARGET_SSID_RSSI, wifi_rssi_report_hdl);
rtw_join_status &= ~JOIN_CONNECTING;
return result;
}
Expand Down Expand Up @@ -2988,8 +3069,7 @@ static void wifi_autoreconnect_thread(void *param)
assoc_by_bssid = 1;
}

#ifdef CONFIG_SAE_SUPPORT
#if CONFIG_ENABLE_WPS
#if defined(CONFIG_SAE_SUPPORT) && (CONFIG_ENABLE_WPS==1)
unsigned char is_wpa3_disable=0;
if((strncmp(wps_profile_ssid, reconnect_param->ssid, reconnect_param->ssid_len) == 0) &&
(strncmp(wps_profile_password, reconnect_param->password, reconnect_param->password_len) == 0) &&
Expand All @@ -2998,14 +3078,6 @@ static void wifi_autoreconnect_thread(void *param)
is_wpa3_disable=1;
}
#endif
#ifdef CONFIG_PMKSA_CACHING
unsigned char is_pmk_disable=0;
if(reconnect_param->security_type == RTW_SECURITY_WPA3_AES_PSK) {
wifi_set_pmk_cache_enable(DISABLE);
is_pmk_disable=1;
}
#endif
#endif //CONFIG_SAE_SUPPORT

if(assoc_by_bssid){
ret = wifi_connect_bssid(saved_bssid, reconnect_param->ssid, reconnect_param->security_type,
Expand All @@ -3016,16 +3088,10 @@ static void wifi_autoreconnect_thread(void *param)
reconnect_param->ssid_len, reconnect_param->password_len, reconnect_param->key_id, NULL);
}

#ifdef CONFIG_SAE_SUPPORT
#if CONFIG_ENABLE_WPS
#if defined(CONFIG_SAE_SUPPORT) && (CONFIG_ENABLE_WPS==1)
if(is_wpa3_disable)
wext_set_support_wpa3(ENABLE);
#endif
#ifdef CONFIG_PMKSA_CACHING
if(is_pmk_disable)
wifi_set_pmk_cache_enable(ENABLE);
#endif
#endif //CONFIG_SAE_SUPPORT

#if CONFIG_LWIP_LAYER
if(ret == RTW_SUCCESS) {
Expand Down
5 changes: 5 additions & 0 deletions component/common/api/wifi/wifi_ind.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,11 @@ void wifi_indication( rtw_event_indicate_t event, char *buf, int buf_len, int fl
case WIFI_EVENT_NO_BEACON:
#if(WIFI_INDICATE_MSG==1)
printf("\n\r%s(): WIFI_EVENT_NO_BEACON\n", __func__);
#endif
break;
case WIFI_EVENT_TARGET_SSID_RSSI:
#if(WIFI_INDICATE_MSG==1)
printf("\n\r%s(): WIFI_EVENT_TARGET_SSID_RSSI, rssi: %d\n", __func__, flags);
#endif
break;
}
Expand Down
Binary file modified component/common/bluetooth/realtek/sdk/board/amebaz2/lib/btgap.a
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
/*
* Release Note
*/
v1.0.1.175
2022/05/11
1. Fix a bug for multi-link notification and write command send failure issue.

v1.0.1.167
2021/11/30
1. Fix a bug for slave sending ATT exchange mtu request.
Expand Down
Loading

0 comments on commit 44d5eb0

Please sign in to comment.