@@ -56,9 +56,7 @@ static int hal_init()
{
LOG(HAL, Info) << "Initialising Android camera HAL";
- cameraManager.init();
-
- return 0;
+ return cameraManager.init();
}
/*------------------------------------------------------------------------------
@@ -13,11 +13,14 @@
#include "camera_device.h"
#include "camera_proxy.h"
+#include "device_enumerator.h"
using namespace libcamera;
LOG_DECLARE_CATEGORY(HAL);
+static int initRet = 0;
+
/*
* \class CameraHalManager
*
@@ -49,7 +52,7 @@ int CameraHalManager::init()
MutexLocker locker(mutex_);
cv_.wait(locker);
- return 0;
+ return initRet;
}
void CameraHalManager::run()
@@ -68,6 +71,12 @@ void CameraHalManager::run()
return;
}
+ if (!DeviceEnumerator::haveExpectedCameras(cameraManager_)) {
+ LOG(HAL, Warning) << "Expected cameras not loaded";
+ initRet = -EAGAIN;
+ cv_.notify_one();
+ }
+
/*
* For each Camera registered in the system, a CameraProxy
* gets created here to wraps a camera device.
Return error from hal_init() if the built-in cameras have not been initialized yet. On Chromium OS, this causes Upstart to restart the camera service at a later time, allowing the built-in cameras to be enumerated correctly. This fixes the problem where the camera service is started before the camera device nodes are available. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> --- src/android/camera3_hal.cpp | 4 +--- src/android/camera_hal_manager.cpp | 11 ++++++++++- 2 files changed, 11 insertions(+), 4 deletions(-)