diff options
| author | Diogo Ferreira <defer@cyngn.com> | 2015-12-02 16:14:14 +0000 |
|---|---|---|
| committer | dev-harsh1998 <harshitjain6751@gmail.com> | 2017-10-18 12:57:47 +0530 |
| commit | 4e2408230aa0d14ac635f6ad82e06e3d7e95c5d2 (patch) | |
| tree | a13db1574a6eda52c26eb000817b8a4f31062218 | |
| parent | 058670b015891461fb65a0c9f95eea5bd38f3768 (diff) | |
camera: mm-camera-interface: Also retry in EINVAL
When the firmware is still loading, mm-qcamera-daemon will
return EINVAL. Depending on firmware, loading might take a bit more
time than what's needed before the first request for camera information
occurs.
In Marshmallow, the first request for camera information comes from the
flashlight service which will trigger an EINVAL, exit the retry loop
and fail which means that enabling and disabling the torch using camera2
APIS will fail.
This patch also tolerates EINVAL as a retriable error, making the
flashlight work correctly and fixing the following CTS tests:
android.hardware.camera2.cts.FlashlightTest#testCameraDeviceOpenAfterTorchOn
android.hardware.camera2.cts.FlashlightTest#testSetTorchModeOnOff
android.hardware.camera2.cts.FlashlightTest#testTorchCallback
android.hardware.camera2.cts.FlashlightTest#testTorchModeExceptions
Change-Id: I26040dd9136a18679595a9d3bec5dcc4bbc3d541
| -rw-r--r-- | camera/QCamera2/stack/mm-camera-interface/src/mm_camera.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/camera/QCamera2/stack/mm-camera-interface/src/mm_camera.c b/camera/QCamera2/stack/mm-camera-interface/src/mm_camera.c index 15d9411..20209fd 100644 --- a/camera/QCamera2/stack/mm-camera-interface/src/mm_camera.c +++ b/camera/QCamera2/stack/mm-camera-interface/src/mm_camera.c @@ -271,7 +271,7 @@ int32_t mm_camera_open(mm_camera_obj_t *my_obj) n_try--; my_obj->ctrl_fd = open(dev_name, O_RDWR | O_NONBLOCK); CDBG("%s: ctrl_fd = %d, errno == %d", __func__, my_obj->ctrl_fd, errno); - if((my_obj->ctrl_fd > 0) || (errno != EIO) || (n_try <= 0 )) { + if((my_obj->ctrl_fd > 0) || ((errno != EIO) && (errno != EINVAL)) || (n_try <= 0 )) { CDBG_ERROR("%s: opened, break out while loop", __func__); break; } |
