Android i2c-tools移植

Posted yooooooo

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Android i2c-tools移植相关的知识,希望对你有一定的参考价值。

 一、下载I2C-tools工具:

最近在移植i2c-tools工具,下载地址:https://i2c.wiki.kernel.org/index.php/I2C_Tools;百度到了wiki中的git地址;

1  git clone git://git.kernel.org/pub/scm/utils/i2c-tools/i2c-tools.git -b i2c-tools-3.1

 

 

二、将git下载到external目录下,编写android.mk,将其打包system.img:

Android.mk内容如下:

 1 LOCAL_PATH:= $(call my-dir)
 2 
 3 include $(CLEAR_VARS)
 4 
 5 LOCAL_MODULE_TAGS := optional
 6 LOCAL_C_INCLUDES += $(LOCAL_PATH) $(LOCAL_PATH)/$(KERNEL_DIR)/include
 7 LOCAL_SRC_FILES := tools/i2cbusses.c tools/util.c
 8 LOCAL_MODULE := i2c-tools
 9 include $(BUILD_STATIC_LIBRARY)
10 
11 include $(CLEAR_VARS)
12 
13 LOCAL_MODULE_TAGS := optional
14 LOCAL_SRC_FILES:=tools/i2cdetect.c
15 LOCAL_MODULE:=i2cdetect
16 LOCAL_CPPFLAGS += -DANDROID
17 LOCAL_SHARED_LIBRARIES:=libc
18 LOCAL_STATIC_LIBRARIES := i2c-tools
19 LOCAL_C_INCLUDES += $(LOCAL_PATH) $(LOCAL_PATH)/$(KERNEL_DIR)/include
20 include $(BUILD_EXECUTABLE)
21 
22 include $(CLEAR_VARS)
23 
24 LOCAL_MODULE_TAGS := optional
25 LOCAL_SRC_FILES:=tools/i2cget.c
26 LOCAL_MODULE:=i2cget
27 LOCAL_CPPFLAGS += -DANDROID
28 LOCAL_SHARED_LIBRARIES:=libc
29 LOCAL_STATIC_LIBRARIES := i2c-tools
30 LOCAL_C_INCLUDES += $(LOCAL_PATH) $(LOCAL_PATH)/$(KERNEL_DIR)/include
31 include $(BUILD_EXECUTABLE)
32 
33 include $(CLEAR_VARS)
34 
35 LOCAL_MODULE_TAGS := optional
36 LOCAL_SRC_FILES:=tools/i2cset.c
37 LOCAL_MODULE:=i2cset
38 LOCAL_CPPFLAGS += -DANDROID
39 LOCAL_SHARED_LIBRARIES:=libc
40 LOCAL_STATIC_LIBRARIES := i2c-tools
41 LOCAL_C_INCLUDES += $(LOCAL_PATH) $(LOCAL_PATH)/$(KERNEL_DIR)/include
42 include $(BUILD_EXECUTABLE)
43 
44 include $(CLEAR_VARS)
45 
46 LOCAL_MODULE_TAGS := optional
47 LOCAL_SRC_FILES:=tools/i2cdump.c
48 LOCAL_MODULE:=i2cdump
49 LOCAL_CPPFLAGS += -DANDROID
50 LOCAL_SHARED_LIBRARIES:=libc
51 LOCAL_STATIC_LIBRARIES := i2c-tools
52 LOCAL_C_INCLUDES += $(LOCAL_PATH) $(LOCAL_PATH)/$(KERNEL_DIR)/include
53 include $(BUILD_EXECUTABLE)

然后mm命令编译当前目录,生成到:

make snod编译进板子上的system/bin目录下;

 

 

Android下的i2c-tools使用如链接所示,就不提及了;

http://blog.csdn.net/hui872370036/article/details/50379036

 

以上是关于Android i2c-tools移植的主要内容,如果未能解决你的问题,请参考以下文章

Linux I2C总线驱动调试之i2c-tools工具使用

i2c-tools测试工具

Android 平台下使用 i2c-tools

如何使用片段反向移植?

在android中使用底部导航的最佳实践:活动与片段

卡住了从活动到片段的移植