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
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 地球OL攻略 —— 某应届生求职总结
· 周边上新:园子的第一款马克杯温暖上架
· 提示词工程——AI应用必不可少的技术
· Open-Sora 2.0 重磅开源!