[Feature][T108] [task-view-1792] modify LOG
Only Configure: No
Affected branch: GSW_V1453
Affected module: wifi,uart,gnss
Self-test: yes
Doc Update: no
Change-Id: I51ac94eed6b94db91ea7cfa22c65c70ff1ef890b
diff --git a/mbtk/libgsw_lib/gsw_wifi_interface_sdk.c b/mbtk/libgsw_lib/gsw_wifi_interface_sdk.c
index 77cc924..3937ab4 100755
--- a/mbtk/libgsw_lib/gsw_wifi_interface_sdk.c
+++ b/mbtk/libgsw_lib/gsw_wifi_interface_sdk.c
@@ -30,127 +30,11 @@
#define VALID_2G_CHANNELS {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}
#define VALID_5G_CHANNELS {36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165}
-#ifndef LOG_ERR_LEVEL
-#define LOG_ERR_LEVEL 3 /* error conditions */
-#endif
-#ifndef LOG_WARN_LEVEL
-#define LOG_WARN_LEVEL 4 /* warning conditions */
-#endif
-#ifndef LOG_INFO_LEVEL
-#define LOG_INFO_LEVEL 6 /* informational */
-#endif
-#ifndef LOG_DEBUG_LEVEL
-#define LOG_DEBUG_LEVEL 7 /* debug-level messages */
-#endif
-#ifndef LOG_VERBOSE_LEVEL
-#define LOG_VERBOSE_LEVEL 8
-#endif
+#include "gsw_log_interface.h"
+#define GSW_WIFI "[HAL][GSW_WIFI]"
-#define GSW_UART "[HAL][GSW_WIFI]"
-
-#define LOGV(fmt, args...) \
- do \
- { \
- char *file_ptr_1001 = __FILE__; \
- char *ptr_1001 = file_ptr_1001 + strlen(file_ptr_1001) - 1; \
- char line_1001[10] = {0}; \
- sprintf(line_1001, "%d", __LINE__); \
- while (ptr_1001 >= file_ptr_1001 && *ptr_1001) \
- { \
- if (*ptr_1001 == '/') \
- break; \
- ptr_1001--; \
- } \
- fun_ptr_log(LOG_VERBOSE_LEVEL, "%s#%s: " GSW_UART "" fmt, ptr_1001 + 1, line_1001, ##args); \
- } while (0)
-
-#define LOGI(fmt, args...) \
- do \
- { \
- char *file_ptr_1001 = __FILE__; \
- char *ptr_1001 = file_ptr_1001 + strlen(file_ptr_1001) - 1; \
- char line_1001[10] = {0}; \
- sprintf(line_1001, "%d", __LINE__); \
- while (ptr_1001 >= file_ptr_1001 && *ptr_1001) \
- { \
- if (*ptr_1001 == '/') \
- break; \
- ptr_1001--; \
- } \
- fun_ptr_log(LOG_INFO_LEVEL, "%s#%s: " GSW_UART "" fmt, ptr_1001 + 1, line_1001, ##args); \
- } while (0)
-
-#define LOGD(fmt, args...) \
- do \
- { \
- char *file_ptr_1001 = __FILE__; \
- char *ptr_1001 = file_ptr_1001 + strlen(file_ptr_1001) - 1; \
- char line_1001[10] = {0}; \
- sprintf(line_1001, "%d", __LINE__); \
- while (ptr_1001 >= file_ptr_1001 && *ptr_1001) \
- { \
- if (*ptr_1001 == '/') \
- break; \
- ptr_1001--; \
- } \
- fun_ptr_log(LOG_DEBUG_LEVEL, "%s#%s: " GSW_UART "" fmt, ptr_1001 + 1, line_1001, ##args); \
- } while (0)
-
-#define LOGW(fmt, args...) \
- do \
- { \
- char *file_ptr_1001 = __FILE__; \
- char *ptr_1001 = file_ptr_1001 + strlen(file_ptr_1001) - 1; \
- char line_1001[10] = {0}; \
- sprintf(line_1001, "%d", __LINE__); \
- while (ptr_1001 >= file_ptr_1001 && *ptr_1001) \
- { \
- if (*ptr_1001 == '/') \
- break; \
- ptr_1001--; \
- } \
- fun_ptr_log(LOG_WARN_LEVEL, "%s#%s: " GSW_UART "" fmt, ptr_1001 + 1, line_1001, ##args); \
- } while (0)
-
-#define LOGE(fmt, args...) \
- do \
- { \
- char *file_ptr_1001 = __FILE__; \
- char *ptr_1001 = file_ptr_1001 + strlen(file_ptr_1001) - 1; \
- char line_1001[10] = {0}; \
- sprintf(line_1001, "%d", __LINE__); \
- while (ptr_1001 >= file_ptr_1001 && *ptr_1001) \
- { \
- if (*ptr_1001 == '/') \
- break; \
- ptr_1001--; \
- } \
- fun_ptr_log(LOG_ERR_LEVEL, "%s#%s: " GSW_UART "" fmt, ptr_1001 + 1, line_1001, ##args); \
- } while (0)
-
-typedef void (*mbtk_log)(int level, const char *format, ...);
-static mbtk_log fun_ptr_log = NULL;
-static void *dlHandle_wifi = NULL;
-static void (*mbtk_log_init)(char *path, char *tag);
-#define LIB_PATH "/lib/libmbtk_lib.so"
-
-static int handle()
+static inline int handle()
{
- if (dlHandle_wifi == NULL || fun_ptr_log == NULL)
- {
- dlHandle_wifi = dlopen(LIB_PATH, RTLD_NOW);
- if(dlHandle_wifi == NULL)
- {
- return GSW_HAL_NORMAL_FAIL;
- }
- mbtk_log_init = (void (*)(char *path, char *tag))dlsym(dlHandle_wifi, "mbtk_log_init");
- mbtk_log_init("radio", "MBTK_RIL");
- fun_ptr_log = (mbtk_log)dlsym(dlHandle_wifi, "mbtk_log");
- if (fun_ptr_log == NULL || dlHandle_wifi == NULL)
- {
- return GSW_HAL_NORMAL_FAIL;
- }
- }
return GSW_HAL_SUCCESS;
}
@@ -160,7 +44,7 @@
int status = system(cmd);
if (status == -1)
{
- LOGE("Failed to execute command");
+ LOGE(GSW_WIFI,"Failed to execute command");
return GSW_HAL_NORMAL_FAIL;
}
if (WIFEXITED(status))
@@ -239,7 +123,7 @@
{
if (handle())
return GSW_HAL_NORMAL_FAIL;
- LOGI("gsw_wifi_ap_start\n");
+ LOGI(GSW_WIFI,"gsw_wifi_ap_start\n");
// 强制终止所有hostapd进程(关键新增:避免残留进程占用资源)
execute_command("killall -9 hostapd >/dev/null 2>&1"); // 9信号强制终止
sleep(1); // 等待进程完全退出
@@ -256,7 +140,7 @@
{
if (remove(ctrl_path) != 0)
{
- LOGE("Failed to remove old hostapd control interface file");
+ LOGE(GSW_WIFI,"Failed to remove old hostapd control interface file");
return GSW_HAL_NORMAL_FAIL;
}
}
@@ -273,16 +157,16 @@
// 检查日志中是否包含关键错误信息(示例:"Failed"、"error")
if (strstr(log_buffer, "failed") || strstr(log_buffer, "error") || strstr(log_buffer, "wasn't started"))
{
- LOGE("Hostapd start failed, check log: %s", log_buffer);
+ LOGE(GSW_WIFI,"Hostapd start failed, check log: %s", log_buffer);
return GSW_HAL_NORMAL_FAIL;
}
if(is_hostapd_running() == GSW_HAL_SUCCESS)
{
- LOGI("Hostapd start success");
+ LOGI(GSW_WIFI,"Hostapd start success");
}
else
{
- LOGE("Hostapd start failed, check log: %s", log_buffer);
+ LOGE(GSW_WIFI,"Hostapd start failed, check log: %s", log_buffer);
return GSW_HAL_NORMAL_FAIL;
}
}
@@ -290,11 +174,11 @@
{
if (is_hostapd_running() != GSW_HAL_SUCCESS)
{
- LOGE("Failed to read hostapd log file: %s", HOSTAPD_LOG_PATH);
+ LOGE(GSW_WIFI,"Failed to read hostapd log file: %s", HOSTAPD_LOG_PATH);
return GSW_HAL_NORMAL_FAIL;
}
}
- LOGI("gsw_wifi_ap_start ret = %d\n", status);
+ LOGI(GSW_WIFI,"gsw_wifi_ap_start ret = %d\n", status);
return status;
}
@@ -333,11 +217,11 @@
return GSW_HAL_NORMAL_FAIL;
if (is_hostapd_running() != 0)
{
- LOGI("Hostapd is not running, no need to stop.\n");
+ LOGI(GSW_WIFI,"Hostapd is not running, no need to stop.\n");
return GSW_HAL_SUCCESS;
}
- LOGI("Hostapd is running, stop it.\n");
+ LOGI(GSW_WIFI,"Hostapd is running, stop it.\n");
// 先停止事件监听线程
/*if (ap_event_context.running)
{
@@ -360,10 +244,10 @@
{
if (remove(path) != 0)
{
- LOGE("Failed to remove hostapd control interface file");
+ LOGE(GSW_WIFI,"Failed to remove hostapd control interface file");
}
}
- LOGI("gsw_wifi_ap_stop ret = %d\n", status);
+ LOGI(GSW_WIFI,"gsw_wifi_ap_stop ret = %d\n", status);
return status;
}
@@ -375,7 +259,7 @@
char cmd[MAX_COMMAND_LEN];
snprintf(cmd, sizeof(cmd), "killall hostapd");
int status = execute_command(cmd);
- LOGI("killall hostapd status = %d\n", status);
+ LOGI(GSW_WIFI,"killall hostapd status = %d\n", status);
// 关闭对应的 hostapd 后,删除对应的文件
char path[MAX_COMMAND_LEN];
snprintf(path, sizeof(path), "%s/%s", CTRL_INTERFACE, WLAN_AP_DEV);
@@ -383,11 +267,11 @@
{
if (remove(path) != 0)
{
- LOGE("Failed to remove hostapd control interface file");
+ LOGE(GSW_WIFI,"Failed to remove hostapd control interface file");
}
}
ret = gsw_wifi_ap_start();
- LOGI("gsw_wifi_ap_restart ret = %d\n", ret);
+ LOGI(GSW_WIFI,"gsw_wifi_ap_restart ret = %d\n", ret);
return ret;
}
@@ -398,15 +282,15 @@
char buffer[4096] = {0};
char new_config[4096] = {0};
if (ssid == NULL) {
- LOGE("Password cannot be NULL");
+ LOGE(GSW_WIFI,"Password cannot be NULL");
return GSW_HAL_NORMAL_FAIL;
}
size_t ssid_len = strlen(ssid);
if (ssid_len > MAX_SSID_LEN || ssid_len < MIN_SSID_LEN) {
- LOGE("SSID length must be 6-32 characters, current length: %zu", ssid_len);
+ LOGE(GSW_WIFI,"SSID length must be 6-32 characters, current length: %zu", ssid_len);
return GSW_HAL_NORMAL_FAIL;
}
- LOGI("AP set ssid: %s\n", ssid);
+ LOGI(GSW_WIFI,"AP set ssid: %s\n", ssid);
// 读取现有配置
if (read_file(HOSTAPD_CONF_PATH, buffer, sizeof(buffer)) == -1)
{
@@ -515,7 +399,7 @@
if (handle())
return GSW_HAL_NORMAL_FAIL;
if (ssid == NULL) {
- LOGE("ssid cannot be NULL");
+ LOGE(GSW_WIFI,"ssid cannot be NULL");
return GSW_HAL_NORMAL_FAIL;
}
char buffer[1024] = {0};
@@ -532,7 +416,7 @@
*end = '\0';
strncpy(ssid, ssid_line, MAX_SSID_LEN);
}
- LOGI("AP get ssid: %s\n", ssid);
+ LOGI(GSW_WIFI,"AP get ssid: %s\n", ssid);
return GSW_HAL_SUCCESS;
}
@@ -542,12 +426,12 @@
return GSW_HAL_NORMAL_FAIL;
char buffer[4096] = {0};
char new_config[4096] = {0};
- LOGI("AP set frequency: %d\n", gsw_wifi_frequency);
+ LOGI(GSW_WIFI,"AP set frequency: %d\n", gsw_wifi_frequency);
gsw_wifi_bandwidth_type_e gsw_wifi_bandwidth;
gsw_wifi_ap_bandwidth_get(&gsw_wifi_bandwidth);
if (gsw_wifi_bandwidth == GSW_WIFI_BANDWIDTH_HT80 && gsw_wifi_frequency == 1)
{
- LOGE("HT80 cannot be set to 2.4G");
+ LOGE(GSW_WIFI,"HT80 cannot be set to 2.4G");
return GSW_HAL_NORMAL_FAIL;
}
// 读取现有配置
@@ -592,7 +476,7 @@
if (handle())
return GSW_HAL_NORMAL_FAIL;
if (gsw_wifi_frequency == NULL) {
- LOGE("gsw_wifi_frequency cannot be NULL");
+ LOGE(GSW_WIFI,"gsw_wifi_frequency cannot be NULL");
return GSW_HAL_NORMAL_FAIL;
}
char buffer[1024] = {0};
@@ -606,7 +490,7 @@
mode_line += 8; // 跳过 "hw_mode="
*gsw_wifi_frequency = (mode_line[0] == 'g') ? 1 : 2;
}
- LOGI("AP get frequency: %d\n", *gsw_wifi_frequency);
+ LOGI(GSW_WIFI,"AP get frequency: %d\n", *gsw_wifi_frequency);
return GSW_HAL_SUCCESS;
}
@@ -616,16 +500,16 @@
return GSW_HAL_NORMAL_FAIL;
char buffer[4096] = {0};
char new_config[4096] = {0};
- LOGI("AP set bandwidth: %d\n", bandwidth);
+ LOGI(GSW_WIFI,"AP set bandwidth: %d\n", bandwidth);
int current_freq;
if (gsw_wifi_ap_frequency_get(¤t_freq) != 0)
{
- LOGI("Failed to get current frequency\n");
+ LOGI(GSW_WIFI,"Failed to get current frequency\n");
return GSW_HAL_NORMAL_FAIL;
}
if (current_freq == 1 && bandwidth == GSW_WIFI_BANDWIDTH_HT80) // 1表示2.4GHz
{
- LOGI("2.4GHz band does not support 80MHz bandwidth");
+ LOGI(GSW_WIFI,"2.4GHz band does not support 80MHz bandwidth");
return GSW_HAL_NORMAL_FAIL;
}
// 读取现有配置
@@ -817,7 +701,7 @@
{
*bandwidth = GSW_WIFI_BANDWIDTH_HT20;
}
- LOGI("AP get bandwidth: %d\n", *bandwidth);
+ LOGI(GSW_WIFI,"AP get bandwidth: %d\n", *bandwidth);
return GSW_HAL_SUCCESS;
}
@@ -826,11 +710,11 @@
if (handle())
return GSW_HAL_NORMAL_FAIL;
// 新增频率和信道校验
- LOGI("AP set channel: %d\n", channel);
+ LOGI(GSW_WIFI,"AP set channel: %d\n", channel);
int current_freq;
if (gsw_wifi_ap_frequency_get(¤t_freq) != 0)
{
- LOGE("Failed to get current frequency\n");
+ LOGE(GSW_WIFI,"Failed to get current frequency\n");
return GSW_HAL_NORMAL_FAIL;
}
// 定义各频段支持的信道范围
@@ -863,7 +747,7 @@
if (!valid && channel != 0)
{ // 允许0表示自动选择
- LOGI("Invalid channel %d for %s band\n",
+ LOGI(GSW_WIFI,"Invalid channel %d for %s band\n",
channel, (current_freq == 1) ? "2.4GHz" : "5GHz");
return GSW_HAL_NORMAL_FAIL;
}
@@ -936,7 +820,7 @@
return GSW_HAL_NORMAL_FAIL;
if (channel == NULL)
{
- LOGI("channel is NULL\n");
+ LOGI(GSW_WIFI,"channel is NULL\n");
return GSW_HAL_NORMAL_FAIL;
}
char buffer[1024] = {0};
@@ -950,7 +834,7 @@
channel_line += 8; // 跳过 "channel="
*channel = atoi(channel_line);
}
- LOGI("AP get channel: %d\n", *channel);
+ LOGI(GSW_WIFI,"AP get channel: %d\n", *channel);
return GSW_HAL_SUCCESS;
}
@@ -966,7 +850,7 @@
{
return GSW_HAL_NORMAL_FAIL;
}
- LOGI("AP set auth: %d\n", auth);
+ LOGI(GSW_WIFI,"AP set auth: %d\n", auth);
char *line = strtok(buffer, "\n");
while (line)
{
@@ -1171,7 +1055,7 @@
{
*auth = GSW_WIFI_AUTH_OPEN; // 默认开放模式
}
- LOGI("AP get auth: %d\n", *auth);
+ LOGI(GSW_WIFI,"AP get auth: %d\n", *auth);
return GSW_HAL_SUCCESS;
}
@@ -1183,13 +1067,13 @@
char new_config[4096] = {0};
int has_passphrase = 0; // 标记是否已处理过密码行
if (password == NULL) {
- LOGE("Password cannot be NULL");
+ LOGE(GSW_WIFI,"Password cannot be NULL");
return GSW_HAL_NORMAL_FAIL;
}
- LOGI("AP set password\n");
+ LOGI(GSW_WIFI,"AP set password\n");
size_t pass_len = strlen(password);
if (pass_len < MIN_PASSWORD_LEN || pass_len > MAX_PASSWORD_LEN) {
- LOGE("Password length must be 8-63 characters, current length: %zu", pass_len);
+ LOGE(GSW_WIFI,"Password length must be 8-63 characters, current length: %zu", pass_len);
return GSW_HAL_NORMAL_FAIL;
}
// 读取现有配置文件内容
@@ -1237,7 +1121,7 @@
char buffer[4096] = {0}; // 使用更大的缓冲区
if (read_file(HOSTAPD_CONF_PATH, buffer, sizeof(buffer)) == -1)
{
- LOGI("Failed to read hostapd config file\n");
+ LOGI(GSW_WIFI,"Failed to read hostapd config file\n");
return GSW_HAL_NORMAL_FAIL;
}
@@ -1245,7 +1129,7 @@
char *passphrase_line = strstr(buffer, "wpa_passphrase=");
if (!passphrase_line)
{
- LOGI("No password line found in config\n");
+ LOGI(GSW_WIFI,"No password line found in config\n");
return GSW_HAL_NORMAL_FAIL;
}
@@ -1262,14 +1146,14 @@
size_t pass_len = strlen(passphrase_line);
if (pass_len == 0 || pass_len >= MAX_PASSWORD_LEN)
{
- LOGI("Invalid password length: %zu\n", pass_len);
+ LOGI(GSW_WIFI,"Invalid password length: %zu\n", pass_len);
return GSW_HAL_NORMAL_FAIL;
}
// 复制密码
strncpy(password, passphrase_line, MAX_PASSWORD_LEN);
password[MAX_PASSWORD_LEN] = '\0'; // 确保终止
- LOGI("AP get password\n");
+ LOGI(GSW_WIFI,"AP get password\n");
return GSW_HAL_SUCCESS;
}
@@ -1327,11 +1211,11 @@
{
if (handle())
return GSW_HAL_NORMAL_FAIL;
- LOGI("Starting wpa_supplicant...\n");
+ LOGI(GSW_WIFI,"Starting wpa_supplicant...\n");
// 更新 wpa_supplicant 配置文件
if (update_wpa_supplicant_conf() != 0)
{
- LOGI("Failed to update wpa_supplicant configuration file.\n");
+ LOGI(GSW_WIFI,"Failed to update wpa_supplicant configuration file.\n");
return GSW_HAL_NORMAL_FAIL;
}
@@ -1345,7 +1229,7 @@
memset(cmd, 0, sizeof(cmd));
snprintf(cmd, sizeof(cmd), "wpa_cli -i %s scan_results > /dev/null", WLAN_STA_DEV);
execute_command(cmd);
- LOGI("wpa_supplicant starting success\n");
+ LOGI(GSW_WIFI,"wpa_supplicant starting success\n");
return status;
}
@@ -1353,16 +1237,16 @@
{
if (handle())
return GSW_HAL_NORMAL_FAIL;
- LOGI("Stopping wpa_supplicant...\n");
+ LOGI(GSW_WIFI,"Stopping wpa_supplicant...\n");
if (is_wpa_supplicant_running() != 0)
{
- LOGI("wpa_supplicant is not running, no need to stop.\n");
+ LOGI(GSW_WIFI,"wpa_supplicant is not running, no need to stop.\n");
return GSW_HAL_SUCCESS;
}
char cmd[MAX_COMMAND_LEN];
snprintf(cmd, sizeof(cmd), "killall wpa_supplicant");
- LOGI("Stoping success\n");
+ LOGI(GSW_WIFI,"Stoping success\n");
return execute_command(cmd);
}
@@ -1404,7 +1288,7 @@
pclose(output);
buffer[strcspn(buffer, "\n")] = '\0';
strncpy(sta_ssid, buffer, MAX_SSID_LEN);
- LOGI("SSID: %s\n", sta_ssid);
+ LOGI(GSW_WIFI,"SSID: %s\n", sta_ssid);
return GSW_HAL_SUCCESS;
}
@@ -1414,29 +1298,29 @@
return GSW_HAL_NORMAL_FAIL;
if (is_wpa_supplicant_running() != 0)
{
- LOGI("wpa_supplicant is not running.\n");
+ LOGI(GSW_WIFI,"wpa_supplicant is not running.\n");
return GSW_HAL_NORMAL_FAIL;
}
char cmd[MAX_COMMAND_LEN];
// 修改命令,获取 key_mgmt 字段
snprintf(cmd, sizeof(cmd), "wpa_cli -i %s status | grep 'key_mgmt=' | cut -d '=' -f 2", WLAN_STA_DEV);
- LOGI("Executing command: %s\n", cmd);
+ LOGI(GSW_WIFI,"Executing command: %s\n", cmd);
FILE *output = popen(cmd, "r");
if (!output)
{
- LOGI("Failed to execute command: %s\n", cmd);
+ LOGI(GSW_WIFI,"Failed to execute command: %s\n", cmd);
return GSW_HAL_NORMAL_FAIL;
}
char buffer[32];
if (fgets(buffer, sizeof(buffer), output) == NULL)
{
- LOGI("No output from command: %s\n", cmd);
+ LOGI(GSW_WIFI,"No output from command: %s\n", cmd);
pclose(output);
return GSW_HAL_NORMAL_FAIL;
}
pclose(output);
buffer[strcspn(buffer, "\n")] = '\0';
- LOGI("Command output: %s\n", buffer);
+ LOGI(GSW_WIFI,"Command output: %s\n", buffer);
if (strstr(buffer, "WPA2-PSK"))
{
@@ -1456,10 +1340,10 @@
}
else
{
- LOGI("Unknown authentication type: %s. Assuming WPA2-PSK.\n", buffer);
+ LOGI(GSW_WIFI,"Unknown authentication type: %s. Assuming WPA2-PSK.\n", buffer);
*auth = GSW_WIFI_AUTH_WPA2_PSK;
}
- LOGI("Authentication type: %s\n", buffer);
+ LOGI(GSW_WIFI,"Authentication type: %s\n", buffer);
return GSW_HAL_SUCCESS;
}
@@ -1482,14 +1366,14 @@
snprintf(quoted_password, sizeof(quoted_password), "\\\"%s\\\"", password);
}
- LOGI("SSID = %s\n", quoted_ssid);
+ LOGI(GSW_WIFI,"SSID = %s\n", quoted_ssid);
char cmd[MAX_COMMAND_LEN];
int status;
// 修改:-p 改为 -i 并使用 WLAN_STA_DEV
snprintf(cmd, sizeof(cmd), "wpa_cli -i %s remove_network 0", WLAN_STA_DEV);
- LOGI("Executing command type: Remove network\n");
+ LOGI(GSW_WIFI,"Executing command type: Remove network\n");
status = execute_command(cmd);
if (status != 0)
{
@@ -1498,7 +1382,7 @@
// 修改:-p 改为 -i 并使用 WLAN_STA_DEV
snprintf(cmd, sizeof(cmd), "wpa_cli -i %s ap_scan 1", WLAN_STA_DEV);
- LOGI("Executing command type: Set AP scan\n");
+ LOGI(GSW_WIFI,"Executing command type: Set AP scan\n");
status = execute_command(cmd);
if (status != 0)
{
@@ -1507,7 +1391,7 @@
// 修改:-p 改为 -i 并使用 WLAN_STA_DEV
snprintf(cmd, sizeof(cmd), "wpa_cli -i %s add_network", WLAN_STA_DEV);
- LOGI("Executing command type: Add network\n");
+ LOGI(GSW_WIFI,"Executing command type: Add network\n");
status = execute_command(cmd);
if (status != 0)
{
@@ -1516,7 +1400,7 @@
// 修改:-p 改为 -i 并使用 WLAN_STA_DEV
snprintf(cmd, sizeof(cmd), "wpa_cli -i %s set_network 0 ssid %s", WLAN_STA_DEV, quoted_ssid);
- LOGI("Executing command type: Set SSID\n");
+ LOGI(GSW_WIFI,"Executing command type: Set SSID\n");
status = execute_command(cmd);
if (status != 0)
{
@@ -1532,14 +1416,14 @@
key_mgmt = "NONE";
// 修改:-p 改为 -i 并使用 WLAN_STA_DEV
snprintf(cmd, sizeof(cmd), "wpa_cli -i %s set_network 0 wep_key0 %s", WLAN_STA_DEV, quoted_password);
- LOGI("Executing command type: Set WEP key\n");
+ LOGI(GSW_WIFI,"Executing command type: Set WEP key\n");
status = execute_command(cmd);
if (status != 0)
return status;
// 修改:-p 改为 -i 并使用 WLAN_STA_DEV(注意原代码中可能存在拼写错误 "weep_tx_keyidx" 应为 "wep_tx_keyidx")
snprintf(cmd, sizeof(cmd), "wpa_cli -i %s set_network 0 wep_tx_keyidx 0", WLAN_STA_DEV);
- LOGI("Executing command type: Set WEP TX key index\n");
+ LOGI(GSW_WIFI,"Executing command type: Set WEP TX key index\n");
status = execute_command(cmd);
if (status != 0)
return status;
@@ -1563,7 +1447,7 @@
{
// 修改:-p 改为 -i 并使用 WLAN_STA_DEV
snprintf(cmd, sizeof(cmd), "wpa_cli -i %s set_network 0 key_mgmt %s", WLAN_STA_DEV, key_mgmt);
- LOGI("Executing command type: Set key management\n");
+ LOGI(GSW_WIFI,"Executing command type: Set key management\n");
status = execute_command(cmd);
if (status != 0)
return status;
@@ -1592,7 +1476,7 @@
// 修改:-p 改为 -i 并使用 WLAN_STA_DEV
snprintf(cmd, sizeof(cmd), "wpa_cli -i %s set_network 0 psk %s", WLAN_STA_DEV, quoted_password);
- LOGI("Executing command type: Set PSK\n");
+ LOGI(GSW_WIFI,"Executing command type: Set PSK\n");
status = execute_command(cmd);
if (status != 0)
return status;
@@ -1602,7 +1486,7 @@
{
// 修改:-p 改为 -i 并使用 WLAN_STA_DEV
snprintf(cmd, sizeof(cmd), "wpa_cli -i %s set_network 0 key_mgmt NONE", WLAN_STA_DEV);
- LOGI("Executing command type: Set key management for open network\n");
+ LOGI(GSW_WIFI,"Executing command type: Set key management for open network\n");
status = execute_command(cmd);
if (status != 0)
return status;
@@ -1610,7 +1494,7 @@
// 修改:-p 改为 -i 并使用 WLAN_STA_DEV
snprintf(cmd, sizeof(cmd), "wpa_cli -i %s select_network 0", WLAN_STA_DEV);
- LOGI("Executing command type: Select network\n");
+ LOGI(GSW_WIFI,"Executing command type: Select network\n");
status = execute_command(cmd);
if (status != 0)
{
@@ -1619,7 +1503,7 @@
// udhcpc 命令无需修改(已使用 WLAN_STA_DEV)
snprintf(cmd, sizeof(cmd), "udhcpc -i %s -n", WLAN_STA_DEV);
- LOGI("Executing command type: Request DHCP IP\n");
+ LOGI(GSW_WIFI,"Executing command type: Request DHCP IP\n");
status = execute_command(cmd);
return status;
}
@@ -2015,7 +1899,7 @@
// 发现新MAC地址(当前存在但之前不存在)
if (!found)
{
- LOGI("New device connected: %s\n", curr_macs[i]);
+ LOGI(GSW_WIFI,"New device connected: %s\n", curr_macs[i]);
mac_updated++;
break;
}
@@ -2047,18 +1931,18 @@
{
if (handle())
return GSW_HAL_NORMAL_FAIL;
- LOGI("%s - start.\n",__func__);
+ LOGI(GSW_WIFI,"%s - start.\n",__func__);
if (ap_event_context.running)
{
return GSW_HAL_NORMAL_FAIL; // 已经注册了回调
}
if (arg == NULL)
{
- LOGE("%s - arg is NULL.\n",__func__);
+ LOGE(GSW_WIFI,"%s - arg is NULL.\n",__func__);
}
if (gsw_cb == NULL)
{
- LOGE("%s - gsw_cb is NULL.\n",__func__);
+ LOGE(GSW_WIFI,"%s - gsw_cb is NULL.\n",__func__);
return GSW_HAL_NORMAL_FAIL; // 回调函数不能为空
}
ap_event_context.arg = arg;
@@ -2069,7 +1953,7 @@
ap_event_context.running = 0;
return GSW_HAL_NORMAL_FAIL;
}
- LOGI("%s - end.\n",__func__);
+ LOGI(GSW_WIFI,"%s - end.\n",__func__);
return GSW_HAL_SUCCESS;
}
@@ -2083,7 +1967,7 @@
{
if (handle())
return GSW_HAL_NORMAL_FAIL;
- LOGI("%s - start.\n",__func__);
+ LOGI(GSW_WIFI,"%s - start.\n",__func__);
ap_event_context.running = 0;
// 检查线程是否存在
@@ -2098,7 +1982,7 @@
ap_event_context.arg = NULL;
ap_event_context.gsw_cb = NULL;
- LOGI("%s - end.\n",__func__);
+ LOGI(GSW_WIFI,"%s - end.\n",__func__);
return GSW_HAL_SUCCESS;
}
@@ -2150,7 +2034,7 @@
{
if (handle())
return GSW_HAL_NORMAL_FAIL;
- LOGI("%s - start.\n",__func__);
+ LOGI(GSW_WIFI,"%s - start.\n",__func__);
if (execute_command("echo 1 > /sys/devices/platform/mbtk-sdh/pwr_ctrl") != 0)
{
return GSW_HAL_NORMAL_FAIL;
@@ -2165,7 +2049,7 @@
}
else
{
- LOGI("cfg80211 has insmod.\n");
+ LOGI(GSW_WIFI,"cfg80211 has insmod.\n");
}
if (!is_module_loaded("aic8800_bsp"))
@@ -2179,7 +2063,7 @@
}
else
{
- LOGI("aic8800_bsp has insmod.\n");
+ LOGI(GSW_WIFI,"aic8800_bsp has insmod.\n");
}
if (!is_module_loaded("aic8800_fdrv"))
@@ -2193,9 +2077,9 @@
}
else
{
- LOGI("aic8800_fdrv has insmod.\n");
+ LOGI(GSW_WIFI,"aic8800_fdrv has insmod.\n");
}
- LOGI("%s - end.\n",__func__);
+ LOGI(GSW_WIFI,"%s - end.\n",__func__);
return GSW_HAL_SUCCESS;
}
@@ -2208,7 +2092,7 @@
{
if (handle())
return GSW_HAL_NORMAL_FAIL;
- LOGI("%s - start.\n",__func__);
+ LOGI(GSW_WIFI,"%s - start.\n",__func__);
if (is_module_loaded("aic8800_fdrv"))
{
if (execute_command("rmmod aic8800_fdrv") != 0)
@@ -2218,7 +2102,7 @@
}
else
{
- LOGI("aic8800_fdrv not insmod.\n");
+ LOGI(GSW_WIFI,"aic8800_fdrv not insmod.\n");
}
if (is_module_loaded("aic8800_bsp"))
@@ -2230,7 +2114,7 @@
}
else
{
- LOGI("aic8800_bsp not insmod.\n");
+ LOGI(GSW_WIFI,"aic8800_bsp not insmod.\n");
}
if (is_module_loaded("cfg80211"))
@@ -2242,14 +2126,14 @@
}
else
{
- LOGI("cfg80211 not insmod.\n");
+ LOGI(GSW_WIFI,"cfg80211 not insmod.\n");
}
if (execute_command("echo 0 > /sys/devices/platform/mbtk-sdh/pwr_ctrl") != 0)
{
return GSW_HAL_NORMAL_FAIL;
}
sleep(1);
- LOGI("%s - end.\n",__func__);
+ LOGI(GSW_WIFI,"%s - end.\n",__func__);
return GSW_HAL_SUCCESS;
}