[libcamera-devel] [PATCH v3 1/5] libcamera: camera_manager: Refactor device enumeration into separate function
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Sun Jun 7 17:52:53 CEST 2020
Hi Umang,
Thank you for the patch.
On Thu, May 21, 2020 at 01:54:23PM +0000, Umang Jain wrote:
> This commit introduces no functional changes.
> Split device enumeration code into a separate function,
> so that the function can be re-used for upcoming hotplug
> functionality in subsequent commits.
>
> Also, fixup correct tag for \todo.
>
> Signed-off-by: Umang Jain <email at uajain.com>
> ---
> src/libcamera/camera_manager.cpp | 19 +++++++++++++------
> 1 file changed, 13 insertions(+), 6 deletions(-)
>
> diff --git a/src/libcamera/camera_manager.cpp b/src/libcamera/camera_manager.cpp
> index 849377a..8d9cb02 100644
> --- a/src/libcamera/camera_manager.cpp
> +++ b/src/libcamera/camera_manager.cpp
> @@ -53,6 +53,7 @@ protected:
>
> private:
> int init();
> + void enumerateDevices();
I'd name this function createPipelineHandlers() to reflect its purpose,
as device enumeration is done before calling it.
> void cleanup();
>
> CameraManager *cm_;
> @@ -120,12 +121,20 @@ int CameraManager::Private::init()
> if (!enumerator_ || enumerator_->enumerate())
> return -ENODEV;
>
> + enumerateDevices();
> +
> + return 0;
> +}
> +
> +void CameraManager::Private::enumerateDevices()
> +{
> /*
> - * TODO: Try to read handlers and order from configuration
> + * \todo Try to read handlers and order from configuration
> * file and only fallback on all handlers if there is no
> * configuration file.
> */
> - std::vector<PipelineHandlerFactory *> &factories = PipelineHandlerFactory::factories();
> + std::vector<PipelineHandlerFactory *> &factories =
> + PipelineHandlerFactory::factories();
>
> for (PipelineHandlerFactory *factory : factories) {
> /*
> @@ -144,14 +153,12 @@ int CameraManager::Private::init()
> }
> }
>
> - /* TODO: register hot-plug callback here */
> -
> - return 0;
> + /* \todo register hot-plug callback here */
> }
>
> void CameraManager::Private::cleanup()
> {
> - /* TODO: unregister hot-plug callback here */
> + /* \todo unregister hot-plug callback here */
s/unregister/Unregister/
Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
>
> /*
> * Release all references to cameras and pipeline handlers to ensure
--
Regards,
Laurent Pinchart
More information about the libcamera-devel
mailing list