- 积分
- 7
贡献41
飞刀4 FD
注册时间2019-3-17
在线时间0 小时
扫一扫,手机访问本帖
|
本帖最后由 thtfpcuser 于 2019-3-17 19:06 编辑
OKMX6X-C-Linux手册-V2.0-2018-03-30.pdf里面介绍了一个工具gstcamera,可以对焦。
af 自动对焦,sp0 对焦无穷远,sp255 对焦最近对焦距离。
手册里面说,输入sp0,sp100,sp255是指定焦距手动对焦,但是我实际测试,结果都是自动对焦。
从驱动程序看,存在问题。ioctl_send_command是响应sp命令的,但是,它调用了自动对焦配置函数ov5640_config_auto_focus()。
驱动程序应该怎么修改呢?应该联系谁呢?
linux-3.0.35\drivers\media\video\mxc\capture\ov5640.c
static int ioctl_send_command(struct v4l2_int_device *s, struct v4l2_send_command_control *vc) {
int ret = -1;
int retval1,retval2;
u8 loca_val=0;
ret = ov5640_set_idle_mode();
if (0 != ret)
pr_err("error %d setting idle mode\n", ret);
ov5640_config_auto_focus();
switch (vc->id) {
case 101: //step to near
pr_debug("Stepping to near object\n");
retval1=ov5640_write_reg(REG_CMD_TAG, 0x01);
retval2=ov5640_write_reg(REG_CMD_MAIN, 0x05);
if(retval1 == 0 && retval2 == 0)
ret = 0;
break;
case 102: //step to far
pr_debug("Stepping to far object\n");
retval1=ov5640_write_reg(REG_CMD_TAG, 0x02);
retval2=ov5640_write_reg(REG_CMD_MAIN, 0x05);
if(retval1 == 0 && retval2 == 0)
ret = 0;
break;
case 103: //step to furthest
pr_debug("Stepping to furthest object\n");
retval1=ov5640_write_reg(REG_CMD_TAG, 0x03);
retval2=ov5640_write_reg(REG_CMD_MAIN, 0x05);
if(retval1 == 0 && retval2 == 0)
ret = 0;
break;
case 104: //step to nearest
pr_debug("Stepping to nearest object\n");
retval1=ov5640_write_reg(REG_CMD_TAG, 0x04);
retval2=ov5640_write_reg(REG_CMD_MAIN, 0x05);
if(retval1 == 0 && retval2 == 0)
ret = 0;
break;
case 105: //step to specified position
pr_debug("Stepping to position: %d\n", vc->value0);
if(vc->value0 < 0 || vc->value0 > 255)
return ret;
loca_val = vc->value0;
retval1=ov5640_write_reg(REG_CMD_TAG, 0x10);
retval2=ov5640_write_reg(REG_CMD_PARA0, loca_val);
ret=ov5640_write_reg(REG_CMD_MAIN, 0x05);
if(retval1 != 0 && retval2 != 0 && ret != 0)
ret = -1;
break;
default:
break;
}
return ret;
}
|
|