1.qlog优化

This commit is contained in:
payton 2023-11-23 15:41:13 +08:00
parent 1ee469df69
commit ee41d9c0bd
2 changed files with 56 additions and 24 deletions

View File

@ -78,6 +78,11 @@ SF_THREAD_S ThumbSend = {
.TskId = -1, .TskId = -1,
}; };
SF_THREAD_S QlogTsk = {
.IsRun = 0,
.TskId = -1,
};
SINT32 app_ttyusb_IsOpen(void) { SINT32 app_ttyusb_IsOpen(void) {
int retryTime = 0; int retryTime = 0;
int retryFlag = 0; int retryFlag = 0;
@ -147,26 +152,53 @@ SF_BOOL app_disconnect_4g_module(void) {
#if SF_QLOG_ENABLE #if SF_QLOG_ENABLE
static SINT16 app_Qlog_procress(void) { static SINT16 app_Qlog_procress(void) {
SINT16 s32ret = SF_SUCCESS; SINT16 s32ret = SF_SUCCESS;
char qlogPath[128] = {0}; char qlogPath[128] = {0};
char qlogDirCmd[128] = {0}; char qlogDirCmd[128] = {0};
time_t timep; time_t timep;
struct tm *p; struct tm *p;
time(&timep); if(SF_FAILURE == sf_check_sd())
p = gmtime(&timep); {
if (access("/mnt/sd/qlog", F_OK) != 0) { MLOGE("ERROR sf_check_sd\n");
return SF_FAILURE;
}
time(&timep);
p = gmtime(&timep);
if (access("/mnt/sd/qlog", F_OK) != 0) {
s32ret = mkdir("/mnt/sd/qlog", S_IRWXU); s32ret = mkdir("/mnt/sd/qlog", S_IRWXU);
if (s32ret != 0) if (s32ret != 0)
return s32ret; return s32ret;
} }
sprintf(qlogPath, "%04d%02d%02d%02d%02d%02d", p->tm_year + 1900, sprintf(qlogPath, "%04d%02d%02d%02d%02d%02d", p->tm_year + 1900,
p->tm_mon + 1, p->tm_mday, p->tm_hour, p->tm_min, p->tm_sec); p->tm_mon + 1, p->tm_mday, p->tm_hour, p->tm_min, p->tm_sec);
sprintf(qlogDirCmd, "/usr/bin/QLog -s %s%s &", QLOG_PATH, qlogPath); sprintf(qlogDirCmd, "/usr/bin/QLog -s %s%s &", QLOG_PATH, qlogPath);
MLOGD("%s\n", qlogDirCmd); MLOGD("%s\n", qlogDirCmd);
s32ret = system(qlogDirCmd); s32ret = system(qlogDirCmd);
while (sf_app_while_flag())
{
sf_sleep_ms(200);
if (sf_sd_status_get() != SF_SD_OK)
{
break;
}
}
s32ret = system("killall QLog");
QlogTsk.IsRun = 0;
MLOGI("exit QlogTsk.IsRun:%d\n", QlogTsk.IsRun);
return s32ret;
}
return s32ret; void sf_app_qlog_start(void)
{
MLOGI("QlogTsk.IsRun:%d\n", QlogTsk.IsRun);
if (!QlogTsk.IsRun)
{
pthread_create(&QlogTsk.TskId, NULL, (void *)app_Qlog_procress, NULL);
QlogTsk.IsRun = 1;
SF_MUTEX_INIT_LOCK(QlogTsk.mutexLock);
}
} }
#endif #endif
@ -1413,7 +1445,7 @@ static SINT32 app_Register_Net_startup_mode(SF_FN_PARAM_S *pfnParam)
#if SF_QLOG_ENABLE #if SF_QLOG_ENABLE
if (pCustomerParam->QLogSwitch == 1) if (pCustomerParam->QLogSwitch == 1)
app_Qlog_procress(); sf_app_qlog_start();
#endif #endif
s32ret = sf_4G_sim_init(pfnParam); s32ret = sf_4G_sim_init(pfnParam);
@ -1527,7 +1559,7 @@ static SINT32 app_Register_Net_startup_mode(SF_FN_PARAM_S *pfnParam)
#if SF_QLOG_ENABLE #if SF_QLOG_ENABLE
if (pCustomerParam->QLogSwitch == 1) if (pCustomerParam->QLogSwitch == 1)
app_Qlog_procress(); sf_app_qlog_start();
#endif #endif
@ -1584,7 +1616,7 @@ static SINT32 app_Register_Net_startup_mode(SF_FN_PARAM_S *pfnParam)
#if SF_QLOG_ENABLE #if SF_QLOG_ENABLE
if (pCustomerParam->QLogSwitch == 1) if (pCustomerParam->QLogSwitch == 1)
app_Qlog_procress(); sf_app_qlog_start();
#endif #endif
s32ret = sf_4G_sim_init(pfnParam); s32ret = sf_4G_sim_init(pfnParam);
@ -1618,7 +1650,7 @@ static SINT32 app_Register_Net_startup_mode(SF_FN_PARAM_S *pfnParam)
#if SF_QLOG_ENABLE #if SF_QLOG_ENABLE
if (pCustomerParam->QLogSwitch == 1) if (pCustomerParam->QLogSwitch == 1)
app_Qlog_procress(); sf_app_qlog_start();
#endif #endif
s32ret = sf_4G_sim_init(pfnParam); s32ret = sf_4G_sim_init(pfnParam);
@ -1669,7 +1701,7 @@ static SINT32 app_Register_Net_startup_mode(SF_FN_PARAM_S *pfnParam)
#if SF_QLOG_ENABLE #if SF_QLOG_ENABLE
if (pCustomerParam->QLogSwitch == 1) if (pCustomerParam->QLogSwitch == 1)
app_Qlog_procress(); sf_app_qlog_start();
#endif #endif
@ -1809,7 +1841,7 @@ static SINT32 app_Register_Net_startup_mode(SF_FN_PARAM_S *pfnParam)
#if SF_QLOG_ENABLE #if SF_QLOG_ENABLE
if (pCustomerParam->QLogSwitch == 1) if (pCustomerParam->QLogSwitch == 1)
app_Qlog_procress(); sf_app_qlog_start();
#endif #endif
s32ret = sf_4G_sim_init(pfnParam); s32ret = sf_4G_sim_init(pfnParam);
@ -1969,7 +2001,7 @@ SINT32 sf_module_reboot_reg_net(void)
#if SF_QLOG_ENABLE #if SF_QLOG_ENABLE
if (pCustomerParam->QLogSwitch == 1) if (pCustomerParam->QLogSwitch == 1)
app_Qlog_procress(); sf_app_qlog_start();
#endif #endif
s32ret = sf_4G_sim_init(&stpfncallback); s32ret = sf_4G_sim_init(&stpfncallback);

View File

@ -384,7 +384,7 @@ SINT32 sf_sd_loopremove(const char *path)
SF_SD_STATUS_E sf_sd_status_get(void) SF_SD_STATUS_E sf_sd_status_get(void)
{ {
MLOGI("SdStatus:%d\n", SdStatus); //MLOGI("SdStatus:%d\n", SdStatus);
return SdStatus; return SdStatus;
} }