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
This commit is contained in:
Suman Mukherjee 2017-06-29 17:22:35 +05:30 committed by Isaac Chen
parent afb2b8c829
commit 2a96f575f2

View file

@ -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;