user版本串口不能输入

 

描述:编译为userdebug版本时调试时,调试串口是可以正常输入输出的,编译为user版本时,串口就只能输出不能输入了。

原因:

 out/target/product/rk3288/recovery/root/init.rc  

  # Always start adbd on userdebug and eng builds
    on property:ro.debuggable=1
    write /sys/class/android_usb/android0/enable 1
    start adbd
    start console

可见,console的启用受ro.debuggable的控制,即是ro.debuggable=1时,才启动console。

可以通过指令getprop ro.debuggable查看该属性的值:

改属性在build/core/main.mk中定义:

复制代码
ifeq (true,$(strip $(enable_target_debugging)))
  # Target is more debuggable and adbd is on by default
  ADDITIONAL_DEFAULT_PROPERTIES += ro.debuggable=1
  # Enable Dalvik lock contention logging.
  ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.lockprof.threshold=500
  # Include the debugging/testing OTA keys in this build.
  INCLUDE_TEST_OTA_KEYS := true
else # !enable_target_debugging
  # Target is less debuggable and adbd is off by default
  ADDITIONAL_DEFAULT_PROPERTIES += ro.debuggable=0
endif # !enable_target_debugging
复制代码

解决:在main.mk中修改ro.debuggable=1

 

也可以不修改ro.debuggable的值:

复制代码
system/core

diff --git a/rootdir/init.rc b/rootdir/init.rc
index a9af0b094..c9bdfab33 100644
--- a/rootdir/init.rc
+++ b/rootdir/init.rc
@@ -1043,14 +1043,14 @@ service console /system/bin/sh
     seclabel u:r:shell:s0
     setenv HOSTNAME console

 
-on init && property:ro.debuggable=1
+on init && property:ro.debuggable=0
     start console
复制代码

 

posted @   M-kobe  阅读(900)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 地球OL攻略 —— 某应届生求职总结
· 周边上新:园子的第一款马克杯温暖上架
· 提示词工程——AI应用必不可少的技术
· Open-Sora 2.0 重磅开源!
点击右上角即可分享
微信分享提示