mirror of
https://github.com/pvvx/RTL00MP3.git
synced 2025-07-31 12:41:06 +00:00
update
This commit is contained in:
parent
8c8b03208e
commit
8e26e8ec8d
24 changed files with 2592 additions and 2483 deletions
|
|
@ -634,12 +634,39 @@ int wifi_is_ready_to_transceive(rtw_interface_t interface) {
|
|||
}
|
||||
return RTW_ERROR;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------//
|
||||
int wifi_set_mac_address(char * mac) {
|
||||
char buf[13 + 17 + 1];
|
||||
rtw_memset(buf, 0, sizeof(buf));
|
||||
snprintf(buf, 13 + 17, "write_mac %s", mac);
|
||||
int mactostr(char * s, unsigned char *mac, bool fmt)
|
||||
{
|
||||
char *ptrb = s;
|
||||
unsigned char *ptrm = mac;
|
||||
int i = 6;
|
||||
while(i--) {
|
||||
unsigned char x = ptrm[0] >> 4;
|
||||
if (x <= 9) ptrb[0] = x + '0';
|
||||
else ptrb[0] = x - 10 + 'a';
|
||||
ptrb++;
|
||||
x = ptrm[0] & 0x0f;
|
||||
if (x <= 9) ptrb[0] = x + '0';
|
||||
else ptrb[0] = x - 10 + 'a';
|
||||
ptrb++;
|
||||
ptrm++;
|
||||
if(fmt && i) {
|
||||
ptrb[0] = ':';
|
||||
ptrb++;
|
||||
}
|
||||
};
|
||||
*ptrb = '\0';
|
||||
if (fmt) return 12+5;
|
||||
return 12;
|
||||
}
|
||||
//----------------------------------------------------------------------------//
|
||||
int wifi_set_mac_address(char * new_mac) {
|
||||
// char buf[13 + 17 + 1];
|
||||
char buf[10 + 12 + 1];
|
||||
memcpy(buf,"write_mac ", 10);
|
||||
// snprintf(buf, 13 + 17, "write_mac %s", mac);
|
||||
//BAG NotWork! rtl_sprintf(buf, "write_mac %02x%02x%02x%02x%02x%02x", new_mac[0], new_mac[1], new_mac[2], new_mac[3], new_mac[4], new_mac[5]);
|
||||
mactostr(&buf[10], new_mac, false);
|
||||
return wext_private_command(WLAN0_NAME, buf, SHOW_PRIVATE_OUT);
|
||||
}
|
||||
|
||||
|
|
@ -656,6 +683,7 @@ int wifi_get_mac_address(char * mac) {
|
|||
return ret;
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------//
|
||||
int wifi_enable_powersave(void) {
|
||||
return wext_enable_powersave(WLAN0_NAME, 1, 1);
|
||||
|
|
|
|||
|
|
@ -703,6 +703,8 @@ int wifi_disable_packet_filter(unsigned char filter_id);
|
|||
int wifi_remove_packet_filter(unsigned char filter_id);
|
||||
#endif
|
||||
|
||||
int mactostr(char * s, unsigned char *mac, bool fmt);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -280,8 +280,9 @@ int SC_send_simple_config_ack(u8 round)
|
|||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#if LEAVE_ACK_EARLY
|
||||
leave_ack:
|
||||
#endif
|
||||
close(ack_socket);
|
||||
#endif
|
||||
|
||||
|
|
@ -296,7 +297,6 @@ leave_ack:
|
|||
|
||||
static int SC_check_and_show_connection_info(void)
|
||||
{
|
||||
rtw_wifi_setting_t setting;
|
||||
int ret = -1;
|
||||
|
||||
#if CONFIG_LWIP_LAYER
|
||||
|
|
@ -308,6 +308,7 @@ static int SC_check_and_show_connection_info(void)
|
|||
#endif
|
||||
|
||||
#if CONFIG_EXAMPLE_UART_ATCMD == 0
|
||||
rtw_wifi_setting_t setting;
|
||||
wifi_get_setting(WLAN0_NAME, &setting);
|
||||
wifi_show_setting(WLAN0_NAME, &setting);
|
||||
#endif
|
||||
|
|
@ -614,7 +615,7 @@ int SC_connect_to_candidate_AP (rtw_network_info_t *wifi){
|
|||
}
|
||||
|
||||
/* call wifi scan to scan */
|
||||
if(scan_cnt = (wifi_scan(RTW_SCAN_TYPE_ACTIVE, RTW_BSS_TYPE_ANY, &scan_buf)) < 0){
|
||||
if((scan_cnt = (wifi_scan(RTW_SCAN_TYPE_ACTIVE, RTW_BSS_TYPE_ANY, &scan_buf))) < 0){
|
||||
printf("ERROR: wifi scan failed\n");
|
||||
ret = RTW_ERROR;
|
||||
}else{
|
||||
|
|
@ -696,7 +697,7 @@ enum sc_result SC_connect_to_AP(void)
|
|||
goto wifi_connect_fail;
|
||||
}
|
||||
rtw_join_status = 0;//clear simple config status
|
||||
ret = wifi_connect(g_bssid,
|
||||
ret = wifi_connect(g_bssid,
|
||||
1,
|
||||
(char*)wifi.ssid.val,
|
||||
wifi.security_type,
|
||||
|
|
@ -704,7 +705,7 @@ enum sc_result SC_connect_to_AP(void)
|
|||
wifi.key_id,
|
||||
NULL);
|
||||
|
||||
if (ret == RTW_SUCCESS)
|
||||
if (ret == 0)
|
||||
goto wifi_connect_success;
|
||||
|
||||
if (retry == max_retry) {
|
||||
|
|
@ -718,7 +719,7 @@ enum sc_result SC_connect_to_AP(void)
|
|||
#if 1
|
||||
/* when optimization fail: if connect with bssid fail because of we have connect to the wrong AP */
|
||||
ret = SC_connect_to_candidate_AP(&wifi);
|
||||
if (RTW_SUCCESS == ret) {
|
||||
if (ret == 0) {
|
||||
goto wifi_connect_success;
|
||||
} else {
|
||||
ret = SC_JOIN_BSS_FAIL;
|
||||
|
|
@ -769,15 +770,15 @@ extern void rtk_sc_deinit(void);
|
|||
|
||||
void init_simple_config_lib_config(struct simple_config_lib_config* config)
|
||||
{
|
||||
config->free = rtw_mfree;
|
||||
config->malloc = rtw_malloc;
|
||||
config->free = (simple_config_free_fn) rtw_mfree;
|
||||
config->malloc = (simple_config_malloc_fn) rtw_malloc;
|
||||
config->memcmp = memcmp;
|
||||
config->memcpy = memcpy;
|
||||
config->memset = memset;
|
||||
config->memset = (simple_config_memset_fn) memset;
|
||||
config->printf = printf;
|
||||
config->strcpy = strcpy;
|
||||
config->strlen = strlen;
|
||||
config->zmalloc = rtw_zmalloc;
|
||||
config->zmalloc = (simple_config_zmalloc_fn) rtw_zmalloc;
|
||||
#if CONFIG_LWIP_LAYER
|
||||
config->_ntohl = lwip_ntohl;
|
||||
#else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue