增加DEBUG_TX调试日志

This commit is contained in:
zzh 2025-06-16 14:50:31 +08:00
parent f29779995f
commit d315d63d27
2 changed files with 29 additions and 0 deletions

View File

@ -82,3 +82,22 @@ int buffer_to_file(const char *pathname, const char *data, unsigned int size,con
}
return temp;
}
// 新增DEBUG_TX调试打印
int debug_tx_print(const char *format, ...)
{
if (access("/tmp/debug_tx_enable", F_OK) != 0) {
return 0;
}
va_list valist;
char buffer[512] = "";
int ret;
va_start(valist, format);
ret = vsnprintf(buffer, sizeof(buffer), format, valist);
va_end(valist);
printf("[DEBUG_TX] %s", buffer);
return ret;
}
#define DEBUG_TX(fmt, ...) \
do { debug_tx_print(fmt, ##__VA_ARGS__); } while(0)

View File

@ -248,3 +248,13 @@ extern "C" {
#endif
#endif /* _PRINTT_DBG_H_ */
#ifndef DEBUG_PRINT_H
#define DEBUG_PRINT_H
int debug_tx_print(const char *format, ...);
#define DEBUG_TX(fmt, ...) \
do { debug_tx_print(fmt, ##__VA_ARGS__); } while(0)
#endif