summaryrefslogtreecommitdiff
path: root/src/android/camera_hal_manager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/android/camera_hal_manager.cpp')
-rw-r--r--src/android/camera_hal_manager.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/android/camera_hal_manager.cpp b/src/android/camera_hal_manager.cpp
index 189eda2b..aeff14bd 100644
--- a/src/android/camera_hal_manager.cpp
+++ b/src/android/camera_hal_manager.cpp
@@ -65,28 +65,29 @@ int CameraHalManager::init()
return 0;
}
-CameraDevice *CameraHalManager::open(unsigned int id,
- const hw_module_t *hardwareModule)
+std::tuple<CameraDevice *, int>
+CameraHalManager::open(unsigned int id, const hw_module_t *hardwareModule)
{
MutexLocker locker(mutex_);
if (!callbacks_) {
LOG(HAL, Error) << "Can't open camera before callbacks are set";
- return nullptr;
+ return { nullptr, -ENODEV };
}
CameraDevice *camera = cameraDeviceFromHalId(id);
if (!camera) {
LOG(HAL, Error) << "Invalid camera id '" << id << "'";
- return nullptr;
+ return { nullptr, -ENODEV };
}
- if (camera->open(hardwareModule))
- return nullptr;
+ int ret = camera->open(hardwareModule);
+ if (ret)
+ return { nullptr, ret };
LOG(HAL, Info) << "Open camera '" << id << "'";
- return camera;
+ return { camera, 0 };
}
void CameraHalManager::cameraAdded(std::shared_ptr<Camera> cam)