user版本串口不能输入
os:android7.1
描述:编译为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