资源简介
I2C 调试的好工具 包括 i2cdetect/i2cdump/I2cset/i2cget
android代码形式
代码片段和文件信息
/*
i2cbusses: Print the installed i2c busses for both 2.4 and 2.6 kernels.
Part of user-space programs to access for I2C
devices.
Copyright (c) 1999-2003 Frodo Looijaard and
Mark D. Studebaker
Copyright (C) 2008-2010 Jean Delvare
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License or
(at your option) any later version.
This program is distributed in the hope that it will be useful
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not write to the Free Software
Foundation Inc. 51 Franklin Street Fifth Floor Boston
MA 02110-1301 USA.
*/
/* For strdup and snprintf */
#define _BSD_SOURCE 1
#include
#include
#include /* for NAME_MAX */
#include
#include /* for strcasecmp() */
#include
#include
#include
#include
#include
#include
#include
#include “i2cbusses.h“
#include “linux/i2c-dev.h“
enum adt { adt_dummy adt_isa adt_i2c adt_smbus adt_unknown };
struct adap_type {
const char *funcs;
const char* algo;
};
static struct adap_type adap_types[5] = {
{ .funcs = “dummy“
.algo = “Dummy bus“ }
{ .funcs = “isa“
.algo = “ISA bus“ }
{ .funcs = “i2c“
.algo = “I2C adapter“ }
{ .funcs = “smbus“
.algo = “SMBus adapter“ }
{ .funcs = “unknown“
.algo = “N/A“ }
};
static enum adt i2c_get_funcs(int i2cbus)
{
unsigned long funcs;
int file;
char filename[20];
enum adt ret;
file = open_i2c_dev(i2cbus filename sizeof(filename) 1);
if (file < 0)
return adt_unknown;
if (ioctl(file I2C_FUNCS &funcs) < 0)
ret = adt_unknown;
else if (funcs & I2C_FUNC_I2C)
ret = adt_i2c;
else if (funcs & (I2C_FUNC_SMBUS_BYTE |
I2C_FUNC_SMBUS_BYTE_DATA |
I2C_FUNC_SMBUS_WORD_DATA))
ret = adt_smbus;
else
ret = adt_dummy;
close(file);
return ret;
}
/* Remove trailing spaces from a string
Return the new string length including the trailing NUL */
static int rtrim(char *s)
{
int i;
for (i = strlen(s) - 1; i >= 0 && (s[i] == ‘ ‘ || s[i] == ‘\n‘); i--)
s[i] = ‘\0‘;
return i + 2;
}
void free_adapters(struct i2c_adap *adapters)
{
int i;
for (i = 0; adapters[i].name; i++)
free(adapters[i].name);
free(adapters);
}
/* We allocate space for the adapters in bunches. The last item is a
terminator so here we start with room for 7 adapters which should
be enough in most cases. If not we allocate more later as needed. */
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 10580 2010-12-12 13:22 i2c-tools\include\linux\i2c-dev.h
文件 8549 2013-03-15 01:21 i2c-tools\i2cdetect.c
文件 6608 2010-11-26 10:25 i2c-tools\i2cget.c
文件 1382 2010-11-26 10:25 i2c-tools\i2cbusses.h
文件 1310 2009-01-13 17:46 i2c-tools\util.c
文件 906 2009-01-13 17:46 i2c-tools\util.h
文件 10086 2013-03-15 01:16 i2c-tools\i2cbusses.c
文件 24 2011-12-04 17:33 i2c-tools\version.h
文件 1389 2013-03-15 01:24 i2c-tools\Android.mk
文件 12010 2010-11-26 10:25 i2c-tools\i2cdump.c
文件 11056 2011-02-15 16:12 i2c-tools\i2cset.c
目录 0 2011-12-04 17:56 i2c-tools\include\linux\
目录 0 2013-03-15 01:15 i2c-tools\include\
目录 0 2013-03-15 01:24 i2c-tools\
相关资源
- Android代码-多功能拨号盘源码.zip
- printershare直接破解版--11.5(适配andr
- android RDP远程桌面客户端源码
- 手机远程控制手机android
- spring boot+ios app+android app 即时通讯项目
- Androidrepo文件
- Aandroid 多线程断点续传同时多个大文
- Vue项目实现手机端上传图片,使用于
- Android多文件断点续传
- Android多线程文件夹及断点续传
- android 安卓 FTP 文件 管理
- Android-5.1.1_r1源码.7z
- mac版adb工具
- NFC Card万能读卡android程序
- Android直连Mysql数据库需要导入的jar包
- android实现谷歌地图项目
- Android日历239876
- 主页面框架
- Android双列滑动表格(双表头不动)
- android绘制心电图
- Android安卓中文API开发文档参考手册官
- Android开发的UI图标大全
- Crypto++ 7.0.0 for Android 已编译
- Android手机通过otg线外接usb摄像头
- AndroidStudio使用svn第一次提交忽略文件
- Android编程设计模式之原型模式详解
- 浅谈Android客户端与服务器的数据交互
- 基于android框架的客户端和基于java服务
- 好用的支持android 6.0以上的libserial_p
- AndroidStudio插件配置
评论
共有 条评论