summaryrefslogtreecommitdiffstats
path: root/libcamera
diff options
context:
space:
mode:
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: