Android 13 kernel日志打印时间混乱问题

文章讲述了在全志平台执行串口打印时遇到logcat时间紊乱的问题,涉及LogKlog.cpp文件的修改,提供了解决方案,重点在于计算时间修正并处理healthdStr和batteryStr相关逻辑。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

全志平台出现执行串口打印logcat,会出现打印出来的时间紊乱如图:

解决的方法如下:

system/logging/logd$ git diff LogKlog.cpp
diff --git a/logd/LogKlog.cpp b/logd/LogKlog.cpp
old mode 100644
new mode 100755
index dc788e1..cfe5833
--- a/logd/LogKlog.cpp
+++ b/logd/LogKlog.cpp
@@ -317,7 +317,9 @@ log_time LogKlog::sniffTime(const char*& buf, ssize_t len, bool reverse) {
             calculateCorrection(now, b, len);
         } else if (((b = android::strnstr(cp, len, healthdStr))) &&
                    (((b += strlen(healthdStr)) - cp) < len) &&
-                   ((b = android::strnstr(b, len -= b - cp, batteryStr))) &&
+                   // AW CODE START: [fix] log: fix kernel timer update failed
+                  ((b = android::strnstr(b, len - (b - cp), batteryStr))) &&
+                  // AW CODE END
                    (((b += strlen(batteryStr)) - cp) < len)) {
             // NB: healthd is roughly 150us late, so we use it instead to
             //     trigger a check for ntp-induced or hardware clock drift.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值