To fetch EDID from android device
来源:互联网 发布:哈根达斯 知乎 编辑:程序博客网 时间:2024/06/05 14:49
由于 busybox 并没有把 i2cdump 放入, 所以决定另行开发程式, 依照以往的经验 EDID 会在 /dev/i2c-2 , slave address 0x50,
准备进行 i2c bus 的读取:
1. open file: /dev/i2c-2
2. set slave address: 0x50
file = open("/dev/i2c-2", O_RDWR);if (file < 0) exit(1);if (ioctl(file, I2C_SLAVE, 0x50)<0) {fprintf(stderr,"Error: Could not set address\n");exit(1);}printf("Version: %s\n", VERSION);printf("[VID]=0x%02x 0x%02x\n", i2c_smbus_read_byte_data(file, 8), i2c_smbus_read_byte_data(file, 9));printf("[PID]=0x%02x 0x%02x\n", i2c_smbus_read_byte_data(file, 10), i2c_smbus_read_byte_data(file, 11));
3. 由于知道 vid 在 0x08, 0x09 的位置, 而 pid 在 0x0a, 0x0b 的位置, 藉由呼叫 i2c_smbus_read_byte_data 得出其值
i2c_smbus_read_byte_data 定义于: linux/i2c-dev.h
static inline __s32 i2c_smbus_read_byte_data(int file, __u8 command){union i2c_smbus_data data;if (i2c_smbus_access(file,I2C_SMBUS_READ,command, I2C_SMBUS_BYTE_DATA,&data))return -1;elsereturn 0x0FF & data.byte;}
其中 I2C 存取模式为
#define I2C_SMBUS_READ1
而 I2C transaction type 为
#define I2C_SMBUS_BYTE_DATA 2
i2c_smbus_access(file, I2C_SMBUS_READ, command, I2C_SMBUS_BYTE_DATA, &data) 可理解为从 file 中读取位置 command, 长度为 I2C_SMBUS_BYTE_DATA, 并将
其值传回 data.byte
static inline __s32 i2c_smbus_access(int file, char read_write, __u8 command, int size, union i2c_smbus_data *data){struct i2c_smbus_ioctl_data args;args.read_write = read_write;args.command = command;args.size = size;args.data = data;return ioctl(file,I2C_SMBUS,&args);}
#define I2C_SMBUS0x0720/* SMBus-level access */
源头即是 IOCTL 呼叫, 通道为 I2C_SMBUS, 而 args 则定义了: 读或写, 位置, 长度, 以及回传值的资讯内容.
执行后可看到:
- To fetch EDID from android device
- How to retrieve the Device Unique ID from android device
- Unable to get the focused window from device - android
- Unable to read from device
- How to fetch CRLs from distribution points
- Send email from Android device
- HowTo: Live streaming video/audio from VLC to your Android device (self.Android)
- Unable to read from device 解决办法
- 【Ionic】Error: failed to fetch platform android
- Telnet to your Android device
- EDID
- EDID
- EDID
- Unable to fetch namespace information from active NN at hadoop042/10.1.2.42:8020: Call From hadoop0
- ERROR: 98: Error '!obj' trying to fetch default input device's sample rate
- 错误ERROR: 98: Error '!obj' trying to fetch default input device's sample rate
- Unable to get view server protocol version from device
- 解决错误:Unable to copy symbols from this device
- enumerate
- smartclient--listgrid
- 丰达3829脉冲调整方法:
- RHEL 5.4 安装oracle10.2.0.1并升级10.2.0.4
- poj 1273(dinic....基础题)
- To fetch EDID from android device
- Jefferies分析师称Facebook应该购买webOS
- POJ 3155 Hard Life 最大密度子图
- document 文挡对象详解(js获取遍历images集合,forms集合,textbox,Select,div,checkBox)
- 敏捷个人9月份活动PPT:敏捷个人和敏捷结果,设计你的一天,设计你的一周
- 单列索引和多列索引
- 简单分析WPF是什么
- URL重写
- 查找某个数据,找到后把符合条件数据的一行复制到另外一个地方