在關(guān)機充電界面线罕,想在cpp程序中輸出printf的內(nèi)容坚芜,但是發(fā)現(xiàn)在串口終端中無法顯示這類log旅赢,所以得想其他辦法來讓其可在串口終端上顯示出來宛蚓,調(diào)試程序會方便很多激捏。
方法如下:
1、打開\system\core\include\cutils\klog.h
添加一行自定義的打印tag
#define KLOG_BOOTINFO(tag,x...) klog_write(KLOG_PERFORMANCE_LEVEL, "<0>" tag ": " x)
2凄吏、在需要打印log的地方添加引用远舅,這樣打印的內(nèi)容在串口終端中就可以正常顯示了。
#include <cutils/klog.h>
#define BOOTINFO(x...) KLOG_BOOTINFO("graphic", x)
#define BOOTINFO(x...) KLOG_BOOTINFO("graphic", x)
BOOTINFO("pis gr_init_font entry.\n");