author | Guosong Zhou <guosong.zhou@amlogic.com> | 2016-07-07 03:31:41 (GMT) |
---|---|---|
committer | Guosong Zhou <guosong.zhou@amlogic.com> | 2016-07-13 10:40:27 (GMT) |
commit | efaad5044fa06e26b7fd463ea736286e765fa8fa (patch) | |
tree | c637d4db762d09cff2a5f95418065301628b941c | |
parent | 43c94189c0db1ec59c39479339b0a1704177e2e0 (diff) | |
download | camera-efaad5044fa06e26b7fd463ea736286e765fa8fa.zip camera-efaad5044fa06e26b7fd463ea736286e765fa8fa.tar.gz camera-efaad5044fa06e26b7fd463ea736286e765fa8fa.tar.bz2 |
PD#125746: camera: fix camera plug
Change-Id: I66728e3b5e056ef3b535a8ee606f359130a311ed
-rw-r--r-- | v3/EmulatedCameraFactory.cpp | 14 | ||||
-rw-r--r-- | v3/EmulatedFakeCamera3.cpp | 1 |
2 files changed, 15 insertions, 0 deletions
diff --git a/v3/EmulatedCameraFactory.cpp b/v3/EmulatedCameraFactory.cpp index ca77151..42569fd 100644 --- a/v3/EmulatedCameraFactory.cpp +++ b/v3/EmulatedCameraFactory.cpp @@ -303,6 +303,7 @@ int EmulatedCameraFactory::get_number_of_cameras(void) break; } } else { + DBG_LOGB("%s : cam is NULL", __FUNCTION__); break; } } @@ -483,6 +484,7 @@ void EmulatedCameraFactory::onStatusChanged(int cameraId, int newStatus) char dev_name[128]; int i = 0 , j = 0; int m = 0, n = 0; + int k = 0; //EmulatedBaseCamera *cam = mEmulatedCameras[cameraId]; const camera_module_callbacks_t* cb = mCallbacks; sprintf(dev_name, "%s%d", "/dev/video", cameraId); @@ -504,6 +506,18 @@ void EmulatedCameraFactory::onStatusChanged(int cameraId, int newStatus) if (mEmulatedCameras[cameraId] != NULL && (!mEmulatedCameras[cameraId]->getHotplugStatus())) { DBG_LOGA("close EmulatedFakeCamera3 object for the last time"); + while (k < 150) { + if (!(mEmulatedCameras[cameraId]->getCameraStatus())) { + usleep(10000); + k++; + } else { + break; + } + } + if (k == 150) { + DBG_LOGA("wait 1s, but camera still not closed , it's abnormal status.\n"); + return; + } delete mEmulatedCameras[cameraId]; mEmulatedCameras[cameraId] = NULL; } diff --git a/v3/EmulatedFakeCamera3.cpp b/v3/EmulatedFakeCamera3.cpp index 79aafa1..09a8cda 100644 --- a/v3/EmulatedFakeCamera3.cpp +++ b/v3/EmulatedFakeCamera3.cpp @@ -180,6 +180,7 @@ EmulatedFakeCamera3::EmulatedFakeCamera3(int cameraId, struct hw_module_t* modul mSupportRotate = 0; mFullMode = 0; mFlushTag = false; + mPlugged = false; gLoadXml.parseXMLFile(); } |