From 2a96f575f2b5576ace790dd936962dd2f40f89df Mon Sep 17 00:00:00 2001 From: Suman Mukherjee Date: Thu, 29 Jun 2017 17:22:35 +0530 Subject: [PATCH] QCamera2: mm-camera-interface: Camera Daemon late start issue fix In Android O, Cameraporvider service is introduced newly and its starting before main service which results in getnumofcameras failure. Added re-try count to fix this issue. Change-Id: I3a3ee1cbe6ad983d5ad7266f154b33b93d303804 --- .../mm-camera-interface/src/mm_camera_interface.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/camera/QCamera2/stack/mm-camera-interface/src/mm_camera_interface.c b/camera/QCamera2/stack/mm-camera-interface/src/mm_camera_interface.c index 2d26c83..f955db3 100644 --- a/camera/QCamera2/stack/mm-camera-interface/src/mm_camera_interface.c +++ b/camera/QCamera2/stack/mm-camera-interface/src/mm_camera_interface.c @@ -1704,6 +1704,7 @@ void sort_camera_info(int num_cam) uint8_t get_num_of_cameras() { int rc = 0; + int i = 0; int dev_fd = -1; struct media_device_info mdev_info; int num_media_devices = 0; @@ -1782,7 +1783,15 @@ uint8_t get_num_of_cameras() cfg.cfgtype = CFG_SINIT_PROBE_WAIT_DONE; cfg.cfg.setting = NULL; if (ioctl(sd_fd, VIDIOC_MSM_SENSOR_INIT_CFG, &cfg) < 0) { - LOGE("failed"); + LOGI("failed...Camera Daemon may not up so try again"); + for(i = 0; i < MM_CAMERA_EVT_ENTRY_MAX; i++) { + if (ioctl(sd_fd, VIDIOC_MSM_SENSOR_INIT_CFG, &cfg) < 0) { + LOGI("failed...Camera Daemon may not up so try again"); + continue; + } + else + break; + } } close(sd_fd); dev_fd = -1;