From 0cefdb99564a1d332d4f4e5ceede6c1a496eaa09 Mon Sep 17 00:00:00 2001 From: pvvx Date: Mon, 31 Jul 2017 17:40:43 +0300 Subject: [PATCH] update --- USDK/component/common/api/wifi/wifi_util.c | 21 ++++++++---------- USDK/component/common/api/wifi_api.c | 25 ++++++++++++++++++++++ USDK/component/common/api/wifi_api.h | 1 + project/src/console/wifi_console.c | 3 +++ project/src/web/web_int_callbacks.c | 1 - userset.mk | 4 ++-- 6 files changed, 40 insertions(+), 15 deletions(-) diff --git a/USDK/component/common/api/wifi/wifi_util.c b/USDK/component/common/api/wifi/wifi_util.c index f9ae17a..8bada94 100644 --- a/USDK/component/common/api/wifi/wifi_util.c +++ b/USDK/component/common/api/wifi/wifi_util.c @@ -468,6 +468,15 @@ int wext_get_tx_power(const char *ifname, __u8 *poweridx) { return ret; } +int wext_get_associated_client_list(const char *ifname, + void * client_list_buffer, uint16_t buffer_length) { + char buf[25]; + + memset(buf, 0, sizeof(buf)); + snprintf(buf, 25, "get_client_list %x", client_list_buffer); + return wext_private_command(ifname, buf, 0); +} + #if 0 // work ? int wext_set_txpower(const char *ifname, int poweridx) { int ret; @@ -481,18 +490,6 @@ int wext_set_txpower(const char *ifname, int poweridx) { return ret; } -int wext_get_associated_client_list(const char *ifname, - void * client_list_buffer, uint16_t buffer_length) { - int ret; - char buf[25]; - - memset(buf, 0, sizeof(buf)); - snprintf(buf, 25, "get_client_list %x", client_list_buffer); - ret = wext_private_command(ifname, buf, 0); - - return ret; -} - int wext_get_ap_info(const char *ifname, rtw_bss_info_t * ap_info, rtw_security_t* security) { int ret = 0; diff --git a/USDK/component/common/api/wifi_api.c b/USDK/component/common/api/wifi_api.c index 73b68b4..fa4920b 100644 --- a/USDK/component/common/api/wifi_api.c +++ b/USDK/component/common/api/wifi_api.c @@ -866,3 +866,28 @@ void show_wifi_cfg(void) { printf("\tSave flags: %p\n", wifi_cfg.save_flg); } +int show_wifi_ap_clients(void) { + if((wifi_mode == RTW_MODE_AP) || (wifi_mode == RTW_MODE_STA_AP)) { + struct { + int count; + rtw_mac_t mac_list[AP_STA_NUM]; + } client_info; + client_info.count = AP_STA_NUM; + if(wext_get_associated_client_list(wlan_ap_name, &client_info, sizeof(client_info)) >= 0) { + if(client_info.count) { + printf("\tAP %u clients:\n", client_info.count); + int client_idx = 0; + while(client_idx++ < client_info.count) { + unsigned char *pmac = client_info.mac_list[client_idx].octet; + printf("\tsta[%u]: %02x:%02x:%02x:%02x:%02x:%02x\n", client_idx, + pmac[0],pmac[1],pmac[2],pmac[3],pmac[4],pmac[5]); + } + } else { + printf("\tAP clients none\n"); + } + return client_info.count; + }; + }; + printf("Get AP clients error!\n"); + return -1; +} diff --git a/USDK/component/common/api/wifi_api.h b/USDK/component/common/api/wifi_api.h index f52821e..07a6c22 100644 --- a/USDK/component/common/api/wifi_api.h +++ b/USDK/component/common/api/wifi_api.h @@ -152,6 +152,7 @@ void show_wifi_st_ip(void); void show_wifi_cfg(void); void show_wifi_st_cfg(void); void show_wifi_ap_cfg(void); +int show_wifi_ap_clients(void); uint32 read_wifi_cfg(uint32 flg); uint32 write_wifi_cfg(uint32 flg); int wifi_run(rtw_mode_t mode); diff --git a/project/src/console/wifi_console.c b/project/src/console/wifi_console.c index 9184b32..3d1da69 100644 --- a/project/src/console/wifi_console.c +++ b/project/src/console/wifi_console.c @@ -191,6 +191,9 @@ LOCAL void fATWI(int argc, char *argv[]) { printf("\nWIFI ST config:\n"); printf(&str_rom_57ch3Dch0A[25]); // "================================\n" show_wifi_st_cfg(); + printf("\nWIFI AP clients:\n"); + printf(&str_rom_57ch3Dch0A[25]); // "================================\n" + show_wifi_ap_clients(); printf("\n"); } diff --git a/project/src/web/web_int_callbacks.c b/project/src/web/web_int_callbacks.c index cbfc6d5..a411b16 100644 --- a/project/src/web/web_int_callbacks.c +++ b/project/src/web/web_int_callbacks.c @@ -519,7 +519,6 @@ extern int adc_ws(TCP_SERV_CONN *ts_conn, char cmd); else ifcmp("gw") tcp_puts(IPSTR, IP2STR(&wifi_ap_dhcp.gw)); else ifcmp("msk") tcp_puts(IPSTR, IP2STR(&wifi_ap_dhcp.mask)); else ifcmp("cip") tcp_puts(IPSTR, IP2STR(&xnetif[WLAN_ST_NETIF_NUM].ip_addr.addr)); - // else ifcmp("mac") strtomac(pvar, wifi_ap_cfg.macaddr); // else ifcmp("sip") tcp_puts(IPSTR, IP2STR(&wifi_ap_dhcp.start_ip)); // else ifcmp("eip") tcp_puts(IPSTR, IP2STR(&wifi_ap_dhcp.end_ip)); diff --git a/userset.mk b/userset.mk index 80b2342..c71a79e 100644 --- a/userset.mk +++ b/userset.mk @@ -6,8 +6,8 @@ SDK_PATH = USDK/ #GCC_PATH = d:/MCU/GNU_Tools_ARM_Embedded/6.2017-q1-update/bin/# + or set in PATH OPENOCD_PATH = D:/MCU/OpenOCD/bin/ TOOLS_PATH ?= $(SDK_PATH)component/soc/realtek/8195a/misc/iar_utility/common/tools/ -FLASHER_TYPE = Jlink -#FLASHER_TYPE = cmsis-dap +#FLASHER_TYPE = Jlink +FLASHER_TYPE = cmsis-dap FLASHER_SPEED = 3500 FLASHER_PATH = flasher/ JLINK_PATH ?= D:/MCU/SEGGER/JLink_V612i/