@@ -152,6 +152,11 @@ int CameraSensor::init()
*/
if (entity_->device()->driver() == "vimc") {
initVimcDefaultProperties();
+
+ ret = discoverAncillaryDevices();
+ if (ret)
+ return ret;
+
return initProperties();
}
@@ -449,6 +449,8 @@ bool PipelineHandlerVimc::match(DeviceEnumerator *enumerator)
dm.add("Sensor B");
dm.add("Debayer A");
dm.add("Debayer B");
+ dm.add("Lens A");
+ dm.add("Lens B");
dm.add("RGB/YUV Input");
dm.add("Scaler");
@@ -12,6 +12,7 @@
#include <libcamera/base/utils.h>
+#include "libcamera/internal/camera_lens.h"
#include "libcamera/internal/camera_sensor.h"
#include "libcamera/internal/device_enumerator.h"
#include "libcamera/internal/media_device.h"
@@ -57,6 +58,12 @@ protected:
return TestFail;
}
+ lens_ = sensor_->focusLens();
+ if (!lens_) {
+ cerr << "Failed to get ancillary lens" << endl;
+ return TestFail;
+ }
+
return TestPass;
}
@@ -104,6 +111,11 @@ protected:
return TestFail;
}
+ if (lens_->setFocusPosition(10)) {
+ cerr << "Failed to set lens focus position" << endl;
+ return TestFail;
+ }
+
return TestPass;
}
@@ -116,6 +128,7 @@ private:
std::unique_ptr<DeviceEnumerator> enumerator_;
std::shared_ptr<MediaDevice> media_;
CameraSensor *sensor_;
+ CameraLens *lens_;
};
TEST_REGISTER(CameraSensorTest)
Use vimc lens to test sensor's ability to discover ancillary lens. Tested with the recent kernel patch for vimc lens: https://lore.kernel.org/linux-media/20220415023855.2568366-1-yunkec@google.com/ Signed-off-by: Yunke Cao <yunkec@google.com> --- src/libcamera/camera_sensor.cpp | 5 +++++ src/libcamera/pipeline/vimc/vimc.cpp | 2 ++ test/camera-sensor.cpp | 13 +++++++++++++ 3 files changed, 20 insertions(+)