Skip to content

Commit

Permalink
libcamera: touch-to-focus fixes
Browse files Browse the repository at this point in the history
- Do not send command to camera unless preview is started
  (fix 4.3 AOSP camera crash)
- Send touch AF command regardless of previous state
  (required to actually trigger touch AF at the new area)

Change-Id: I51a8f80ce1ec38f1052e4660f708be8649478a88
  • Loading branch information
pawitp authored and bbelos committed Aug 2, 2013
1 parent 6bc408b commit 231e0c5
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions libcamera/SecCamera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2357,7 +2357,8 @@ int SecCamera::setTouchAFStartStop(int start_stop)
{
ALOGV("%s(touch_af_start_stop (%d))", __func__, start_stop);

if (m_touch_af_start_stop != start_stop) {
if (m_flag_camera_start) {
// We need to send this command regardless of previous state to trigger AF
m_touch_af_start_stop = start_stop;
if (fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_TOUCH_AF_START_STOP, start_stop) < 0) {
ALOGE("ERR(%s):Fail on V4L2_CID_CAMERA_TOUCH_AF_START_STOP", __func__);
Expand Down Expand Up @@ -2659,14 +2660,16 @@ int SecCamera::setObjectPosition(int x, int y)
{
ALOGV("%s(setObjectPosition(x=%d, y=%d))", __func__, x, y);

if (fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_OBJECT_POSITION_X, x) < 0) {
ALOGE("ERR(%s):Fail on V4L2_CID_CAMERA_OBJECT_POSITION_X", __func__);
return -1;
}
if (m_flag_camera_start) {
if (fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_OBJECT_POSITION_X, x) < 0) {
ALOGE("ERR(%s):Fail on V4L2_CID_CAMERA_OBJECT_POSITION_X", __func__);
return -1;
}

if (fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_OBJECT_POSITION_Y, y) < 0) {
ALOGE("ERR(%s):Fail on V4L2_CID_CAMERA_OBJECT_POSITION_Y", __func__);
return -1;
if (fimc_v4l2_s_ctrl(m_cam_fd, V4L2_CID_CAMERA_OBJECT_POSITION_Y, y) < 0) {
ALOGE("ERR(%s):Fail on V4L2_CID_CAMERA_OBJECT_POSITION_Y", __func__);
return -1;
}
}

return 0;
Expand Down

0 comments on commit 231e0c5

Please sign in to comment.