From b09c8fdc6045f8a33c897c780dd51177efb28113 Mon Sep 17 00:00:00 2001
From: Santhosh Kumar Thimmanna Bhattar <sthim@codeaurora.org>
Date: Tue, 26 Sep 2017 14:19:09 +0530
Subject: [PATCH] mido: camera: Increase camera daemon start timeout

Issue:
Camera is not launching for the first time as camera
daemon is not up.

Fix:
Increase camera daemon start timeout

Change-Id: I2dd8ae904145ad5c067b27014cdb95c28084accf
---
 .../stack/mm-camera-interface/src/mm_camera_interface.c   | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

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 67b4458..207481b 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
@@ -42,6 +42,8 @@
 #define IOCTL_H <SYSTEM_HEADER_PREFIX/ioctl.h>
 #include IOCTL_H
 
+#define EXTRA_ENTRY 6
+
 // Camera dependencies
 #include "mm_camera_dbg.h"
 #include "mm_camera_interface.h"
@@ -1829,7 +1831,7 @@ uint8_t get_num_of_cameras()
     cfg.cfg.setting = NULL;
     if (ioctl(sd_fd, VIDIOC_MSM_SENSOR_INIT_CFG, &cfg) < 0) {
         LOGI("failed...Camera Daemon may not up so try again");
-        for(i = 0; i < MM_CAMERA_EVT_ENTRY_MAX; i++) {
+        for(i = 0; i < (MM_CAMERA_EVT_ENTRY_MAX + EXTRA_ENTRY); i++) {
             if (ioctl(sd_fd, VIDIOC_MSM_SENSOR_INIT_CFG, &cfg) < 0) {
                 LOGI("failed...Camera Daemon may not up so try again");
                 continue;
@@ -1883,7 +1885,7 @@ uint8_t get_num_of_cameras()
             if(entity.type == MEDIA_ENT_T_DEVNODE_V4L && entity.group_id == QCAMERA_VNODE_GROUP_ID) {
                 strlcpy(g_cam_ctrl.video_dev_name[num_cameras],
                      entity.name, sizeof(entity.name));
-                LOGI("dev_info[id=%d,name='%s']\n",
+                LOGE("dev_info[id=%d,name='%s']\n",
                     (int)num_cameras, g_cam_ctrl.video_dev_name[num_cameras]);
                 num_cameras++;
                 break;
@@ -1902,7 +1904,7 @@ uint8_t get_num_of_cameras()
     sort_camera_info(g_cam_ctrl.num_cam);
     /* unlock the mutex */
     pthread_mutex_unlock(&g_intf_lock);
-    LOGI("num_cameras=%d\n", (int)g_cam_ctrl.num_cam);
+    LOGE("num_cameras=%d\n", (int)g_cam_ctrl.num_cam);
     return(uint8_t)g_cam_ctrl.num_cam;
 }
 
-- 
GitLab