libcamera: Test sensor's ability to discover ancillary devices
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> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
parent
1d8fb31759
commit
3d612720fb
2 changed files with 17 additions and 1 deletions
|
@ -152,7 +152,12 @@ int CameraSensor::init()
|
||||||
*/
|
*/
|
||||||
if (entity_->device()->driver() == "vimc") {
|
if (entity_->device()->driver() == "vimc") {
|
||||||
initVimcDefaultProperties();
|
initVimcDefaultProperties();
|
||||||
return initProperties();
|
|
||||||
|
ret = initProperties();
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
return discoverAncillaryDevices();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the color filter array pattern (only for RAW sensors). */
|
/* Get the color filter array pattern (only for RAW sensors). */
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
|
|
||||||
#include <libcamera/base/utils.h>
|
#include <libcamera/base/utils.h>
|
||||||
|
|
||||||
|
#include "libcamera/internal/camera_lens.h"
|
||||||
#include "libcamera/internal/camera_sensor.h"
|
#include "libcamera/internal/camera_sensor.h"
|
||||||
#include "libcamera/internal/device_enumerator.h"
|
#include "libcamera/internal/device_enumerator.h"
|
||||||
#include "libcamera/internal/media_device.h"
|
#include "libcamera/internal/media_device.h"
|
||||||
|
@ -57,6 +58,10 @@ protected:
|
||||||
return TestFail;
|
return TestFail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lens_ = sensor_->focusLens();
|
||||||
|
if (lens_)
|
||||||
|
cout << "Found lens controller" << endl;
|
||||||
|
|
||||||
return TestPass;
|
return TestPass;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,6 +108,11 @@ protected:
|
||||||
return TestFail;
|
return TestFail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (lens_ && lens_->setFocusPosition(10)) {
|
||||||
|
cerr << "Failed to set lens focus position" << endl;
|
||||||
|
return TestFail;
|
||||||
|
}
|
||||||
|
|
||||||
return TestPass;
|
return TestPass;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,6 +125,7 @@ private:
|
||||||
std::unique_ptr<DeviceEnumerator> enumerator_;
|
std::unique_ptr<DeviceEnumerator> enumerator_;
|
||||||
std::shared_ptr<MediaDevice> media_;
|
std::shared_ptr<MediaDevice> media_;
|
||||||
CameraSensor *sensor_;
|
CameraSensor *sensor_;
|
||||||
|
CameraLens *lens_;
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST_REGISTER(CameraSensorTest)
|
TEST_REGISTER(CameraSensorTest)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue