diff options
author | Ricardo Cerqueira <cyanogenmod@cerqueira.org> | 2014-01-02 20:43:03 +0000 |
---|---|---|
committer | Ricardo Cerqueira <cyanogenmod@cerqueira.org> | 2014-01-02 20:44:25 +0000 |
commit | 40279ba1fd2d4f02d889699df1eccf3d3a01df55 (patch) | |
tree | c6ef3ab0d275a665a8e5f6670b6b47b44fc0516d /camera | |
parent | fa7f881998333debfa6dc5494d586f33ba92086f (diff) | |
download | device_samsung_smdk4412-common-40279ba1fd2d4f02d889699df1eccf3d3a01df55.zip device_samsung_smdk4412-common-40279ba1fd2d4f02d889699df1eccf3d3a01df55.tar.gz device_samsung_smdk4412-common-40279ba1fd2d4f02d889699df1eccf3d3a01df55.tar.bz2 |
camera: Fix loss of focus mode between shots
exynos_camera->focus_mode can't be relied upon to verify the previous
state, since a snapshot will reset the focus state. This was causing
any mode besides auto-focus (enum 0) to fail after the first photo
was taken, including the default continuous-picture.
Always make sure the focus-mode is up to date when set_params is
called
Change-Id: I8e6f52093ad897bcf04bc5047bb1fcd4f109dc55
Diffstat (limited to 'camera')
-rw-r--r-- | camera/exynos_camera.c | 46 |
1 files changed, 21 insertions, 25 deletions
diff --git a/camera/exynos_camera.c b/camera/exynos_camera.c index 7cea71a..59cf23c 100644 --- a/camera/exynos_camera.c +++ b/camera/exynos_camera.c @@ -1057,33 +1057,29 @@ int exynos_camera_params_apply(struct exynos_camera *exynos_camera, int force) focus_mode_string = exynos_param_string_get(exynos_camera, "focus-mode"); if (focus_mode_string != NULL) { - if (focus_mode == 0) { - if (strcmp(focus_mode_string, "auto") == 0) - focus_mode = FOCUS_MODE_AUTO; - else if (strcmp(focus_mode_string, "infinity") == 0) - focus_mode = FOCUS_MODE_INFINITY; - else if (strcmp(focus_mode_string, "macro") == 0) - focus_mode = FOCUS_MODE_MACRO; - else if (strcmp(focus_mode_string, "fixed") == 0) - focus_mode = FOCUS_MODE_FIXED; - else if (strcmp(focus_mode_string, "facedetect") == 0) - focus_mode = FOCUS_MODE_FACEDETECT; - else if (strcmp(focus_mode_string, "continuous-video") == 0) - focus_mode = FOCUS_MODE_CONTINOUS_VIDEO; - else if (strcmp(focus_mode_string, "continuous-picture") == 0) - focus_mode = FOCUS_MODE_CONTINOUS_PICTURE; - else { - exynos_param_string_set(exynos_camera, "focus-mode", - exynos_camera->raw_focus_mode); - return -EINVAL; - } + if (strcmp(focus_mode_string, "auto") == 0) + focus_mode = FOCUS_MODE_AUTO; + else if (strcmp(focus_mode_string, "infinity") == 0) + focus_mode = FOCUS_MODE_INFINITY; + else if (strcmp(focus_mode_string, "macro") == 0) + focus_mode = FOCUS_MODE_MACRO; + else if (strcmp(focus_mode_string, "fixed") == 0) + focus_mode = FOCUS_MODE_FIXED; + else if (strcmp(focus_mode_string, "facedetect") == 0) + focus_mode = FOCUS_MODE_FACEDETECT; + else if (strcmp(focus_mode_string, "continuous-video") == 0) + focus_mode = FOCUS_MODE_CONTINOUS_VIDEO; + else if (strcmp(focus_mode_string, "continuous-picture") == 0) + focus_mode = FOCUS_MODE_CONTINOUS_PICTURE; + else { + exynos_param_string_set(exynos_camera, "focus-mode", + exynos_camera->raw_focus_mode); + return -EINVAL; } - if (focus_mode != exynos_camera->focus_mode || force) { - rc = exynos_v4l2_s_ctrl(exynos_camera, 0, V4L2_CID_CAMERA_FOCUS_MODE, focus_mode); - if (rc < 0) - ALOGE("%s: Unable to set focus mode", __func__); - } + rc = exynos_v4l2_s_ctrl(exynos_camera, 0, V4L2_CID_CAMERA_FOCUS_MODE, focus_mode); + if (rc < 0) + ALOGE("%s: Unable to set focus mode", __func__); exynos_camera->focus_mode = focus_mode; sprintf(exynos_camera->raw_focus_mode, "%s", focus_mode_string); |