资源简介
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\
相关资源
- 百度地图自定义Markerandroid
- Android分区工具包
- android-support-v4.jar已打包进去源代码
- u-blox_Android_GNSS_Driver_v3.10驱动源码+中
- 个人根据Android移动开发案例详解手写
- android 视频播放器 项目和原码
- Android【动画】【特效】 17种动画特效
- 基于Android智能家居详细设计(经典)
- android通过JDBC连接Mysql数据库
- Android通讯录的源代码
- android 瀑布流Demo
- 指纹传感器FPC1080在android下的驱动
- delphi xe5 android 调用照相机摄像头拍照
- Android手机连连看游戏源码
- android-sdk-windows v2.3离线完整版
- android 底部弹出菜单(带透明背景)
- Android工程模式简介.rar
- Android蓝牙和Cors网络开发源码
- Android powermanger wakelock
- Android v7的一些jar包
- 最新android supportV7包
- android图片压缩工具类分享
- 单机搭建Android(解决Network is unreach
- Android上监听收到的短信(SMS)
- android电商app源码
- Android代码-多功能拨号盘源码.zip
- printershare直接破解版--11.5(适配andr
- android RDP远程桌面客户端源码
- 手机远程控制手机android
- spring boot+ios app+android app 即时通讯项目
评论
共有 条评论