From cfc372f9bba6e5977c71748cfb333d060ed46ce4 Mon Sep 17 00:00:00 2001 From: Yilu Mao Date: Sat, 6 May 2023 14:51:20 +0800 Subject: [PATCH] Use only AOS_COMP_WIFI macro 1. Clean the old NET_WITH_WIFI macro; 2. Clear the wifi dependency; 3. remove the debug command which is not supported; Signed-off-by: Yilu Mao --- components/init/aos_init.c | 12 +++--------- components/lwip/lwip2.0.0/apps/iperf/iperf_task.c | 8 ++++---- components/lwip/lwip2.0.0/apps/ping/net_deamon.c | 4 ++++ components/netmgr/activation/activation.c | 4 +++- components/netmgr/package.yaml | 5 ++--- components/netmgr/src/netmgr_ethernet.c | 2 -- 6 files changed, 16 insertions(+), 19 deletions(-) diff --git a/components/init/aos_init.c b/components/init/aos_init.c index cdcac4843e..ce0019bafa 100644 --- a/components/init/aos_init.c +++ b/components/init/aos_init.c @@ -133,7 +133,7 @@ static void tcpip_cli_init(void) aos_cli_register_commands(&tcpip_cli_cmd[0],sizeof(tcpip_cli_cmd) / sizeof(struct cli_command)); } -#ifdef AOS_NET_WITH_WIFI +#if(AOS_COMP_WIFI > 0) static uint8_t hex(char c) { if (c >= '0' && c <= '9') @@ -154,11 +154,6 @@ static void hexstr2bin(const char *macstr, uint8_t *mac, int len) } } -static void wifi_debug_cmd(char *buf, int len, int argc, char **argv) -{ - hal_wifi_start_debug_mode(NULL); -} - static void mac_cmd(char *buf, int len, int argc, char **argv) { uint8_t mac[6]; @@ -184,7 +179,6 @@ static void mac_cmd(char *buf, int len, int argc, char **argv) static struct cli_command wifi_cli_cmd[] = { - { "wifi_debug", "wifi debug mode", wifi_debug_cmd }, { "mac", "get/set mac", mac_cmd }, }; @@ -192,7 +186,7 @@ static void hal_wifi_cli_init(void) { aos_cli_register_commands(&wifi_cli_cmd[0],sizeof(wifi_cli_cmd) / sizeof(struct cli_command)); } -#endif /* AOS_NET_WITH_WIFI */ +#endif /* AOS_COMP_WIFI */ #endif /* CONFIG_AOS_LWIP */ #endif /*!defined CONFIG_NO_LWIP */ @@ -205,7 +199,7 @@ void cli_service_init(kinit_t *kinit) #ifndef CONFIG_NO_LWIP #if(CONFIG_AOS_LWIP > 0) tcpip_cli_init(); -#ifdef AOS_NET_WITH_WIFI +#if(AOS_COMP_WIFI > 0) hal_wifi_cli_init(); #endif #ifdef IPERF_ENABLED diff --git a/components/lwip/lwip2.0.0/apps/iperf/iperf_task.c b/components/lwip/lwip2.0.0/apps/iperf/iperf_task.c index 61d2d95851..7d42f2c605 100644 --- a/components/lwip/lwip2.0.0/apps/iperf/iperf_task.c +++ b/components/lwip/lwip2.0.0/apps/iperf/iperf_task.c @@ -9,9 +9,9 @@ #include "lwip/opt.h" #include "iperf_wrapper.h" #ifdef AOS_NETMGR_WITH_MODERN -#ifdef AOS_NET_WITH_WIFI +#ifdef AOS_COMP_WIFI #include "wifi_service.h" -#endif /* AOS_NET_WITH_WIFI */ +#endif /* AOS_COMP_WIFI */ #endif /* AOS_NETMGR_WITH_MODERN */ #include "lwip/debug.h" #include "lwip/sockets.h" @@ -1176,11 +1176,11 @@ void iperf_display_report( char *report_title, unsigned time, unsigned h_ms_time aos_cli_printf("%d bits/sec", pkt_count.Bytes ); #ifdef AOS_NETMGR_WITH_MODERN -#ifdef AOS_NET_WITH_WIFI +#ifdef AOS_COMP_WIFI int rssi; wifi_service_get_rssi(&rssi); aos_cli_printf(" rssi: %d dBm", rssi); -#endif /* AOS_NET_WITH_WIFI */ +#endif /* AOS_COMP_WIFI */ #endif /* AOS_NETMGR_WITH_MODERN */ aos_cli_printf("\n"); diff --git a/components/lwip/lwip2.0.0/apps/ping/net_deamon.c b/components/lwip/lwip2.0.0/apps/ping/net_deamon.c index 7842cd251a..295b228475 100644 --- a/components/lwip/lwip2.0.0/apps/ping/net_deamon.c +++ b/components/lwip/lwip2.0.0/apps/ping/net_deamon.c @@ -11,7 +11,9 @@ #include "lwip/prot/ip4.h" #include "lwip/sockets.h" +#ifdef AOS_COMP_WIFI #include "vfsdev/wifi_dev.h" +#endif #include "ulog/ulog.h" #define PRINT_TAG "net_deamon" @@ -293,6 +295,7 @@ void start_net_deamon(void) void get_gw_addr(ip4_addr_t *gw_addr) { +#if AOS_COMP_WIFI int ret = 0; wifi_ip_stat_t ip_stat = {0}; //ret = wifi_get_ip_stat(NULL, &ip_stat, STATION); @@ -305,6 +308,7 @@ void get_gw_addr(ip4_addr_t *gw_addr) LWIP_DEBUGF( PING_DEBUG, ("Convert ipaddr addr failed!\n")); return; } +#endif return; } void stop_net_deamon(void) diff --git a/components/netmgr/activation/activation.c b/components/netmgr/activation/activation.c index af816cd845..785b0b655e 100644 --- a/components/netmgr/activation/activation.c +++ b/components/netmgr/activation/activation.c @@ -17,8 +17,10 @@ #ifdef SYSINFO_MCU_ESP32 #include "esp_log.h" #else +#ifdef AOS_COMP_WIFI #include #endif +#endif #define TAG "ACTIVATION_REPORT" @@ -178,7 +180,7 @@ int activation_get_report_msg(char *report_msg, int len) #ifdef SYSINFO_MCU_ESP32 extern esp_err_t esp_efuse_mac_get_custom(uint8_t *mac); esp_efuse_mac_get_custom(mac); -#else +#elif defined(AOS_COMP_WIFI) fd = open("/dev/wifi0", O_RDWR); if ((fd < 0) || (0 != ioctl(fd, WIFI_DEV_CMD_GET_MAC, mac))) { ACTIVATION_ERR("%s:%d WIFI_DEV_CMD_GET_MAC cmd failed!!\n", __func__, __LINE__); diff --git a/components/netmgr/package.yaml b/components/netmgr/package.yaml index 647b13b971..c67629ce39 100644 --- a/components/netmgr/package.yaml +++ b/components/netmgr/package.yaml @@ -16,11 +16,10 @@ license: Apache license v2.0 # <可选项> 源代码的 depends: # <可选项> 该组件依赖其他的组件,合理的依赖才能保证组件能编译、使用 # - minilibc: v7.2.0 # - aos: >=v7.2.0 - - wifi: master - osal_aos: master - uservice: master - sntp: master - - posix: master + - posix: master ? - lwip: master ## 第四部分:编译连接信息 @@ -55,7 +54,7 @@ build_config: source_file: - src/netmgr_service.c - - src/netmgr_wifi.c + - src/netmgr_wifi.c ? - src/netmgr_conn.c - src/netmgr_ethernet.c - src/string_convert.c diff --git a/components/netmgr/src/netmgr_ethernet.c b/components/netmgr/src/netmgr_ethernet.c index 2b140c1fab..ce249e11c5 100644 --- a/components/netmgr/src/netmgr_ethernet.c +++ b/components/netmgr/src/netmgr_ethernet.c @@ -2,8 +2,6 @@ #include #include #include -#include -#include #include "netmgr.h" #include "netmgr_conn.h" #include "netmgr_ethernet.h" -- GitLab