[MTK][TV][Android9.0]增加watchprops工具

目录

1.watchprops代码来源

2.代码修改

2.1 Android.bp 修改

2.2 toolbox 增加子工具

2.3 编译

2.4 工具置入

2.5 工具使用

3 FAQ:

3.1 编译错误

3.2 解决


Author: kevin.xu

Email:13570805860@163.com

1.watchprops代码来源

watchprops.c 在android5.0 toolbox 集合中存在 从6A638/android_v2/system/core/toolbox/ 中拷贝到9632_build/system/core/toolbox

2.代码修改

2.1 Android.bp 修改

diff --git a/system/core/toolbox/Android.bp b/system/core/toolbox/Android.bp
index ddd95b207d..5dd4404bb9 100644
--- a/system/core/toolbox/Android.bp
+++ b/system/core/toolbox/Android.bp
@@ -49,6 +49,7 @@ cc_defaults {
     srcs: [
         "toolbox.c",
         "getevent.c",
+        "watchprops.c",
         "getprop.cpp",
         "newfs_msdos.c",
     ],
@@ -66,6 +67,7 @@ cc_defaults {
         "dd",
         "getevent",
         "getprop",
+       "watchprops",
         "newfs_msdos",
     ],
 }

2.2 toolbox 增加子工具

diff --git a/system/core/toolbox/tools.h b/system/core/toolbox/tools.h
index 505f5281b1..bdd0ba4113 100644
--- a/system/core/toolbox/tools.h
+++ b/system/core/toolbox/tools.h
@@ -2,4 +2,5 @@ TOOL(dd)
 TOOL(getevent)
 TOOL(getprop)
 TOOL(newfs_msdos)
+TOOL(watchprops)
 TOOL(toolbox)

2.3 编译

croot
 mm system/core/toolbox 

2.4 工具置入

拷贝
 out\target\product\m7332_eu\system\bin\toolbox 
与 out\target\product\m7332_eu\system\bin\watchprops 
到主板/system/bin/ 
chmod 777 /system/bin/toolbox /system/bin/watchprops

2.5 工具使用

toolbox watchprops 或 watchprops 便可监控系统属性的变化

3 FAQ:

3.1 编译错误

system/core/toolbox/watchprops.c:15:29: error: implicitly declaring library function 'strlen' with type 'unsigned int (const char *)' [-Werror,-Wimplicit-function-declaration]
    return hashmapHash(key, strlen(key));


system/core/toolbox/watchprops.c:15:29: note: include the header <string.h> or explicitly provide a declaration for 'strlen'
system/core/toolbox/watchprops.c:20:12: error: implicitly declaring library function 'strcmp' with type 'int (const char *, const char *)' [-Werror,-Wimplicit-function-declaration]
    return strcmp(keyA, keyB) == 0;
           ^

system/core/toolbox/watchprops.c:20:12: note: include the header <string.h> or explicitly provide a declaration for 'strcmp'
system/core/toolbox/watchprops.c:37:17: error: implicitly declaring library function 'strdup' with type 'char *(const char *)' [-Werror,-Wimplicit-function-declaration]
    char *key = strdup(name);

3.2 解决

增加头文件 #include <string.h>

4.可执行文件

https://download.csdn.net/download/kevinx_xu/15483235

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值