Skip to content

Commit

Permalink
fix #250, ignore AE ready flag (#251)
Browse files Browse the repository at this point in the history
Signed-off-by: 黄子懿 <[email protected]>

Co-authored-by: zhangxiaojingCAN <[email protected]>
  • Loading branch information
MrThanlon and zhangxiaojingCAN authored Jul 31, 2022
1 parent cf8df6e commit 5290dca
Showing 1 changed file with 46 additions and 53 deletions.
99 changes: 46 additions & 53 deletions package/mediactl_lib/src/media_ctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1031,36 +1031,33 @@ int mediactl_all_set_ae(enum isp_pipeline_e pipeline)
}

struct media_entity *sensor0 = v4l_isp.sensor0;
if( ae_stats.ae_wren == 1)
{
ret = v4l2_subdev_open(sensor0);
if (ret < 0)
return ret;
ret = v4l2_subdev_open(sensor0);
if (ret < 0)
return ret;

struct v4l2_control control_s;
control_s.id = V4L2_CID_EXPOSURE;
control_s.value = ae_stats.ae_expl ;
ret = ioctl(sensor0->fd,VIDIOC_S_CTRL,&control_s);
if (ret < 0)
{
printf("%s: ioctl(VIDIOC_S_CTRL-V4L2_CID_GAIN)failed ret(%d)\n", __func__,
ret);
v4l2_subdev_close(sensor0);
return ret;
}
struct v4l2_control control_s;
control_s.id = V4L2_CID_EXPOSURE;
control_s.value = ae_stats.ae_expl ;
ret = ioctl(sensor0->fd,VIDIOC_S_CTRL,&control_s);
if (ret < 0)
{
printf("%s: ioctl(VIDIOC_S_CTRL-V4L2_CID_GAIN)failed ret(%d)\n", __func__,
ret);
v4l2_subdev_close(sensor0);
return ret;
}

control_s.id = V4L2_CID_GAIN;
control_s.value = ae_stats.ae_agco;
ret = ioctl(sensor0->fd,VIDIOC_S_CTRL,&control_s);
if (ret < 0)
{
printf("%s: ioctl(VIDIOC_S_CTRL-V4L2_CID_EXPOSURE)failed ret(%d)\n", __func__,
ret);
v4l2_subdev_close(sensor0);
return ret;
}
control_s.id = V4L2_CID_GAIN;
control_s.value = ae_stats.ae_agco;
ret = ioctl(sensor0->fd,VIDIOC_S_CTRL,&control_s);
if (ret < 0)
{
printf("%s: ioctl(VIDIOC_S_CTRL-V4L2_CID_EXPOSURE)failed ret(%d)\n", __func__,
ret);
v4l2_subdev_close(sensor0);
return ret;
}
v4l2_subdev_close(sensor0);
}

if(ISP_R2K_PIPELINE == pipeline)
Expand Down Expand Up @@ -1091,37 +1088,33 @@ int mediactl_all_set_ae(enum isp_pipeline_e pipeline)
}

struct media_entity *sensor1 = v4l_isp.sensor1;
if( ae_stats.ae_wren == 1)
{
ret = v4l2_subdev_open(sensor1);
if (ret < 0)
return ret;
ret = v4l2_subdev_open(sensor1);
if (ret < 0)
return ret;

struct v4l2_control control_s;
control_s.id = V4L2_CID_EXPOSURE;
control_s.value = ae_stats.ae_expl;
ret = ioctl(sensor1->fd,VIDIOC_S_CTRL,&control_s);
if (ret < 0)
{
printf("%s: ioctl(VIDIOC_S_CTRL-V4L2_CID_GAIN)failed ret(%d)\n", __func__,
ret);
v4l2_subdev_close(sensor1);
return ret;
}
struct v4l2_control control_s;
control_s.id = V4L2_CID_EXPOSURE;
control_s.value = ae_stats.ae_expl;
ret = ioctl(sensor1->fd,VIDIOC_S_CTRL,&control_s);
if (ret < 0)
{
printf("%s: ioctl(VIDIOC_S_CTRL-V4L2_CID_GAIN)failed ret(%d)\n", __func__,
ret);
v4l2_subdev_close(sensor1);
return ret;
}

control_s.id = V4L2_CID_GAIN;
control_s.value = ae_stats.ae_agco;
ret = ioctl(sensor1->fd,VIDIOC_S_CTRL,&control_s);
if (ret < 0)
{
printf("%s: ioctl(VIDIOC_S_CTRL-V4L2_CID_EXPOSURE)failed ret(%d)\n", __func__,
ret);
v4l2_subdev_close(sensor1);
return ret;
}
control_s.id = V4L2_CID_GAIN;
control_s.value = ae_stats.ae_agco;
ret = ioctl(sensor1->fd,VIDIOC_S_CTRL,&control_s);
if (ret < 0)
{
printf("%s: ioctl(VIDIOC_S_CTRL-V4L2_CID_EXPOSURE)failed ret(%d)\n", __func__,
ret);
v4l2_subdev_close(sensor1);
// fprintf(stderr, "exp: %u\tagc: %u\n", ae_stats.ae_expl, ae_stats.ae_agco);
return ret;
}
v4l2_subdev_close(sensor1);
}

return 0;
Expand Down

0 comments on commit 5290dca

Please sign in to comment.