summaryrefslogtreecommitdiffstats
path: root/libcamera
diff options
context:
space:
mode:
authorJeong-Seok Yang <jseok.yang@samsung.com>2011-06-10 00:23:07 +0900
committerWu-cheng Li <wuchengli@google.com>2011-06-19 18:11:13 +0800
commitee461fb117dec3de0f714f393922c05554958608 (patch)
treecb3679eb86fb0d02cdb64fc3c6fabc6b2795f306 /libcamera
parentfa5519d349360dea298e0bb1ca83ba478ac63d08 (diff)
downloaddevice_samsung_crespo-ee461fb117dec3de0f714f393922c05554958608.zip
device_samsung_crespo-ee461fb117dec3de0f714f393922c05554958608.tar.gz
device_samsung_crespo-ee461fb117dec3de0f714f393922c05554958608.tar.bz2
libcamera: for preventing to open camera before releasing another camera
bug:4363159 Opening some camera was successful before releasing another camera. Thus it has been fixed. It will return error if the situation is happened. Change-Id: Id177f7dd0a14b1f7bb72751f432f9b1afee77ede Signed-off-by: Jeong-Seok Yang <jseok.yang@samsung.com>
Diffstat (limited to 'libcamera')
-rw-r--r--libcamera/SecCameraHWInterface.cpp15
-rw-r--r--libcamera/SecCameraHWInterface.h2
2 files changed, 15 insertions, 2 deletions
diff --git a/libcamera/SecCameraHWInterface.cpp b/libcamera/SecCameraHWInterface.cpp
index 5063a12..1dbf1e3 100644
--- a/libcamera/SecCameraHWInterface.cpp
+++ b/libcamera/SecCameraHWInterface.cpp
@@ -132,6 +132,11 @@ CameraHardwareSec::CameraHardwareSec(int cameraId, camera_device_t *dev)
mPictureThread = new PictureThread(this);
}
+int CameraHardwareSec::getCameraId() const
+{
+ return mSecCamera->getCameraId();
+}
+
void CameraHardwareSec::initDefaultParameters(int cameraId)
{
if (mSecCamera == NULL) {
@@ -2664,8 +2669,14 @@ static int HAL_camera_device_open(const struct hw_module_t* module,
}
if (g_cam_device) {
- LOGV("returning existing camera ID %s", id);
- goto done;
+ if (obj(g_cam_device)->getCameraId() == cameraId) {
+ LOGV("returning existing camera ID %s", id);
+ goto done;
+ } else {
+ LOGE("Cannot open camera %d. camera %d is already running!",
+ cameraId, obj(g_cam_device)->getCameraId());
+ return -ENOSYS;
+ }
}
g_cam_device = (camera_device_t *)malloc(sizeof(camera_device_t));
diff --git a/libcamera/SecCameraHWInterface.h b/libcamera/SecCameraHWInterface.h
index a94ab75..6a8fcef 100644
--- a/libcamera/SecCameraHWInterface.h
+++ b/libcamera/SecCameraHWInterface.h
@@ -61,6 +61,8 @@ public:
virtual status_t setPreviewWindow(preview_stream_ops *w);
virtual void release();
+ inline int getCameraId() const;
+
CameraHardwareSec(int cameraId, camera_device_t *dev);
virtual ~CameraHardwareSec();
private: