四极管: Android开发调试I2C设备驱动 i2cdetect 工具的使用

使用步骤:

         1、在网上搜索一个i2cdetect工具包。我下载的是i2c-tools-3.0.2.tar.bz2。放到windows与ubuntu共享目录。

              tar -xvf i2c-tools-3.0.2.tar.bz2

         2、进入根目录:

zhd@ubuntu:~$ sudo su
[sudo] password for zhd:
root@ubuntu:/home/zhd#

         3、进入tools目录

root@ubuntu:/mnt/hgfs/210/qpad_bin_2012.4/i2c-tools-3.0.2# cd tools/
root@ubuntu:/mnt/hgfs/210/qpad_bin_2012.4/i2c-tools-3.0.2/tools# ls
i2cbusses.c  i2cdetect.8  i2cdump.8  i2cget.8  i2cset.8  Module.mk  util.h
i2cbusses.h  i2cdetect.c  i2cdump.c  i2cget.c  i2cset.c  util.c

         可以发现有如下文件。

          3、编译:

      /data/arm-2009q3/bin/arm-none-linux-gnueabi-gcc  -O2   -I../include -c i2cdetect.c  -static -o i2cdetect.o

      /data/arm-2009q3/bin/arm-none-linux-gnueabi-gcc  -O2   -I../include  -c  i2cbusses.c -static -o i2cbusses.o

       /data/arm-2009q3/bin/arm-none-linux-gnueabi-gcc  -O2   -I../include  i2cdetect.o i2cbusses.o -static -o i2cdetect

查看生成文件:

root@ubuntu:/mnt/hgfs/210/qpad_bin_2012.4/i2c-tools-3.0.2/tools# ls
i2cbusses.c  i2cdetect    i2cdetect.o  i2cget.8  i2cset.c   util.h
i2cbusses.h  i2cdetect.8  i2cdump.8    i2cget.c  Module.mk
i2cbusses.o  i2cdetect.c  i2cdump.c    i2cset.8  util.c

i2cdetect即是我们要使用的文件。

    注意:/data/arm-2009q3/bin/arm-none-linux-gnueabi为您的交叉编译工具目录。

安装好后。


进入adb工具目录:

连接好设备。

在windows环境下。打开命令行,进入adb目录:执行

F:\qpad\qpad_bin_2012.4>adb remount
adb server is out of date.  killing...
* daemon started successfully *
remount succeeded

F:\qpad\qpad_bin_2012.4>adb push i2cdetect /system/bin/
cannot stat 'i2cdetect': No such file or directory

F:\qpad\qpad_bin_2012.4>adb push ../i2cdetect /system/bin/

试了几遍,居然找不到i2cdetect???然后直接从tools把该文件拷贝到
qpad_bin_2012.4目录下,
   F:\qpad\qpad_bin_2012.4>adb push i2cdetect /system/bin/

     3810 KB/s (596956 bytes in 0.153s)

成功。。

可以用adb  shell进入system目录查看是否push成功。在这我就不用去查了。。继续往下


然后就可以再超级终端使用i2cdetect了。。

另,在超级终端设置mksh。。就可以使用犀利的TAB键了

# i2cdetect -y 4                                                               
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- UU -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --                         
# i2cdetect -y 3                                                               
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- UU -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --                         
# i2cdetect -y 5                                                               
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- UU -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- ^C


  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值