From 3c244b24eaa3d360edc9abae101bae3acfbb3ed1 Mon Sep 17 00:00:00 2001 From: payton Date: Thu, 1 Feb 2024 13:49:29 +0800 Subject: [PATCH] =?UTF-8?q?1.WiFi=E5=90=AF=E5=8A=A8=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../source/sf_app/code/include/sf_wifi_svr.h | 1 + .../sf_app/code/source/wifi/sf_wifi_svr.c | 69 +++++++++++++++---- 2 files changed, 58 insertions(+), 12 deletions(-) diff --git a/code/application/source/sf_app/code/include/sf_wifi_svr.h b/code/application/source/sf_app/code/include/sf_wifi_svr.h index e21f54853..5aff8b709 100755 --- a/code/application/source/sf_app/code/include/sf_wifi_svr.h +++ b/code/application/source/sf_app/code/include/sf_wifi_svr.h @@ -977,4 +977,5 @@ void appSvrResponseSocketSet(SINT32 socket); SINT32 appSvrResponseSocketGet(void); void sf_set_phone_shot_status(const PHONE_SHOT_E status); const PHONE_SHOT_E sf_get_phone_shot_status(void); +int sf_load_wifi_ko(void); #endif /*__SF_WIFI_SERVER__*/ diff --git a/code/application/source/sf_app/code/source/wifi/sf_wifi_svr.c b/code/application/source/sf_app/code/source/wifi/sf_wifi_svr.c index b3e627c6a..caba7166b 100755 --- a/code/application/source/sf_app/code/source/wifi/sf_wifi_svr.c +++ b/code/application/source/sf_app/code/source/wifi/sf_wifi_svr.c @@ -2857,18 +2857,18 @@ void sf_wifi_hw_init(void) { ret = system("modprobe 8189fs"); } - else - { - ret = system("modprobe 8723du"); - if(ret == 0) - { - printf("Wifi modprobe OK\r\n"); - } - else - { - printf("Wifi modprobe ERR\r\n"); - } - } + // else + // { + // ret = system("modprobe 8723du"); + // if(ret == 0) + // { + // printf("Wifi modprobe OK\r\n"); + // } + // else + // { + // printf("Wifi modprobe ERR\r\n"); + // } + // } //sleep(2); ret = system("ifconfig lo 127.0.0.1"); if(ret == 0) @@ -3055,3 +3055,48 @@ void sf_wifi_app_start(void) pthread_create(&tid,NULL,(void*)sf_wifi_sevrer_init,(void *)NULL); } +BOOL sf_system_check_wifi_ko(void) +{ + char command[30] = "lsmod | grep 8723du"; + FILE *fp = popen(command, "r"); + char result[256]; + fgets(result, sizeof(result), fp); + pclose(fp); + if (result[0] == '\0') { + MLOGI("rtk_btusb module is not loaded.\n"); + return FALSE; + } else { + MLOGI("rtk_btusb module is loaded.\n"); + return TRUE; + } +} + +int sf_load_wifi_ko(void) +{ + int ret = 0; + MLOGI("start.\n"); + if (sf_system_check_wifi_ko() == TRUE) + { + return TRUE; + } + ret = system("insmod /lib/custom/lib/modules/4.19.91/kernel/net/wireless/cfg80211.ko"); + if(ret == 0) + { + printf("Wifi cfg80211 OK\r\n"); + } + else + { + printf("Wifi cfg80211 ERR\r\n"); + } + ret = system("insmod /lib/custom/lib/modules/4.19.91/extra/net/rtl8723du/8723du.ko"); + if(ret == 0) + { + printf("Wifi rtl8723du OK\r\n"); + } + else + { + printf("Wifi rtl8723du ERR\r\n"); + } + + return ret; +} \ No newline at end of file